mirror of
https://github.com/fxsjy/jieba.git
synced 2025-07-10 00:01:33 +08:00
将exstract_tags参数allowPOS转换为frozenset以减少查找时间。
This commit is contained in:
parent
dd62477605
commit
bab5f362ba
@ -74,6 +74,7 @@ def extract_tags(sentence, topK=20, withWeight=False, allowPOS=[]):
|
||||
idf_freq, median_idf = idf_loader.get_idf()
|
||||
|
||||
if allowPOS:
|
||||
allowPOS = frozenset(allowPOS)
|
||||
words = jieba.posseg.cut(sentence)
|
||||
else:
|
||||
words = jieba.cut(sentence)
|
||||
|
Loading…
x
Reference in New Issue
Block a user