Python में Sentiment Analysis
Violeta Misheva
Data Scientist
# जाँचता है कि string केवल अक्षरों से बनी है
my_string.isalpha()
# जाँचता है कि string केवल digits से बनी है
my_string.isdigit()
# जाँचता है कि string केवल alphanumeric characters से बनी है
my_string.isalnum()
# मूल शब्द tokenization
word_tokens = [word_tokenize(review) for review in reviews.review]
# केवल अक्षरों वाले tokens रखें
cleaned_tokens = [[word for word in item if word.isalpha()] for item in word_tokens]
len(word_tokens[0])
87
len(cleaned_tokens[0])
78
import re
my_string = '#Wonderfulday'
# # के बाद कोई भी अक्षर, छोटा या बड़ा, निकाले
x = re.search('#[A-Za-z]', my_string)
x
<re.Match object; span=(0, 2), match='#W'>
# CountVectorizer में डिफ़ॉल्ट token pattern
'\b\w\w+\b'
# कोई विशेष token pattern निर्धारित करें
CountVectorizer(token_pattern=r'\b[^\d\W][^\d\W]+\b')
Python में Sentiment Analysis