mood.sentiment¶
Sentiment analysis tools
Functions
|
Analyzes the sentiment of the input text using Flair's pre-trained sentiment model. |
|
Score the sentiment of financial-news headlines. |
- mood.sentiment.flair_sentiment_score(text, model='en-sentiment')[source]¶
Analyzes the sentiment of the input text using Flair’s pre-trained sentiment model.
This function returns a sentiment score as a float:
Positive sentiment is returned as a positive value.
Negative sentiment is returned as a negative value.
Example
Input: “I absolutely love this product!” Output: 0.99 (approximately, for a strong positive sentiment)
- mood.sentiment.sentiment_analysis(headlines, *, analyze=None)[source]¶
Score the sentiment of financial-news headlines.
headlinesis a single string or an iterable of headline strings. Returns a{headline: score}mapping where each score is an integer in[-9, 9].analyzeis an injectableheadlines_str -> dictcallable; when omitted it is built lazily onaix(so importing this module stays offline).