# asr-decoder
CTC decoder with hotwords for ASR models. Supports `ctc_greedy_search` and `ctc_prefix_bream_search` decoding methods.
## Usage
- ctc greedy search
``` python
from asr_decoder import CTCDecoder
decoder = CTCDecoder()
# ctc_probs: (sequence_length, vocab_size)
result = decoder.ctc_greedy_search(ctc_probs, is_last=True)
```
- ctc prefix beam search (with hotwords)
``` python
from asr_decoder import CTCDecoder
hotwords = ["停止"]
decoder = CTCDecoder(hotwords, symbol_table, bpemodel)
# ctc_probs: (sequence_length, vocab_size)
result = decoder.ctc_prefix_beam_search(ctc_probs, beam_size=3, is_last=True)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/pengzhendong/asr-decoder",
"name": "asr-decoder",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Zhendong Peng",
"author_email": "pzd17@tsinghua.org.cn",
"download_url": "https://files.pythonhosted.org/packages/ee/f4/617295edda3f4aea9ec71fc394eaa502a79ef0748cb862f37d0465755d70/asr-decoder-0.0.6.tar.gz",
"platform": null,
"description": "# asr-decoder\n\nCTC decoder with hotwords for ASR models. Supports `ctc_greedy_search` and `ctc_prefix_bream_search` decoding methods.\n\n## Usage\n\n- ctc greedy search\n\n``` python\nfrom asr_decoder import CTCDecoder\n\ndecoder = CTCDecoder()\n# ctc_probs: (sequence_length, vocab_size)\nresult = decoder.ctc_greedy_search(ctc_probs, is_last=True)\n```\n\n- ctc prefix beam search (with hotwords)\n\n``` python\nfrom asr_decoder import CTCDecoder\n\nhotwords = [\"\u505c\u6b62\"]\ndecoder = CTCDecoder(hotwords, symbol_table, bpemodel)\n# ctc_probs: (sequence_length, vocab_size)\nresult = decoder.ctc_prefix_beam_search(ctc_probs, beam_size=3, is_last=True)\n```\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "ASR Decoder",
"version": "0.0.6",
"project_urls": {
"Homepage": "https://github.com/pengzhendong/asr-decoder"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eef4617295edda3f4aea9ec71fc394eaa502a79ef0748cb862f37d0465755d70",
"md5": "c2c67e5605993fdb3072c66457eaa14f",
"sha256": "7d295d482bfff6ea2e445dac76630973922e155c640bf43f0bc312674a6a0aca"
},
"downloads": -1,
"filename": "asr-decoder-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "c2c67e5605993fdb3072c66457eaa14f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10924,
"upload_time": "2024-10-20T14:25:49",
"upload_time_iso_8601": "2024-10-20T14:25:49.436470Z",
"url": "https://files.pythonhosted.org/packages/ee/f4/617295edda3f4aea9ec71fc394eaa502a79ef0748cb862f37d0465755d70/asr-decoder-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-20 14:25:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pengzhendong",
"github_project": "asr-decoder",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "torch",
"specs": []
}
],
"lcname": "asr-decoder"
}