2013-01-07 81 views

回答

1

託管推測出來的東西:

# How to load a text file as a corpus. 
import nltk 
from nltk.corpus import PlaintextCorpusReader 
from nltk.corpus.util import LazyCorpusLoader 
afrikaans = LazyCorpusLoader('afrikaans', PlaintextCorpusReader, r'(?!\.).*\.txt') 
afrikaans.sents()[1] 
af = nltk.Text(afrikaans.words()) 
af.concordance("mense") 

這裏假設你的語料文本文件是在C:\ nltk_data \語料庫\南非\ afrikaans.txt

相關問題