python - NLTK 可用于停用词的语言
问题描述
我想知道在哪里可以找到 NLTK 停用词支持的语言(及其键)的完整列表。
我在https://pypi.org/project/stop-words/中找到了一个列表,但它不包含每个国家/地区的密钥。因此,尚不清楚您是否可以通过简单地检索列表stopwords.words("Bulgarian")
。事实上,这会引发错误。
我查看了 NLTK 站点,有 4 个文档与“停用词”匹配,但没有一个文档描述了这一点。 https://www.nltk.org/search.html?q=stopwords&check_keywords=yes&area=default
他们的书中什么也没说: http ://www.nltk.org/book/ch02.html#stopwords_index_term
那么,你知道我在哪里可以找到钥匙列表吗?
解决方案
当您使用以下方法导入停用词时:
from nltk.corpus import stopwords
english_stopwords = stopwords.words(language)
您正在根据 fileid(语言)检索停用词。为了查看所有可用的停用词语言,您可以使用以下命令检索文件 ID 列表:
from nltk.corpus import stopwords
print(stopwords.fileids())
对于 nltk v3.4.5,这将返回 23 种语言:
['arabic',
'azerbaijani',
'danish',
'dutch',
'english',
'finnish',
'french',
'german',
'greek',
'hungarian',
'indonesian',
'italian',
'kazakh',
'nepali',
'norwegian',
'portuguese',
'romanian',
'russian',
'slovene',
'spanish',
'swedish',
'tajik',
'turkish']
推荐阅读
- java - Intellij IDEA 不构建 maven 项目
- unity3d - 为什么 Unity 给我构建错误
- elasticsearch - 使用 Apache NIfi 将数据从 RDBMS 迁移到 ElasticSearch
- angular - 如何从角度9中的当前日期减去一天
- reactjs - 反应 + 码头工人 + Nginx
- ios - Xcode 11.5 - 分段错误 11
- java - 动态 switch-case - 基于文本的 RPG
- reactjs - 使用 React js 计算学生成绩错误
- typescript - 将路由器路由到 Oak 框架中的另一个路由器,例如 ExpressJS
- css - 在 webpack 中导入 mobiscroll css 样式时出错