I need a small python code that opens a text file, reads that text file, and runs a basic command from the nltk toolkit. The command is as follows:
def extract_nouns(abstract):
import nltk
tokens = nltk.word_tokenize(abstract)
tagged = nltk.pos_tag(tokens)
nouns = [word for word, pos in tagged if (pos == 'NN' or pos == 'NNP' or pos == 'NNS' or pos == 'NNPS')]
word_vector = [[login to view URL]() for x in nouns]
return word_vector
I am getting some error with the text file (attached) when I run the nltk.
Hello. Happy new year!!!
I saw your description and attached files.
I understood it and can do it well.
I have done several project like this.
I'm an expert in Data Structures and Algorithms.
And I know Java ,C/C++,C# and Python well.
I'm interested this project.
I want to discuss with you about this project.
If it's possible,please contact me and explain more detail.
I wait your good reply.
Bye.