Fix up python test code
This commit is contained in:
parent
906f202611
commit
bd12ef8b69
|
@ -3,12 +3,12 @@ import instant_segment, os, sys
|
||||||
DATA_DIR = os.path.join(os.path.dirname(__file__), '../../data/')
|
DATA_DIR = os.path.join(os.path.dirname(__file__), '../../data/')
|
||||||
|
|
||||||
def unigrams():
|
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)
|
parts = ln.split('\t', 1)
|
||||||
yield (parts[0], float(parts[1].strip()))
|
yield (parts[0], float(parts[1].strip()))
|
||||||
|
|
||||||
def bigrams():
|
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)
|
word_split = ln.split(' ', 1)
|
||||||
score_split = word_split[1].split('\t', 1)
|
score_split = word_split[1].split('\t', 1)
|
||||||
yield ((word_split[0], score_split[0]), float(score_split[1].strip()))
|
yield ((word_split[0], score_split[0]), float(score_split[1].strip()))
|
||||||
|
|
Loading…
Reference in New Issue