Beispiel #1
0
    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]))
Beispiel #2
0
    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]))

        """