mirror of
https://github.com/fxsjy/jieba.git
synced 2025-07-10 00:01:33 +08:00
Merge pull request #184 from keroro520/master
fix issues 125 (https://github.com/fxsjy/jieba/issues/125)
This commit is contained in:
commit
7f965e0aa3
@ -26,6 +26,8 @@ def get_idf(abs_path):
|
|||||||
content = open(abs_path,'rb').read().decode('utf-8')
|
content = open(abs_path,'rb').read().decode('utf-8')
|
||||||
idf_freq = {}
|
idf_freq = {}
|
||||||
lines = content.split('\n')
|
lines = content.split('\n')
|
||||||
|
if lines and not lines[-1]:
|
||||||
|
lines.pop(-1)
|
||||||
for line in lines:
|
for line in lines:
|
||||||
word,freq = line.split(' ')
|
word,freq = line.split(' ')
|
||||||
idf_freq[word] = float(freq)
|
idf_freq[word] = float(freq)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user