【发布时间】:2019-08-05 07:44:27
【问题描述】:
我希望 TfidfVectorizer 的特征化考虑一些预定义的单词,例如 "script", "rule", 只能在二元组中使用。
如果我有短信"Script include is a script that has rule which has a business rule"
如果我使用上面的文字
tfidf = TfidfVectorizer(ngram_range=(1,2),stop_words='english')
我应该得到
['script include','business rule','include','business']
【问题讨论】:
-
为什么'include script'不在你的输出中,因为'include is a script' 'is a' 是停用词,而您正在删除停用词。你能澄清一下吗
标签: python scikit-learn tfidfvectorizer