NLP 2
NLP 2
Program:
import nltk #importing nltk library
nltk.download('punkt') #downloading punkt for tokenization
from nltk.tokenize import word_tokenize #importing word_tokenize for tokenization
#Tokenization
tokens = word_tokenize(text) #tokenizing the text
print("Tokens: \n", tokens)
#converting to lowercase
print("Filtered Tokens:\n", filtered_tokens)
print("Filtered Text:\n", ' '.join(filtered_tokens),'\n')
Pro:-2
import nltk
nltk.download('brown')
from nltk.corpus import brown