How to use the epitran.vector.VectorsWithIPASpace function in epitran

To help you get started, we’ve selected a few epitran examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dmort27 / epitran / epitran / bin / testvectorgen.py View on Github external
def main(code, space, infile):
    vec = epitran.vector.VectorsWithIPASpace(code, space)
    with codecs.open(infile, 'r', 'utf-8') as f:
        for line in f:
            fields = line.split('\t')
            if len(fields) > 1:
                word = fields[0]
                print(u"WORD: {}".format(word).encode('utf-8'))
                segs = vec.word_to_segs(word)
                for record in segs:
                    cat, case, orth, phon, id_, vector = record
                    print(u"Category: {}".format(cat).encode('utf-8'))
                    print(u"Case: {}".format(case).encode('utf-8'))
                    print(u"Orthographic: {}".format(orth).encode('utf-8'))
                    print(u"Phonetic: {}".format(phon).encode('utf-8'))
                    print(u"Vector: {}".format(vector).encode('utf-8'))