Sunday, 17 April 2022

P#26 natural Language processing

 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

Making Prompts for Profile Web Site

  Prompt: Can you create prompt to craft better draft in a given topic. Response: Sure! Could you please specify the topic for which you...