Lux.Prisms.SentimentAnalysisPrism (Lux v0.5.0)
View SourceA prism that performs sentiment analysis on text using Python's NLTK library.
This prism uses NLTK's VADER (Valence Aware Dictionary and sEntiment Reasoner) sentiment analyzer, which is specifically attuned to sentiments expressed in social media. It's able to handle:
- Conventional text
- Slang and abbreviations
- Emojis and emoticons
- Emphasis through capitalization and punctuation
Examples
iex> Lux.Prisms.SentimentAnalysisPrism.run(%{
...> text: "Great product, I love it!",
...> language: "en"
...> })
{:ok, %{
sentiment: "positive",
confidence: 0.8402,
details: %{
"pos" => 0.814,
"neg" => 0.0,
"neu" => 0.186,
"compound" => 0.8402
}
}}