Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'))