使用PlaintextCorpusReader 載入自己的語料
假設你的文件的位置:C:\cl
form nltk.corpus import PlaintCorpusReader
corpus_root=r'C:\cl'
wordlist=PlaintextCorpusReader(corpus_root,'.*')
print(wordlist.fileids())
結果輸入C:\cl下的所有類型文件
使用PlaintextCorpusReader 載入自己的語料
假設你的文件的位置:C:\cl
form nltk.corpus import PlaintCorpusReader
corpus_root=r'C:\cl'
wordlist=PlaintextCorpusReader(corpus_root,'.*')
print(wordlist.fileids())
結果輸入C:\cl下的所有類型文件