Sentiment Analysis
SentimentAnalysisFilter
Source code in engines/contentFilterEngine/other_approaches/sentiment_analysis.py
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
__init__(threshold=0.1)
Initializes the SentimentAnalysisFilter.
- threshold (float): The sentiment polarity threshold to trigger actions. Positive values can indicate positive sentiment, negative values indicate negative sentiment.
Source code in engines/contentFilterEngine/other_approaches/sentiment_analysis.py
4 5 6 7 8 9 10 11 12 13 |
|
analyze_sentiment(content)
Analyzes the sentiment of the given content.
Parameters: - content (str): The content to analyze.
Returns: - float: The sentiment polarity score ranging from -1.0 to 1.0.
Source code in engines/contentFilterEngine/other_approaches/sentiment_analysis.py
15 16 17 18 19 20 21 22 23 24 25 26 |
|
filter_content(content)
Filters the content based on its sentiment.
Parameters: - content (str): The content to be filtered.
Returns: - dict: A dictionary with 'status' and 'sentiment_score'.
Source code in engines/contentFilterEngine/other_approaches/sentiment_analysis.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|