AlphaEar Sentiment Skill
Overview
This skill provides sentiment analysis capabilities tailored for financial texts, supporting both FinBERT (local model) and LLM-based analysis modes.
Capabilities
Capabilities
1. Analyze Sentiment (FinBERT / Local)
Use scripts/sentiment_tools.py for high-speed, local sentiment analysis using FinBERT.
Key Methods:
- -
analyze_sentiment(text): Get sentiment score and label using localized FinBERT model.
-
Returns:
{'score': float, 'label': str, 'reason': str}.
-
Score Range: -1.0 (Negative) to 1.0 (Positive).
- -
batch_update_news_sentiment(source, limit): Batch process unanalyzed news in the database (FinBERT only).
2. Analyze Sentiment (LLM / Agentic)
For higher accuracy or reasoning capabilities, YOU (the Agent) should perform the analysis using the Prompt below, calling the LLM directly, and then update the database if necessary.
Sentiment Analysis Prompt
Use this prompt to analyze financial texts if the local tool is insufficient or if reasoning is required.
CODEBLOCK0
Scoring Guide:
- - Positive (0.1 to 1.0): Optimistic news, profit growth, policy support, etc.
- Negative (-1.0 to -0.1): Losses, sanctions, price drops, pessimism.
- Neutral (-0.1 to 0.1): Factual reporting, sideways movement, ambiguous impact.
Helper Methods
- -
update_single_news_sentiment(id, score, reason): Use this to save your manual analysis to the database.
Dependencies
- -
torch (for FinBERT) - INLINECODE6 (for FinBERT)
- INLINECODE7 (built-in)
Ensure DatabaseManager is initialized correctly.
AlphaEar 情感分析技能
概述
本技能提供针对金融文本的情感分析能力,支持 FinBERT(本地模型)和基于 LLM 的分析模式。
功能
1. 情感分析(FinBERT / 本地模式)
使用 scripts/sentiment_tools.py 通过 FinBERT 进行高速本地情感分析。
关键方法:
- - analyze_sentiment(text):使用本地 FinBERT 模型获取情感分数和标签。
-
返回:{score: float, label: str, reason: str}。
-
分数范围:-1.0(负面)到 1.0(正面)。
- - batchupdatenews_sentiment(source, limit):批量处理数据库中未分析的新闻(仅限 FinBERT)。
2. 情感分析(LLM / 代理模式)
如需更高精度或推理能力,您(代理) 应使用以下提示直接调用 LLM 进行分析,并在必要时更新数据库。
情感分析提示
如果本地工具不足或需要推理,请使用此提示分析金融文本。
markdown
请分析以下金融/新闻文本的情绪极性。
返回严格的 JSON 格式:
{score: , label: , reason: <简短理由>}
文本: {text}
评分指南:
- - 正面(0.1 到 1.0):乐观新闻、利润增长、政策支持等。
- 负面(-1.0 到 -0.1):亏损、制裁、价格下跌、悲观情绪。
- 中性(-0.1 到 0.1):事实报道、横盘走势、影响模糊。
辅助方法
- - updatesinglenews_sentiment(id, score, reason):使用此方法将您的手动分析结果保存到数据库。
依赖项
- - torch(用于 FinBERT)
- transformers(用于 FinBERT)
- sqlite3(内置)
确保 DatabaseManager 已正确初始化。