Hi Dears,
See the code
This code helps to replace a text using another one in Python.
This is applied in sentiments analysis. So that the emoticons can be replaced by its sentiments.
This is used in the data mining part of the sentiments analysis using Python.
--------------------------
See the code
This code helps to replace a text using another one in Python.
This is applied in sentiments analysis. So that the emoticons can be replaced by its sentiments.
This is used in the data mining part of the sentiments analysis using Python.
--------------------------
from nltk import NaiveBayesClassifier as nbc
from nltk.tokenize import word_tokenize
from itertools import chain
import csv
sentence="it is #abcd1212 and #12341212"
with open('emoticon.csv','r') as csvinput:
reader=csv.reader(csvinput,delimiter=",")
rownum = 0
training_data = []
for code,tag in reader:
sentence=sentence.replace(code,tag)
print(sentence)
------------------------------------
Output : it is positive and negativve
------------------------------------
emoticon.csv
#abcd1212,positive
#12341212,negative
#121212aa,positive
No comments:
Post a Comment