解决不可下载环境中的“找不到资源停用词”

问题描述

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

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

Resource stopwords not found.

是否有任何方法可以在jupyter笔记本上克隆,复制和粘贴自己或创建stopwords

解决方法

您可以通过复制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'}