Natural Language Processing (NLP) with Python
In [1]: import nltk #package for nlp nltk . download ( 'punkt' ) [nltk_data] Downloading package punkt to [nltk_data] C:\Users\neerajshinde\AppData\Roaming\nltk_data... [nltk_data] Package punkt is already up-to-date! Out[1]: True In [2]: from nltk.tokenize import sent_tokenize In [3]: text = """Hello, Mr. Neeraj! How are you doing? The weather is Great and city is awesome. The sky is pinkish-blue. You should not eat a mango""" In [4]: tokenized_sent = sent_tokenize ( text ) tokenized_sent Out[4]: ['Hello, Mr. Neeraj!', 'How are you doing?', 'The weather is Great and city is awesome.', 'The sky is pinkish-blue.', 'You should not eat a mango'] In [5]: from nltk.tokenize import word_tokenize word_tokens = word_tokenize ( text ) word_tokens Out[5]: ['Hello', ',', 'Mr.', 'Neeraj', '!', 'How', 'are', 'you', ...