Description
A pre-trained pipeline to analyze sentiment in tweets and classify them into ‘positive’ and ‘negative’ classes using Universal Sentence Encoder
embeddings
Live Demo Open in Colab Download Copy S3 URI
How to use
from sparknlp.pretrained import PretrainedPipeline
pipeline = PretrainedPipeline("analyze_sentimentdl_use_twitter", lang = "en")
result = pipeline.fullAnnotate(["im meeting up with one of my besties tonight! Cant wait!! - GIRL TALK!!", "is upset that he can't update his Facebook by texting it... and might cry as a result School today also. Blah!"])
import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline
val pipeline = new PretrainedPipeline("analyze_sentimentdl_use_twitter", lang = "en")
val result = pipeline.fullAnnotate("im meeting up with one of my besties tonight! Cant wait!! - GIRL TALK!!", "is upset that he can't update his Facebook by texting it... and might cry as a result School today also. Blah!")
import nlu
text = ["""im meeting up with one of my besties tonight! Cant wait!! - GIRL TALK!!", "is upset that he can't update his Facebook by texting it... and might cry as a result School today also. Blah!"""]
sentiment_df = nlu.load('en.sentiment.twitter.use').predict(text)
sentiment_df
Results
| | document | sentiment |
|---:|:---------------------------------------------------------------------------------------------------------------- |:------------|
| 0 | im meeting up with one of my besties tonight! Cant wait!! - GIRL TALK!! | positive |
| 1 | is upset that he can't update his Facebook by texting it... and might cry as a result School today also. Blah! | negative |
Model Information
Model Name: | analyze_sentimentdl_use_twitter |
Type: | pipeline |
Compatibility: | Spark NLP 2.7.1+ |
Edition: | Official |
Language: | en |
Included Models
tfhub_use
, sentimentdl_use_twitter