mirror of
https://github.com/fxsjy/jieba.git
synced 2025-07-10 00:01:33 +08:00
fix issues (https://github.com/fxsjy/jieba/issues/125)
This commit is contained in:
parent
fc511de012
commit
77b442fa88
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user