把口语变书面:runonweb 用 S1-mini 在浏览器本地清理语音转录,自动去口水词加标点

原创2026-11-02 20:26:46293 阅读

把口语变书面:runonweb 用 S1-mini 在浏览器本地清理语音转录,自动去口水词加标点

runonweb 是一个让 AI 模型直接在浏览器里本地运行的 SDK,无需 API Key、无需后端。它的 clean 模块(Transcript Clean,语音转录清理)基于 Superwhisper 的 S1-mini 模型,能把 Whisper 等语音转文字(STT)产生的粗糙转录文本,一键变成干净的书面语:去掉 "um"、"uh"、"like" 等口水词、消除自我更正、自动补标点,还会把 "twenty three dollars" 这样的口述数字写成 "23"。整个过程只发生在浏览器标签页内,语音和文字不出本机,隐私无忧。

浏览器本地语音转录清理的运行场景:日常街头随手口述记录,文本不离开本机

转录文本"口语味"重,到底重在哪?

语音转文字工具(如 runonweb 的 Scribe 模块,基于 Whisper tiny.en)转出来的文本,往往带着浓重的"说话味":

  • 口水词:um、uh、like、so…
  • 自我更正:"by friday no wait make that thursday"(先说错又改口)
  • 没有标点和大小写,一整段糊在一起
  • 数字是文字:"twenty three thousand four hundred and fifty dollars"

手动清理一份 30 分钟的会议纪要非常痛苦。clean 模块就是为这一步而生的:把"口语"改写成"书面语"。

S1-mini:只干一件事的小模型

clean 模块使用的默认模型是 onnx-community/s1-mini-ONNX:

项目 说明
模型 S1-mini by Superwhisper(Qwen3-0.6B 微调)
用途 专门做英文 STT 转录文本的规范化,不是聊天模型
体积 约 365 MB(q4f16 / WebGPU),回退约 413 MB(q4),WASM 用 q4
缓存 首次下载后浏览器自动缓存,第二次直接秒开

模型加载走 WebGPU 快速通道,没有 WebGPU 的环境会自动回退到 WASM,代码里对这条回退链做了完整的容错处理(见 clean/index.ts 的 load 方法)。

3 行代码完成口语转书面

安装 runonweb 后,用一次性的 clean 函数即可:

import { clean } from 'runonweb/clean'

const { text } = await clean(
  'so um i need to like send the report by uh friday no wait make that thursday',
  { styling: 'semi-formal', structure: 'prose', context: 'general' }
)
// "I need to send the report by Thursday."

需要反复处理多段文本时,用 TranscriptCleaner 类复用模型实例,配合 onPartial 还能拿到逐字流式输出,体验像打字一样实时刷新(实现见 TranscriptCleaner):

import { TranscriptCleaner } from 'runonweb/clean'

const cleaner = new TranscriptCleaner()
await cleaner.load()

const { text } = await cleaner.clean(rawTranscript, {
  onPartial: (partial) => console.log(partial), // 增量输出
})
cleaner.dispose()

典型工作流:先用 stt 模块 把音频转成文字,再把粗糙转录丢给 clean 收尾,两步全部在浏览器本地完成。

3 个风格开关:styling / structure / context

clean 提供三个参数控制输出风格(定义见 STYLING / STRUCTURE / CONTEXT):

参数 可选值 默认 效果
styling casual / semi-casual / semi-formal / formal semi-formal 控制书面语正式程度
structure prose / lists prose 出现 3 项及以上清单时,lists 会输出 Markdown 列表
context general / email general email 会补上称呼、正文、落款的邮件结构

官方演示页内置了 6 个可直接点选的示例,覆盖了上面这些场景(示例数据在 models.ts):

场景 输入(原始转录) 清理效果
自我更正 so um i need to like send the the report by uh friday no wait make that thursday I need to send the report by Thursday.
数字 the invoice came to twenty three thousand four hundred and fifty dollars… 数字写成 23,450 这样的书面形式
会议时间 let's meet at half past two tomorrow uh actually make it three fifteen p m 去掉改口,输出明确时间
邮件(context: email) hey sarah just wanted to follow up on the proposal… 补上邮件格式结构
打包清单(structure: lists) so for the trip we need to pack sunscreen and then also a first aid kit… 输出 Markdown 列表

一张图感受 casual 风格的"留白"

下面这张图对应演示页里的 Casual 示例:输入 "hmm im gonna be late theres a cute dog outside i cant just walk past him" 时,选 styling: 'casual' 输出就会保留轻松的口吻,只去口水词、补标点;换成 formal 则会更书面化。

casual 风格清理示例:沙发上打盹的猫,对应"看到可爱小狗走不动路"的轻松口语场景

性能表现:本地也要快

模型页给出的基准数据(WebGPU 推荐):

  • WebGPU:约 1–2 秒 / 句
  • WASM:约 6–10 秒 / 句

演示页脚本会在运行后显示实际耗时(见 scripts/models/clean.ts),首次加载约 365 MB 模型后会被浏览器缓存,后续打开几乎无感。

使用注意事项

  1. 仅支持英文:S1-mini 专门针对英文 ASR 输出微调;
  2. 控制单次长度:单次输入建议保持在 1000 tokens 以内,更长的转录请按句子边界分段处理;
  3. 纯口水词输入返回空字符串:输入只有 "um, uh…" 时结果为空,这是正常行为而不是报错;
  4. 许可协议:模型为 Apache-2.0 外加一条命名条款——产品中使用它时必须继续称其为 "S1-mini" by "Superwhisper"(见 MODELS.md)。

相关文件

一句话总结:如果你有"语音转文字后还要人工润色"的痛点,runonweb 的 clean 模块能在浏览器里用 S1-mini 把它自动化,且全程数据本地化,是隐私敏感场景下做会议记录、口述备忘的实用选择。

登录后查看全文
runonweb.ai