python - 在不可下载的环境中解决“找不到资源停用词”
问题描述
我在无法下载模块的环境中工作。我需要使用计算机上的现有模块。
我可以使用nltk
模块,但安装的版本不包含stopwords
,所以我无法处理我的 skip-gram 中的语料库。所以,我总是遇到这个错误信息:
Resource stopwords not found.
有没有办法stopwords
在 jupyter notebook 上克隆、复制和粘贴或创建自己?
解决方案
您可以stopwords
通过复制其内容来创建一个文件或创建一个变量,nltk.corpus.stopwords
其中的内容只是一组单词。
from nltk.corpus import stopwords
words = set(stopwords.words('english'))
print(words)
输出:
{'does', "it's", 'having', 've', "hadn't", "isn't", 'this', 'him', 'ours', "mustn't", 'are', 'if', 'we', 'myself', 'these', 'a', 'not', 'what', 'weren', 'down', 'have', "couldn't", 'after', 'again', 'most', 'at', 'such', 'by', 'just', 'd', 'i', "you'll", 'should', "haven't", 'as', 'do', 'from', 'other', 'than', 'which', 'were', 'mustn', 'yours', "aren't", 'now', 'didn', "won't", 'be', 'itself', 'in', 'all', 'once', 'few', 'through', 'its', "didn't", 'needn', 'being', 'them', "you'd", 'or', 'it', 'to', 'your', "shan't", 'too', 'our', 'ourselves', 'his', 'am', 'below', 'isn', 'ma', 'further', 'yourself', 'out', 'up', "don't", 'with', 'but', 'where', 'then', 'whom', 'each', 'hasn', 'very', 'more', 'he', 'won', 't', 'doing', 'until', 'doesn', 'herself', 'who', 'own', "wasn't", 'those', 'nor', "you're", 'shan', 'himself', 'll', 'that', 'both', 'shouldn', "you've", 'over', 'an', 'when', 'because', 'ain', 'had', 'haven', 'themselves', 'same', 'under', 'no', "mightn't", 'couldn', 'you', 'while', 'and', 'during', 'yourselves', 'my', "shouldn't", "wouldn't", 'off', 'she', 'me', 'wasn', 'above', 'y', 'will', 'been', 'mightn', 'was', 'before', "needn't", 'so', 'on', 's', 'some', 'their', 'can', 'how', 'is', 'hadn', 'wouldn', 'here', 'why', 'her', 'only', 'the', 'o', "should've", 'hers', "doesn't", 'don', 'against', "weren't", 'about', 'm', "she's", 'of', 'into', 're', 'they', "that'll", 'aren', "hasn't", 'theirs', 'between', 'there', 'did', 'has', 'for', 'any'}
推荐阅读
- git - (GitKraken)预提交失败退出代码:1
- enums - 如何返回特定索引处的枚举字符串?
- mysql - 从另一台计算机访问数据库
- powershell - 执行powershell脚本的任务调度程序没有得到对webRequest的响应
- ios - 如何在 Xamarin iOS 中为标题添加下划线
- google-api - 查看 G-suite 设备登录历史记录
- jboss - 使用第三方 jdbc jar 与 jboss_redirected 冲突。_DocumentBuilderfactory
- java - 我可以将 Spring bean 自动装配到 MapStruct 接口中吗?
- android - Android Studio 中的 Firebase 后端代码安排
- wordpress - 请求关于创建新闻数据库的 SQL 想法