स्टॉप वर्ड्स और विराम-चिह्न हैंडलिंग

Python में Natural Language Processing (NLP)

Fouad Trad

Machine Learning Engineer

स्टॉप वर्ड्स

  • बार-बार आते हैं पर संदर्भ समझने में मशीन को कम मदद करते हैं
  • कई NLP टास्क में कम मूल्य जोड़ते हैं
  • इन्हें हटाने से मॉडल महत्वपूर्ण शब्दों पर ध्यान देते हैं

a, an, the, in, of, that, for, by आदि जैसे कई स्टॉपवर्ड्स दिखाती इमेज

Python में Natural Language Processing (NLP)

स्टॉप वर्ड्स हटाना

उपयोगी

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

मोबाइल ऐप पर किसी प्रोडक्ट की रिव्यूज़ दिखाती इमेज

Python में Natural Language Processing (NLP)

स्टॉप वर्ड्स हटाना

उपयोगी

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

मोबाइल ऐप पर किसी प्रोडक्ट की रिव्यूज़ दिखाती इमेज

उपयोगी नहीं

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

टेक्स्ट को अंग्रेजी (Good morning) से फ्रेंच (Bonjour) में अनुवाद दिखाती इमेज.

Python में Natural Language Processing (NLP)

स्टॉप वर्ड्स एक्सेस करना

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']
Python में Natural Language Processing (NLP)

स्टॉप वर्ड्स हटाना

from nltk.tokenize import word_tokenize

text = "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', '.']
Python में Natural Language Processing (NLP)

विराम-चिह्न

  • इंसानों के लिए भाषा की संरचना
  • कई NLP टास्क में सार्थक सूचना नहीं देते

विराम-चिह्न और विशेष कैरेक्टर दिखाती इमेज.

Python में Natural Language Processing (NLP)

विराम-चिह्न हटाना

उपयोगी

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

प्रोसेसिंग की ज़रूरत वाले कई फाइल और डॉक्यूमेंट दिखाती इमेज.

Python में Natural Language Processing (NLP)

विराम-चिह्न हटाना

उपयोगी

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

প্রोसेসিং की ज़रूरत वाले कई फाइल और डॉक्यूमेंट दिखाती इमेज.

उपयोगी नहीं

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

किताबों का ढेर और उनसे बनी समरी डॉक्यूमेंट दिखाती इमेज.

Python में Natural Language Processing (NLP)

विराम-चिह्न एक्सेस व हटाना

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)

अभ्यास करते हैं!

Python में Natural Language Processing (NLP)

Preparing Video For Download...