在不可下载的环境中解析“未找到资源停止字”

2024-04-28 11:00:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我在一个无法下载模块的环境中工作。我需要使用计算机上的现有模块

我可以使用nltk模块,但安装的版本不包含stopwords,因此我无法在我的skip gram中处理语料库。因此,我总是会遇到以下错误消息:

Resource stopwords not found.

有没有办法克隆、复制和复制;在jupyter笔记本上粘贴或创建stopwords我自己


Tags: 模块版本消息计算机错误notresourcegram
1条回答
网友
1楼 · 发布于 2024-04-28 11:00:44

您可以通过复制nltk.corpus.stopwords的内容来创建一个文件或创建一个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'}

相关问题 更多 >