Merge pull request #184 from keroro520/master

fix issues 125 (https://github.com/fxsjy/jieba/issues/125)
This commit is contained in:
Sun Junyi 2014-09-12 17:43:43 +08:00
commit 7f965e0aa3

View File

@ -26,6 +26,8 @@ def get_idf(abs_path):
content = open(abs_path,'rb').read().decode('utf-8')
idf_freq = {}
lines = content.split('\n')
if lines and not lines[-1]:
lines.pop(-1)
for line in lines:
word,freq = line.split(' ')
idf_freq[word] = float(freq)