예제 #1
0
파일: test_ibm1.py 프로젝트: baio/cour-nlp
    def test_initialize_debug(self):
        return
        t_e_f = align_lines(["the dog", "the cat", "the rat", "some thing"],
                         ["athe adog", "bthe bcat", "athe crat", "asome athing"])

        with open("data/t_e_f.out", "w") as fs:
            for e in t_e_f:
                for f_t in t_e_f[e]:
                    fs.write("{} {} {}\n".format( e, f_t, t_e_f[e][f_t]))
예제 #2
0
파일: test_ibm1.py 프로젝트: baio/cour-nlp
    def test_align_corpus(self):
        #return
        with open("data/corpus.en") as fs:
            e = fs.read().split("\n")
        with open("data/corpus.es") as fs:
            f = fs.read().split("\n")
        t_e_f = align_lines(e, f)

        with open("data/trained_align.out", "w") as fs:
            for e in t_e_f:
                for f_t in t_e_f[e]:
                    fs.write("{} {} {}\n".format( e, f_t, t_e_f[e][f_t]))

        """