Skip to content

Vishnunkumar/eng_spacysentiment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eng_spacysentiment

Sentiment analysis of simple english sentences using spaCy pipelines

Implementation

Method - 1

  • Install the package using below command
pip install eng-spacysentiment
  • PyPi

  • Implement the below code to get sentiment using spacy

import eng_spacysentiment
nlp = eng_spacysentiment.load()
text = "Welcome to Arsenal's official YouTube channel Watch as we take you closer and show you the personality of the club."
doc = nlp(text)
doc.cats
  • Result
input_text =  Its completely useless mate, we can do it the way we want
docs.cats = {'positive': 0.29878824949264526, 'negative': 0.7012117505073547}
  • Benchmarks

The following metrics are generated from 300 randomly selected tagged sentences from Emotion dataset, kindly take note that happy has been mapped as positive, while sad and angry has been mapped as negative.

MODEL F1-score
SpacySentiment 0.65
VaderSentiment 0.68
TextBlob 0.70

Method - 2

  • Clone the repository to your local
cd spacysentiment/
unzip spacysentiment.zip
  • Implement the below code to get sentiment using spacy
import eng
nlp = spacy.load("spacysentiment")
input_text = input()
doc = nlp(input_text)
doc.cats
  • Result
input_text =  Its completely useless mate, we can do it the way we want
docs.cats = {'positive': 0.29878824949264526, 'negative': 0.7012117505073547}
  • Data Source - UCI sentiment labelled sentences data, I used imbd part of data to train the model

  • Training : To train your own model please refer to notebook

About

sentiment analysis using spacy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published