From 49657c976d3050a5acd0ad074d393904d338ec51 Mon Sep 17 00:00:00 2001 From: fxsjy Date: Sat, 14 Feb 2015 21:23:58 +0800 Subject: [PATCH] make extract_tags behavior compatiable with previous version --- jieba/analyse/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jieba/analyse/__init__.py b/jieba/analyse/__init__.py index e65acba..d5b26db 100755 --- a/jieba/analyse/__init__.py +++ b/jieba/analyse/__init__.py @@ -60,14 +60,14 @@ def set_stop_words(stop_words_path): for line in lines: STOP_WORDS.add(line) -def extract_tags(sentence, topK=20, withWeight=False, allowPOS=['ns', 'n', 'vn', 'v']): +def extract_tags(sentence, topK=20, withWeight=False, allowPOS=[]): """ Extract keywords from sentence using TF-IDF algorithm. Parameter: - topK: return how many top keywords. `None` for all possible words. - withWeight: if True, return a list of (word, weight); if False, return a list of words. - - allowPOS: the allowed POS list eg. ['ns', 'n', 'vn', 'v']. + - allowPOS: the allowed POS list eg. ['ns', 'n', 'vn', 'v','nr']. if the POS of w is not in this list,it will be filtered. """ global STOP_WORDS, idf_loader