Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 79 |
|
| 80 |
-
:param articles: A list of dictionaries representing
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 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
|