compare_periods
Analyze news data trends by comparing two time periods to identify topic shifts, platform activity changes, and overall news volume differences.
Instructions
时期对比分析 - 比较两个时间段的新闻数据
对比不同时期的热点话题、平台活跃度、新闻数量等维度。
使用场景:
对比本周和上周的热点变化
分析某个话题在两个时期的热度差异
查看各平台活跃度的周期性变化
Args: period1: 第一个时间段(基准期) - {"start": "YYYY-MM-DD", "end": "YYYY-MM-DD"}: 日期范围 - "today", "yesterday", "this_week", "last_week", "this_month", "last_month": 预设值 period2: 第二个时间段(对比期,格式同 period1) topic: 可选的话题关键词(聚焦特定话题的对比) compare_type: 对比类型 - "overview": 总体概览(默认)- 新闻数量、关键词变化、TOP新闻 - "topic_shift": 话题变化分析 - 上升话题、下降话题、新出现话题 - "platform_activity": 平台活跃度对比 - 各平台新闻数量变化 platforms: 平台过滤列表,如 ['zhihu', 'weibo'] top_n: 返回 TOP N 结果,默认10
Returns: JSON格式的对比分析结果,包含: - periods: 两个时期的日期范围 - compare_type: 对比类型 - overview/topic_shift/platform_comparison: 具体对比结果(根据类型)
Examples: - compare_periods(period1="last_week", period2="this_week") # 周环比 - compare_periods(period1="last_month", period2="this_month", compare_type="topic_shift") - compare_periods( period1={"start": "2025-01-01", "end": "2025-01-07"}, period2={"start": "2025-01-08", "end": "2025-01-14"}, topic="人工智能" )
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period1 | Yes | ||
| period2 | Yes | ||
| topic | No | ||
| compare_type | No | overview | |
| platforms | No | ||
| top_n | No |