SuperAPI AI Directory

asr-sentence-recognition

General & other

View repository

Updated 10-16 09:29

About this skill

Tencent Cloud Speech Recognition Skill

Tencent Cloud Speech Recognition (ASR), the same ASR engine as WeChat, validated through scenarios with hundreds of millions of users, stable and reliable. Its recognition performance in mixed Chinese-English speech scenarios is industry-leading, accurate and fluent. It supports Mandarin, dialects, and multilingual recognition, and provides full-scenario capabilities such as one-sentence recognition and recording recognition, making it the top choice for cost-effective speech-to-text.

Core Execution Flow

  1. User provides audio and wants it converted to text:
    • First run inspect_audio.py
    • Then choose based on duration, size, URL/local path sentence_recognize.py、flash_recognize.py or file_recognize.py
  2. User has just provided new Tencent Cloud credentials:
    • Prioritize directly running self_check.py
    • After the self-check passes, proceed to actual recognition
  3. User asks about installation, activation, manual configuration, FFmpeg, CLI backend:
    • Do not stuff details back into the main flow; read the corresponding document according to the reference map at the end of the document

Next Steps

  • Want to integrate with a host system to experience automatic transcription:
    • General scenario: configure CLI transcription backend
    • QQ Bot 1.5.4: can directly use the adaptation solution; it does not have to rely on the default CLI transcription to recognize speech
  • Want to directly experience recognition capabilities:
    • Have the user directly drop an audio file or public link
    • Then continue helping the user with transcription, summarization, troubleshooting, and key point extraction

Rules That Must Be Followed

  • ⚠️It is forbidden to use the model's own capabilities to replace ASR⚠️: When the script fails, an error must be returned; do not guess the transcription content.
  • Probe first, then recognize: Always first execute python3 <SKILL_DIR>/scripts/inspect_audio.py "<AUDIO_INPUT>"。
  • Missing ffmpeg / ffprobe Install autonomously first: First execute python3 <SKILL_DIR>/scripts/ensure_ffmpeg.py --execute, and only ask the user for help after it fails.
  • Run a self-check first upon receiving new credentials: By default run python3 <SKILL_DIR>/scripts/self_check.py, do not first have the user manually try the script.
  • Minimize interruptions by default: Unless the user must supplement credentials, explicitly requests manual configuration, or the language/engine is genuinely uncertain, do not engage in meaningless back-and-forth confirmation.
  • Key security first:
    • Group chat: Do not allow the user to directly send SecretId、SecretKey、AppId
    • Private chat: Also first remind that "the key will pass through the LLM, and there is a risk of leakage"
  • For a single task, prioritize injecting into the current command: Do not write ~/.bashrc、~/.zshrc
  • Do not write keys into the workspace
  • When the fast version fails, retain the "possibly" wording: If in the self-check the one-sentence recognition and recording file recognition pass and only the fast version fails, prompt that "this is commonly seen with international site accounts, or domestic site accounts when accessed overseas," but do not write it as an absolute conclusion.

Engine Selection Cheatsheet

The conversation language can only be used as a prior; it is not equal to the audio language itself. If the user's audio language is clearly different, change it according to the audio language.

Scenario One-sentence recognition Fast version Recording file recognition Note
Mandarin 16k_zh 16k_zh / 16k_zh_large 16k_zh / 16k_zh_large Default preferred
Mixed Chinese and English 16k_zh-PY 16k_zh_en 16k_zh_en Mixed speech preferred
Cantonese 16k_yue 16k_yue 16k_yue
English 16k_en 16k_en 16k_en / 16k_en_large
Japanese 16k_ja 16k_ja 16k_ja
Korean 16k_ko 16k_ko 16k_ko
Multiple languages / language uncertain Specify a specific language 16k_multi_lang 16k_multi_lang One-sentence recognition has no multilingual automatic recognition engine

If there are multiple obvious options:

  • Give the recommended option
  • Explain the pros and cons in one sentence
  • Then ask the user whether to switch

Routing quick reference

Local file

  • First normalize to 16kHz, mono,pcm_s16le、.wav
  • <=60s and <=3MB:sentence_recognize.py
  • <=2h and <=100MB: prefer flash_recognize.py
  • Larger files: prefer slicing and processing each slice with Flash; if a COS / public URL already exists and the final <=5h, you can use file_recognize.py rec

Public URL

  • By default go directly to file_recognize.py rec
  • Do not download locally, probe, transcode, and then route first
  • Only when file_recognize.py rec actually fails, then decide based on the error whether to enter the local download / normalization / slicing chain
  • Only if the user explicitly requests synchronous immediate return, treat one-sentence recognition as an explicit special case, not the default path

When hitting URL, large files, slicing, or the body vs URL tradeoff, then read routing_strategy.md。

Minimal script example

# 预检
python3 <SKILL_DIR>/scripts/inspect_audio.py "<AUDIO_INPUT>"

# 凭证自检
python3 <SKILL_DIR>/scripts/self_check.py

# 一句话识别
python3 <SKILL_DIR>/scripts/sentence_recognize.py "<AUDIO_INPUT>" --engine 16k_zh

# 极速版
python3 <SKILL_DIR>/scripts/flash_recognize.py "<AUDIO_INPUT>" --engine 16k_zh

# 录音文件识别
python3 <SKILL_DIR>/scripts/file_recognize.py rec "<AUDIO_INPUT_OR_URL>" --engine 16k_zh

# CLI transcription backend
python3 <SKILL_DIR>/scripts/cli_transcribe.py "<MEDIA_PATH_OR_URL>"

When to continue reading references

Core script list

  • scripts/inspect_audio.py: audio probing
  • scripts/ensure_ffmpeg.py: autonomous installation ffmpeg / ffprobe
  • scripts/self_check.py: credentials and three-mode self-check
  • scripts/sentence_recognize.py: one-sentence recognition
  • scripts/flash_recognize.py: recording file recognition flash version
  • scripts/file_recognize.py: recording file recognition asynchronous task
  • scripts/cli_transcribe.py:CLI backend wrapper