ct-transformer punctuation model for fasr
Project description
fasr-punc-ct-transformer
英文文档地址: README_EN.md
CT-Transformer 标点恢复插件。通常作为 ASR 后面的 sentencizer 阶段,把无标点识别文本切成带标点的 AudioSpan 句子。
安装
pip install fasr-punc-ct-transformer
注册模型
| 注册名 | 类 | 适用场景 |
|---|---|---|
ct_transformer |
CTTransformerForPunc |
中文和中英混合标点恢复 |
默认 checkpoint 是 iic/punc_ct-transformer_zh-cn-common-vocab272727-pytorch。
流水线使用
from fasr import AudioPipeline
pipeline = (
AudioPipeline()
.add_pipe("detector", model="fsmn")
.add_pipe("recognizer", model="paraformer")
.add_pipe(
"sentencizer",
model="ct_transformer",
disable_log=True,
disable_pbar=True,
)
)
Confection 配置
[punc_model]
@punc_models = "ct_transformer"
disable_update = true
disable_log = true
disable_pbar = true
放在流水线里:
[pipeline]
@pipelines = "AudioPipeline.v1"
pipe_order = ["sentencizer"]
[pipeline.pipes]
[pipeline.pipes.sentencizer]
@pipes = "thread_pipe"
[pipeline.pipes.sentencizer.component]
@components = "sentencizer"
[pipeline.pipes.sentencizer.component.model]
@punc_models = "ct_transformer"
disable_update = true
disable_log = true
disable_pbar = true
单独使用
from fasr.config import registry
model = registry.punc_models.get("ct_transformer")()
sentences = model.restore("今天天气真好我想出去玩你觉得呢")
for sentence in sentences:
print(sentence.text)
参数
| 参数 | 类型 | 默认值 | true 时 |
false 时 |
什么时候改 |
|---|---|---|---|---|---|
disable_update |
bool |
True |
跳过 FunASR 更新检查 | 允许检查更新 | 需要稳定启动或调试更新 |
disable_log |
bool |
True |
隐藏后端日志 | 显示后端日志 | 调试加载或推理 |
disable_pbar |
bool |
True |
隐藏进度条 | 显示进度条 | 交互式脚本需要进度 |
说明
restore(text)返回AudioSpanList,不是普通字符串。- 输入应是已经识别出来的文本;该插件不做 ASR。
- 流水线中应放在
sentencizer组件上。
依赖
fasrfunasr- Python 3.10-3.12
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fasr_punc_ct_transformer-0.5.8.tar.gz.
File metadata
- Download URL: fasr_punc_ct_transformer-0.5.8.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d000291d22ad66f9efc96eb555fcaa49588815163b86f38487ec910616a2c57b
|
|
| MD5 |
34e12a6479f2d2b59d0eb9f792c08b1e
|
|
| BLAKE2b-256 |
a0c77df5fca6e55242d469cb138c39d9f36eaac7361124a3e5bef72d3382a102
|
File details
Details for the file fasr_punc_ct_transformer-0.5.8-py3-none-any.whl.
File metadata
- Download URL: fasr_punc_ct_transformer-0.5.8-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8616fe62b14ef2fcacde684ba4b57a9d37941f932c92f256d474c603c4bc1f03
|
|
| MD5 |
7e0759b18f665f3c4bcbe958807a9d8f
|
|
| BLAKE2b-256 |
ce1017b95d1268e3d57ac291126e729849b02fc69e084381f4da6280f7e4575a
|