GaurangPohankar /
Sentiment-Analysis-Textblob
open your cmd and go enter following command : 'pip3 install textblob' It will install textblob which python's native tex analysis library . now run the Analysistext.py , It is simple python file demonstrating the various uses of the library . Now for the important parti have created Improving_model which will improve your sentiment analysis data. Please study the Improving_model.py , We are training the data first and then we are classifying. I also gave you an example how to classify data into training data. step1 : Create an rest api i.e. you can fetch data from URL. Even if the site is built in wordpress you can create an URL where you can fetch the data from database. step2 : Now contain that data into single variable or array. run that array through the classifier creater i.e training data creater example . step3 : now put that data into POST URL where you can upload the data . I have given the working example of the above steps in example.py. Please run the example.py to see the model working . in the following logic textblob determines if the polarity of sentence is negative , positive, neutral . Polarity varies from -1.0 to 1.0 . But not every sentence is filled with hate so you can manage it properly . That means if a sentence's polarity is greater than the 0.7 it means It contains stong postive message and if sentence's polarity is 0.1 thus it is positive but 'poor positive' vice versa for the negaive. for s in blob.sentences: if s.sentiment.polarity > 0 : train[s] = 'Positive' elif s.sentiment.polarity < 0 : train[s] = 'Negative' else: train[s] = 'Neutral' Thanks . Please check this link for UPLOAD AND GET data. https://www.geeksforgeeks.org/get-post-requests-using-python/
36/100 health