Fix up python test code
This commit is contained in:
parent
906f202611
commit
b92830249f
|
@ -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()))
|
||||
|
|
Loading…
Reference in New Issue