from nltk.corpus import CategorizedPlaintextCorpusReader
reader = (r'/[볼륨명]/Data/NLPCookBook/Reviews/txt_sentoken',r'*\.txt', cat_pattern=r'(\w+/*')
Print(reader.categories())
print(reader.fileids())我试着用myself.So学习使用python的自然语言处理,我完全按照书上说的做了,我得到了这样的错误。
Exception has occurred: OSError
No such file or directory: 'C:\\[볼륨명]\\Data\\NLPCookBook\\Reviews\\txt_sentoken'
File "C:\Users\user\Desktop\python study\.vscode\external_corpus.py", line 2, in <module>
reader = CategorizedPlaintextCorpusReader(r'/[볼륨명]/Data/NLPCookBook/Reviews/txt_sentoken',r'*\.txt', cat_pattern=r'(\w+/*')书上说我应该
['neg', 'pos']
[neg/cv00_tok-9611.txt, ~~~~~发布于 2022-10-31 13:34:56
Exception has occurred: OSError No such file or directory它只是意味着您要查找的文件在您指定的路径中不存在,请尝试更改文件路径。
https://stackoverflow.com/questions/74263979
复制相似问题