Skip to content

Instantly share code, notes, and snippets.

View payalmhjn's full-sized avatar
🏠
Working from home

Payal Mahajan payalmhjn

🏠
Working from home
View GitHub Profile
#Tokenisation, Lemmatising, Stemming, Corpus
import nltk
nltk.download()
#eg1
from nltk.tokenize import sent_tokenize, word_tokenize
sentence1 = "Ravi and Raj went for a walk"
print(word_tokenize(sentence1))
#eg2
#eg1
import re
string = "Lotus is the national flower of my country"
pattern = "Lotus"
ex1 = re.match(pattern, string)
print(ex1)
#eg2
pattern2 = "Rose"
ex2 = re.match(pattern2, string)