Seven 1987 twenty '79 zero two 78-degrees eighty-four IX '60s. Mid-1890 nine-thirty forty-two one-tenth ten million 0.5 one forty. & 'n and both but either et for less minus neither nor or plus so Get information about all tags used in NLTK POS Tagger Ourselves ownself self she thee theirs them themselves they thou thy us Hers herself him himself hisself it itself me myself one oneself ours Get information of Tags starting from any particular letter (using Regular Expression) Stirringly prominently technologically magisterially predominately Occasionally unabatingly maddeningly adventurously professedly The following code will show all the tags used in NLTK POS Tagger. Getting Information of Tags used in NLTK POS Tagger Text_tagged = pos_tag_sents(text_word_tokens) Text_word_tokens.append(word_tokenize(sentence_token)) Text_sentence_tokens = sent_tokenize(text)įor sentence_token in text_sentence_tokens: He played best after a couple of martinis." Hence, he received the best song of the year award. Text = "The goal was to best the competition. Pos_tag_sents module is used to POS Tag on sentence level.įrom nltk.tokenize import word_tokenize, sent_tokenize – Fourth sentence = Adverb (He played best after a couple of martinis.) – Third sentence = Adjective (Hence, he received the best song of the year award.) – Second sentence = Noun (His latest song was a personal best.) – First sentence = Verb (The goal was to best the competition.) The word best is used as different part-of-speech in each sentence. The same word “best” is used differently in all of the four sentences. In this example, we have a text with 4 sentences. Text = "They received the best film of the year award." We take a simple one sentence text and tag all the words of the sentence using NLTK’s pos_tag module. Here’s a simple example of Part-of-Speech (POS) Tagging.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |