调用 GLM-ASR-2512 完成比赛语音识别,支持热词传入,输出全时轴 ASR 结果与事件线索。当用户提到"语音识别"、"音频转文字"、"比赛解说识别"、"ASR"、"提取解说词"时,触发此 Skill。
调用智谱 GLM-ASR-2512 对比赛视频/音频进行全时轴语音识别,输出带时间戳的转录结果与事件线索,作为下游分析的证据数据。
configs/env.local.yaml、configs/model_profiles.yaml、configs/secrets.local.yaml 均已就绪skill.py CLI必须参数:
--input 视频或音频文件路径(支持 mp4/mov/mp3/wav/m4a/flac)
可选参数:
--hotwords 热词列表,逗号分隔(球队名、球员名、方言别名)
--hotwords-file 热词文件路径(每行一个热词)
--correction-rules 语义纠错规则文件(YAML,仅做保守纠正)
--segment-ms 分段长度(毫秒),默认 55000(55秒,低于GLM单次上限60s)
--overlap-ms 分段重叠(毫秒),默认 1000
--output 输出文件路径(.json 或 .jsonl),默认 stdout
--config env 配置文件路径,默认 configs/env.local.yaml
--format 输出格式 json|jsonl,默认 json
若用户未提供热词,正常运行并告知用户可通过 提升准确率。
--hotwordspython skill.py \
--input /path/to/match_audio.mp3 \
--hotwords "申花,海港,武磊,奥斯卡,沪语" \
--output /mnt/user-data/outputs/asr_result.json \
--format json
脚本流程:
ffmpeg 提取音频(若输入为视频)并转为 WAV 16kHz mono--segment-ms 分段,相邻段有 --overlap-ms 重叠normalized_transcriptkeywords_hit 与 event_hintschemas/output.schema.json 校验分析完成后展示:
event_hint 非空的片段,按时间排序每条识别结果遵循以下结构:
{
"evidence_id": "asr-20250601T103000Z-0001",
"media_id": "goal-5min.mp4",
"start_ms": 0,
"end_ms": 55000,
"transcript": "武磊在左路突破,传中,奥斯卡!进球!",
"normalized_transcript": "武磊在左路突破,传中,奥斯卡!进球!",
"keywords_hit": ["武磊", "奥斯卡"],
"event_hint": "goal_candidate",
"confidence": 0.94,
"model_name": "glm-asr-2512",
"source_ref": "goal-5min.mp4#0-55000"
}
| 值 | 触发条件(关键词示例) |
|---|---|
goal_candidate | 进球、破门、得分、世界波 |
card_candidate | 红牌、黄牌、出示、罚下 |
penalty_candidate | 点球、点球点、12码 |
var_candidate | VAR、视频裁判、回看 |
substitution_candidate | 换人、替换、下场、上场 |
foul_candidate | 犯规、任意球、吹罚 |
none | 无明显事件关键词 |
model_profiles_file: configs/model_profiles.yaml
secrets_file: configs/secrets.local.yaml