src.sentiment_analysis package

Submodules

src.sentiment_analysis.classify module

src.sentiment_analysis.classify.classify_sentiments(texts: List[str]) Dict[str, List[Tuple[str, float]]][source]

Classify the sentiment of multiple texts.

Parameters:

texts (List[str]) – List of text to classify sentiment for.

Returns:

Dictionary with three keys: ‘positive’, ‘negative’, ‘neutral’.

Each key maps to a list of tuples, where the first element of the tuple is the text and the second element is the sentiment score.

Return type:

Dict[str, List[Tuple[str, float]]]

src.sentiment_analysis.sentiment_model module

src.sentiment_analysis.sentiment_model.analyze_sentiments(article_ids: List[str]) List[Dict[str, float]][source]

Analyze the sentiment of a list of article IDs.

Parameters:

article_ids (List[str]) – List of article IDs to analyze.

Returns:

List of sentiment analysis results for each text.

Return type:

List[Dict[str, float]]

src.sentiment_analysis.wordcloud module

src.sentiment_analysis.wordcloud.generate_wordcloud(keywords: List[str], sentiment_label: str) WordCloud[source]

Generates a word cloud for the given list of keywords and sentiment label.

Parameters:
  • keywords (List[str]) – List of keywords to include in the word cloud.

  • sentiment_label (str) – Sentiment label to generate the word cloud for.

Returns:

The generated word cloud.

Return type:

WordCloud

Module contents