NLTK
Very easy to tokenize the statement with NLTK of python
import nltk
word_data ='Sitting pretty,impatient, work from home,
we can work from home'
tokens = nltk.word_tokenize(word_data)
print(tokens)
#['Sitting', 'pretty', ',', 'impatient', ',', 'work',
'from', 'home', ',', 'we', 'can', 'work', 'from', 'home']
Another Exercise:
sentence_data = "Johhny Jonny Yes papa.
Eating Sugar No. NO. papa "
nltk_tokens = nltk.sent_tokenize(sentence_data)
print(nltk_tokens) # ['Johhny Jonny Yes papa.',
'Eating Sugar No.', 'NO.', 'papa']
Happy Learning @AMET ODL!!!
No comments:
Post a Comment