Python में Natural Language Processing (NLP)
Fouad Trad
Machine Learning Engineer

किसी टेक्स्ट का विषय समझने के लिए

किसी टेक्स्ट का विषय समझने के लिए

जहाँ टेक्स्ट के हर शब्द की ज़रूरत हो

NLTK कई भाषाओं के लिए स्टॉप वर्ड्स की सूची देता है
from nltk.corpus import stopwords nltk.download('stopwords')stop_words = stopwords.words('english')print(stop_words[:10])
['a', 'about', 'above', 'after', 'again', 'against', 'ain', 'all', 'am', 'an']
from nltk.tokenize import word_tokenizetext = "This is an example to demonstrate removing stop words."tokens = word_tokenize(text)# The .lower() method helps with case sensitivity filtered_tokens = [word for word in tokens if word.lower() not in stop_words]print(filtered_tokens)
['example', 'demonstrate', 'removing', 'stop', 'words', '.']

दस्तावेज़ों में सामान्य या महत्वपूर्ण शब्द ढूँढने वाले टास्क

दस्तावेज़ों में सामान्य या महत्वपूर्ण शब्द ढूँढने वाले टास्क

जहाँ वाक्य संरचना स्पष्टता के लिए बनी रहनी चाहिए

import string
print(string.punctuation)
!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
text = "This is an example to demonstrate removing stop words." tokens = word_tokenize(text) filtered_tokens = [word for word in tokens if word.lower() not in stop_words]clean_tokens = [word for word in filtered_tokens if word not in string.punctuation]print(clean_tokens)
['example', 'demonstrate', 'removing', 'stop', 'words']
Python में Natural Language Processing (NLP)