zerito commited on
Commit
90b5dca
·
verified ·
1 Parent(s): 845a283

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -75,17 +75,13 @@ def fetch_btc_news() -> List[Dict[str, str]]:
75
  @tool
76
  def analyze_btc_news(articles: List[Dict[str, str]]) -> Dict[str, Any]:
77
  """
78
- Analyzes the sentiment of Bitcoin news articles using TextBlob.
79
 
80
- :param articles: A list of dictionaries representing Bitcoin news articles.
81
- Each dictionary must include the following keys:
82
- - 'title': The title of the article.
83
- - 'url': The URL of the article.
84
- :return: A dictionary containing:
85
- - 'sentiment_score': The average sentiment polarity of the article titles.
86
- - 'sentiment_label': A label ("Positive 😊", "Negative 😡", or "Neutral 😐")
87
- based on the sentiment score.
88
- - 'keywords': A list of keywords extracted from the article titles.
89
  """
90
  sentiments = [TextBlob(article["title"]).sentiment.polarity for article in articles]
91
  avg_sentiment = np.mean(sentiments) if sentiments else 0
 
75
  @tool
76
  def analyze_btc_news(articles: List[Dict[str, str]]) -> Dict[str, Any]:
77
  """
78
+ Analyzes the sentiment of Bitcoin news articles.
79
 
80
+ :param articles: A list of dictionaries, each with keys 'title' and 'url' representing a news article.
81
+ :return: A dictionary with the sentiment analysis results, including:
82
+ - 'sentiment_score': The average sentiment polarity.
83
+ - 'sentiment_label': A label ("Positive 😊", "Negative 😡", or "Neutral 😐") based on the score.
84
+ - 'keywords': A list of keywords extracted from the titles.
 
 
 
 
85
  """
86
  sentiments = [TextBlob(article["title"]).sentiment.polarity for article in articles]
87
  avg_sentiment = np.mean(sentiments) if sentiments else 0