Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Payal Mahajan payalmhjn

🏠
Working from home
View GitHub Profile
View NLP_techniques.py
#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
View NLP_regular_expression.py
#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)