mirror of
https://github.com/fxsjy/jieba.git
synced 2025-07-10 00:01:33 +08:00
fix indent typo
This commit is contained in:
parent
6fad5fbb2c
commit
b16cf0d63f
@ -24,13 +24,13 @@ def set_idf_path(idf_path):
|
|||||||
|
|
||||||
def get_idf(abs_path):
|
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')
|
||||||
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)
|
||||||
median_idf = sorted(idf_freq.values())[len(idf_freq)/2]
|
median_idf = sorted(idf_freq.values())[len(idf_freq)/2]
|
||||||
return idf_freq, median_idf
|
return idf_freq, median_idf
|
||||||
|
|
||||||
def set_stop_words(stop_words_path):
|
def set_stop_words(stop_words_path):
|
||||||
global STOP_WORDS
|
global STOP_WORDS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user