Fix up python test code

This commit is contained in:
Dirkjan Ochtman 2021-08-31 14:49:38 +02:00
parent 906f202611
commit b92830249f
1 changed files with 2 additions and 2 deletions

View File

@ -3,12 +3,12 @@ import instant_segment, os, sys
DATA_DIR = os.path.join(os.path.dirname(__file__), '../../data/')
def unigrams():
for ln in open(os.path.join(DATA_DIR, 'unigrams.txt')):
for ln in open(os.path.join(DATA_DIR, 'en-unigrams.txt')):
parts = ln.split('\t', 1)
yield (parts[0], float(parts[1].strip()))
def bigrams():
for ln in open(os.path.join(DATA_DIR, 'bigrams.txt')):
for ln in open(os.path.join(DATA_DIR, 'en-bigrams.txt')):
word_split = ln.split(' ', 1)
score_split = word_split[1].split('\t', 1)
yield ((word_split[0], score_split[0]), float(score_split[1].strip()))