I have a question about the Python encoded command in the NLTK. First of all, I came through a simple example:
textList.concordance ('CNA')
However, I got the error
AttributeError: 'List' object does not have any attribute 'Integration'
In the example, is there any Do not have a list? I wonder what's going on here
.concordance ()
There is a special nltk function. So you can not call it on any dragon object (like your list).
More specifically: .concordance ()
is a way
Basically, if you type .concordance ()
If you want to use, you have to first need to instantize a text object, and then call it on that object.
A text is usually started with a given document or corpus. Like: import nltk.corpus from import nltk.text text moby = text (nltk.corpus.gutenberg.words ('melville-moby_dick.txt'))
Unity (word, width = 79, rows = 25)
Print a uniformity for the word with the specified reference window. Word match is not case-sensitive.
Then I will do something like this (not tested)
import nltk Text from nltk.text import text textList = text (nltk.corpus) .gutenberg.words ('your file name is here .txt')) textList.concordance ('cnA')
No comments:
Post a Comment