← 返回
未分类

企业舆情监控SKILL

Track water and sleep with JSON file storage. This skill should be used when the user wants to: - Monitor brand/company reputation, public opinion, or sentiment - Set up automated sentiment monitoring for a company, product, or person - Create scheduled public opinion reports (daily/weekly) - Search and analyze news, social media mentions, or online discussions about a target - Receive email alerts when negative sentiment is detected - Perform sentiment classification on Chinese text using local
通用中文舆情监控系统,支持自定义品牌/公司关键词,全网搜索监控,智能情感分析,四色预警分级,自动邮件推送报告。
user_f4500486
未分类 community v1.0.0 1 版本 99637.7 Key: 无需
★ 1
Stars
📥 255
下载
💾 29
安装
1
版本
#latest

概述

Sentiment Monitor — 通用舆情监控系统

Overview

A universal Chinese public opinion monitoring system. Supports any company, brand, or person as the monitoring target. Features four-level alert system, SnowNLP local sentiment classification (zero token), LLM precision judgment for uncertain items, semantic deduplication, heat scoring, and trend tracking.

All target-specific data (keywords, recipients, etc.) is driven by a JSON config file — no hardcoding.

Quick Start

Step 1: Initialize (First Time Only)

When the user triggers this skill for the first time, collect the following information:

  1. Target name — What to monitor (e.g., "呈诺再生医学", "Apple中国", "华为")
  2. Target aliases — English names, abbreviations (e.g., ["ALLIFE", "ALLIFE MEDICINE"])
  3. Keywords — Ask user to provide keywords in 5 categories:
    • Core (核心): Main brand/company names (required, at least 1)
    • Products (产品): Product or service names (optional)
    • Tech (技术): Technical terms, patents, certifications (optional)
    • People (人物): Key people, partnerships, related companies (optional)
    • Variants (变体): Common misspellings, alternative names (optional)
  4. Email recipient — Who receives the report
  5. Schedule — Report frequency and times (default: daily 08:00, 12:00, 17:00)
  6. Platforms — Search sources (default: all platforms)
  7. Data directory — Where to store history/trends data (default: sentiment_data/ under workspace)

Step 2: Generate Config File

Generate a monitor_config.json in the user's workspace using this template:

{
  "target_name": "目标名称",
  "target_aliases": ["别名1", "别名2"],
  "keywords": {
    "core": ["核心关键词1", "核心关键词2"],
    "products": [],
    "tech": [],
    "people": [],
    "variants": []
  },
  "email_to": "recipient@example.com",
  "platforms": [],
  "data_dir": "sentiment_data",
  "created_at": "2026-04-18T00:00:00"
}

Use the generate_config() function from scripts/sentiment_engine.py to create this programmatically, or write it directly.

Step 3: Install Dependencies

pip install snownlp agentmail-sdk

SnowNLP (~7.7MB) provides local Chinese sentiment classification at 280 items/sec with zero token cost. AgentMail SDK is needed only if email delivery is required.

Step 4: Create Automation

Use automation_update tool to create scheduled report tasks. Each task's prompt should follow the Report Workflow below.

Report Workflow (for Automation Prompts)

Each scheduled report execution follows this workflow. Embed this in the automation prompt:

Phase 1: Import Engine

import sys
sys.path.insert(0, r"<SKILL_SCRIPTS_DIR>")
# <SKILL_SCRIPTS_DIR> is the absolute path to this skill's scripts/ directory
# On Windows: C:\Users\<USER>\.workbuddy\skills\sentiment-monitor\scripts
from sentiment_engine import *
from report_generator import make_html_report, make_text_report

Phase 2: Load Config & History

cfg = load_config("<WORKSPACE>/monitor_config.json")
history = load_json(get_history_file(cfg), {"items": []})

Phase 3: Multi-Platform Search

Read keywords from config:

keywords = get_all_keywords(cfg)
kw_counts = get_keyword_count(cfg)

Search all keywords across web, news, and social media platforms. Structure each result as:

{
    "title": "标题",
    "summary": "摘要",
    "source": "来源平台/媒体",
    "url": "链接",
    "time": "发布时间",
}

Phase 4: Deduplicate

all_items = deduplicate_items(raw_items)

Phase 5: Sentiment Classification (Token-Saving Strategy)

Apply the three-layer classification strategy:

Layer 1 — SnowNLP Local Classification (zero token)

results, uncertain_indices = batch_snow_classify(all_items)
  • score > 0.70 → positive (confident, no LLM needed)
  • score < 0.30 → negative (confident, no LLM needed)
  • 0.30 ~ 0.70 → uncertain, needs LLM

Layer 2 — LLM Precision Judgment (only for uncertain items)

Send only items at uncertain_indices to LLM for classification. This typically covers 20-40% of total items, saving 60-80% of tokens.

Layer 3 — Alert Keyword Check (zero token, pure keyword matching)

For all items classified as negative, run assess_alert_level() to determine alert level:

  • Red: 热搜/封杀/停业/吊销/刑拘/逮捕
  • Orange: 处罚/违法/欺诈/造假/败诉/监管/调查/立案
  • Yellow: 2+ same-topic negatives or heat >= 6
  • Blue: default for other negatives

Phase 6: Heat Scoring

for i, item in enumerate(all_items):
    item["heat_score"] = calc_heat_score(item.get("source"), i // len(all_items) * 10 + 1, item.get("time"))
    item["sentiment"] = results[i]["sentiment"]
    item["alert_level"] = assess_alert_level(item, all_items)

Phase 7: Incremental Comparison

Compare with history.json to find new items. Get trend data:

trend = get_trend_summary(cfg)
since_label = time_ago_str(history.get("last_report_time"))

Phase 8: Generate Report

kw_summary = f"{kw_counts['core']}核心 + {kw_counts['total'] - kw_counts['core']}关联"
highest = get_highest_alert([i.get("alert_level") for i in new_items])

html = make_html_report(
    target_name=cfg["target_name"],
    pos_items=positive_items,
    neg_items=negative_items,
    neu_items=neutral_items,
    highest_alert=highest,
    trend_data=trend,
    summary_html=summary_html,
    run_label=get_run_label(),
    since_label=since_label,
    keyword_summary=kw_summary,
    snownlp_count=snownlp_classified_count,
    llm_count=llm_classified_count,
)

text = make_text_report(
    target_name=cfg["target_name"],
    # ... same args ...
    summary_text=summary_text,
)

Phase 9: Send Email

from report_sender import send_sentiment_report
send_sentiment_report(
    target_name=cfg["target_name"],
    run_label=get_run_label(),
    html_content=html,
    text_content=text,
    to_email=cfg["email_to"],
)

Phase 10: Update Data Files

record_trend(cfg, pos_count, neg_count, neu_count, highest, get_run_label())
# Also update history.json with new items and last_report_time

Automation Prompt Template

Copy and customize this template for each scheduled report:

执行 {target_name} 舆情监控任务({早报/午报/晚报}),按以下步骤执行:

## 0. 导入引擎
import sys; sys.path.insert(0, r"C:\Users\{USER}\.workbuddy\skills\sentiment-monitor\scripts")
from sentiment_engine import *
from report_generator import make_html_report, make_text_report

## 1. 加载配置
读取 {WORKSPACE}/monitor_config.json 和历史数据

## 2. 全网搜索({keyword_count}个关键词)
核心:{列出核心关键词}
产品:{列出产品关键词}
技术:{列出技术关键词}
关联:{列出关联关键词}
变体:{列出变体关键词}

## 3. 智能去重
使用 deduplicate_items() 去重

## 4. 情感分类(省token策略)
第一步:SnowNLP 本地初筛(零token)
第二步:仅不确定条目调 LLM 精判
第三步:预警关键词兜底(零token)

## 5. 增量对比 + 热度评分 + 预警评估

## 6. 生成 HTML+纯文本 报告

## 7. 发送邮件至 {email_to}

## 8. 更新数据文件(history.json + trends.json)

Manual Operations

Single Classification Test

from sentiment_engine import snownlp_classify
sentiment, confidence, needs_llm = snownlp_classify("文本内容")

CLI Commands

python sentiment_engine.py <config.json> keywords       # 列出关键词
python sentiment_engine.py <config.json> alerts         # 查看预警配置
python sentiment_engine.py <config.json> trends         # 查看趋势
python sentiment_engine.py <config.json> classify <文本>  # 测试分类
python sentiment_engine.py <config.json> benchmark      # 基准测试

Architecture

For detailed architecture and design decisions, read references/architecture.md.

Scripts

| File | Purpose |

|------|---------|

| scripts/sentiment_engine.py | Core engine: config, dedup, SnowNLP classification, heat score, alert level, trends |

| scripts/report_generator.py | HTML + text report generation |

| scripts/report_sender.py | Email delivery via AgentMail |

Dependencies

| Package | Size | Purpose | Required |

|---------|------|---------|----------|

| snownlp | ~7.7MB | Local Chinese sentiment classification | Yes |

| agentmail-sdk | ~1MB | Email delivery | Only if sending reports |

版本历史

共 1 个版本

  • v1.0.0 ### 核心特性 - **全网监控**:支持百度、新闻站点等多渠道信息采集 - **智能去重**:基于内容指纹的语义去重,避免重复信息干扰 - **双层情感分析**:SnowNLP 本地初筛(省 60-80% Token)+ LLM 精判不确定条目 - **四色预警体系**: - 🔴 红色:严重负面(危机级) - 🟠 橙色:中度负面(关注级) - 🟡 黄色:轻度负面/中性偏负(提醒级) - 🟢 绿色:正面/中性(正常级) - **热度算法**:综合来源权重、情感强度、时效性计算文章热度 - **趋势追踪**:对比历史数据,识别舆情走势变化 - **自动报告**:支持早报/午报/晚报定时推送,HTML + 纯文本双格式 ### 适用场景 - 企业品牌声誉监控 - 产品口碑追踪 - 竞品动态监测 - 行业舆情预警 - 危机公关响应 当前
    2026-04-18 08:52 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,225 📥 267,693
ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,079 📥 808,926
ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,376 📥 320,235