alphaear-sentiment

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

AlphaEar Sentiment Skill

AlphaEar 情绪技能

Overview

概述

This skill provides sentiment analysis capabilities tailored for financial texts, supporting both FinBERT (local model) and LLM-based analysis modes.
本技能提供专为金融文本定制的情绪分析能力,同时支持FinBERT(本地模型)和基于LLM的分析模式。

Capabilities

功能

Capabilities

功能

1. Analyze Sentiment (FinBERT / Local)

1. 情绪分析(FinBERT / 本地)

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).
使用
scripts/sentiment_tools.py
基于FinBERT实现高速本地情绪分析。
核心方法:
  • analyze_sentiment(text)
    :使用本地化FinBERT模型获取情绪得分和标签。
    • 返回值
      {'score': float, 'label': str, 'reason': str}
    • 得分范围:-1.0(负面)到1.0(正面)。
  • batch_update_news_sentiment(source, limit)
    :批量处理数据库中未分析的新闻(仅支持FinBERT)。

2. Analyze Sentiment (LLM / Agentic)

2. 情绪分析(LLM / 智能体模式)

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.
如需更高的准确率或推理能力,你(Agent) 应使用下方的Prompt执行分析,直接调用LLM,必要时更新数据库。

Sentiment Analysis Prompt

情绪分析Prompt

Use this prompt to analyze financial texts if the local tool is insufficient or if reasoning is required.
markdown
请分析以下金融/新闻文本的情绪极性。
返回严格的 JSON 格式:
{"score": <float: -1.0到1.0>, "label": "<positive/negative/neutral>", "reason": "<简短理由>"}

文本: {text}
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.
如果本地工具能力不足或需要推理能力时,使用此Prompt分析金融文本。
markdown
请分析以下金融/新闻文本的情绪极性。
返回严格的 JSON 格式:
{"score": <float: -1.0到1.0>, "label": "<positive/negative/neutral>", "reason": "<简短理由>"}

文本: {text}
打分指南:
  • 正面(0.1 到 1.0):利好新闻、利润增长、政策支持等。
  • 负面(-1.0 到 -0.1):亏损、制裁、价格下跌、悲观预期等。
  • 中性(-0.1 到 0.1):事实报道、行情横盘、影响不明确等。

Helper Methods

辅助方法

  • update_single_news_sentiment(id, score, reason)
    : Use this to save your manual analysis to the database.
  • update_single_news_sentiment(id, score, reason)
    :使用该方法将你的手动分析结果保存到数据库。

Dependencies

依赖

  • torch
    (for FinBERT)
  • transformers
    (for FinBERT)
  • sqlite3
    (built-in)
Ensure
DatabaseManager
is initialized correctly.
  • torch
    (用于运行FinBERT)
  • transformers
    (用于运行FinBERT)
  • sqlite3
    (内置)
确保
DatabaseManager
已正确初始化。