nltk document

Solutions on MaxInterview for nltk document by the best coders in the world

showing results for - "nltk document"
Antony
08 Oct 2016
1>>> import nltk
2>>> sentence = """At eight o'clock on Thursday morning
3... Arthur didn't feel very good."""
4>>> tokens = nltk.word_tokenize(sentence)
5>>> tokens
6['At', 'eight', "o'clock", 'on', 'Thursday', 'morning',
7'Arthur', 'did', "n't", 'feel', 'very', 'good', '.']
8>>> tagged = nltk.pos_tag(tokens)
9>>> tagged[0:6]
10[('At', 'IN'), ('eight', 'CD'), ("o'clock", 'JJ'), ('on', 'IN'),
11('Thursday', 'NNP'), ('morning', 'NN')]
12