# PyThaiASR
Python Thai Automatic Speech Recognition
<a href="https://pypi.python.org/pypi/pythaiasr"><img alt="pypi" src="https://img.shields.io/pypi/v/pythaiasr.svg"/></a><a href="https://opensource.org/licenses/Apache-2.0"><img alt="License" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"/></a><a href="https://pepy.tech/project/pythaiasr"><img alt="Download" src="https://pepy.tech/badge/pythaiasr/month"/></a>[![Coverage Status](https://coveralls.io/repos/github/PyThaiNLP/pythaiasr/badge.svg)](https://coveralls.io/github/PyThaiNLP/pythaiasr)
PyThaiASR is a Python package for Automatic Speech Recognition with focus on Thai language. It have offline thai automatic speech recognition model.
License: [Apache-2.0 License](https://github.com/PyThaiNLP/pythaiasr/blob/main/LICENSE)
Google Colab: [Link Google colab](https://colab.research.google.com/drive/1zHt3GoxXWCaNSMRzE5lrvpYm9RolcxOW?usp=sharing)
Model homepage: https://huggingface.co/airesearch/wav2vec2-large-xlsr-53-th
## Install
```sh
pip install pythaiasr
```
**For Wav2Vec2 with language model:**
if you want to use wannaphong/wav2vec2-large-xlsr-53-th-cv8-* model with language model, you needs to install by the step.
```sh
pip install pythaiasr[lm]
pip install https://github.com/kpu/kenlm/archive/refs/heads/master.zip
```
## Usage
```python
from pythaiasr import asr
file = "a.wav"
print(asr(file))
```
### API
```python
asr(data: str, model: str = _model_name, lm: bool=False, device: str=None, sampling_rate: int=16_000)
```
- data: path of sound file or numpy array of the voice
- model: The ASR model
- lm: Use language model (except *airesearch/wav2vec2-large-xlsr-53-th* model)
- device: device
- sampling_rate: The sample rate
- return: thai text from ASR
**Options for model**
- *airesearch/wav2vec2-large-xlsr-53-th* (default) - AI RESEARCH - PyThaiNLP model
- *wannaphong/wav2vec2-large-xlsr-53-th-cv8-newmm* - Thai Wav2Vec2 with CommonVoice V8 (newmm tokenizer)
- *wannaphong/wav2vec2-large-xlsr-53-th-cv8-deepcut* - Thai Wav2Vec2 with CommonVoice V8 (deepcut tokenizer)
You can read about models from the list:
- [*airesearch/wav2vec2-large-xlsr-53-th* - AI RESEARCH - PyThaiNLP model](https://medium.com/airesearch-in-th/airesearch-in-th-3c1019a99cd)
- [*annaphong/wav2vec2-large-xlsr-53-th-cv8-newmm* - Thai Wav2Vec2 with CommonVoice V8 (newmm tokenizer) + language model](https://huggingface.co/wannaphong/wav2vec2-large-xlsr-53-th-cv8-newmm)
- [*wannaphong/wav2vec2-large-xlsr-53-th-cv8-deepcut* - Thai Wav2Vec2 with CommonVoice V8 (deepcut tokenizer) + language model](https://huggingface.co/wannaphong/wav2vec2-large-xlsr-53-th-cv8-deepcut)
### Docker
To use this inside of Docker do the following:
```sh
docker build -t <Your Tag name> .
docker run docker run --entrypoint /bin/bash -it <Your Tag name>
```
You will then get access to a interactive shell environment where you can use python with all packages installed.
Raw data
{
"_id": null,
"home_page": "https://github.com/pythainlp/pythaiasr",
"name": "pythaiasr",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "asr",
"author": "Wannaphong Phatthiyaphaibun",
"author_email": "wannaphong@yahoo.com",
"download_url": "https://files.pythonhosted.org/packages/50/78/9a19b6c30b4a252ed975d29be268b5f69517c407df81d26f157148a4dbc3/pythaiasr-1.3.0.tar.gz",
"platform": null,
"description": "# PyThaiASR\n\nPython Thai Automatic Speech Recognition\n\n <a href=\"https://pypi.python.org/pypi/pythaiasr\"><img alt=\"pypi\" src=\"https://img.shields.io/pypi/v/pythaiasr.svg\"/></a><a href=\"https://opensource.org/licenses/Apache-2.0\"><img alt=\"License\" src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\"/></a><a href=\"https://pepy.tech/project/pythaiasr\"><img alt=\"Download\" src=\"https://pepy.tech/badge/pythaiasr/month\"/></a>[![Coverage Status](https://coveralls.io/repos/github/PyThaiNLP/pythaiasr/badge.svg)](https://coveralls.io/github/PyThaiNLP/pythaiasr)\n\nPyThaiASR is a Python package for Automatic Speech Recognition with focus on Thai language. It have offline thai automatic speech recognition model.\n\nLicense: [Apache-2.0 License](https://github.com/PyThaiNLP/pythaiasr/blob/main/LICENSE)\n\nGoogle Colab: [Link Google colab](https://colab.research.google.com/drive/1zHt3GoxXWCaNSMRzE5lrvpYm9RolcxOW?usp=sharing)\n\nModel homepage: https://huggingface.co/airesearch/wav2vec2-large-xlsr-53-th\n\n## Install\n\n```sh\npip install pythaiasr\n```\n\n**For Wav2Vec2 with language model:**\nif you want to use wannaphong/wav2vec2-large-xlsr-53-th-cv8-* model with language model, you needs to install by the step.\n\n```sh\npip install pythaiasr[lm]\npip install https://github.com/kpu/kenlm/archive/refs/heads/master.zip\n```\n\n## Usage\n\n```python\nfrom pythaiasr import asr\n\nfile = \"a.wav\"\nprint(asr(file))\n```\n### API\n\n```python\nasr(data: str, model: str = _model_name, lm: bool=False, device: str=None, sampling_rate: int=16_000)\n```\n\n- data: path of sound file or numpy array of the voice\n- model: The ASR model\n- lm: Use language model (except *airesearch/wav2vec2-large-xlsr-53-th* model)\n- device: device\n- sampling_rate: The sample rate\n- return: thai text from ASR\n\n**Options for model**\n- *airesearch/wav2vec2-large-xlsr-53-th* (default) - AI RESEARCH - PyThaiNLP model\n- *wannaphong/wav2vec2-large-xlsr-53-th-cv8-newmm* - Thai Wav2Vec2 with CommonVoice V8 (newmm tokenizer)\n- *wannaphong/wav2vec2-large-xlsr-53-th-cv8-deepcut* - Thai Wav2Vec2 with CommonVoice V8 (deepcut tokenizer)\n\nYou can read about models from the list:\n\n- [*airesearch/wav2vec2-large-xlsr-53-th* - AI RESEARCH - PyThaiNLP model](https://medium.com/airesearch-in-th/airesearch-in-th-3c1019a99cd)\n- [*annaphong/wav2vec2-large-xlsr-53-th-cv8-newmm* - Thai Wav2Vec2 with CommonVoice V8 (newmm tokenizer) + language model](https://huggingface.co/wannaphong/wav2vec2-large-xlsr-53-th-cv8-newmm) \n- [*wannaphong/wav2vec2-large-xlsr-53-th-cv8-deepcut* - Thai Wav2Vec2 with CommonVoice V8 (deepcut tokenizer) + language model](https://huggingface.co/wannaphong/wav2vec2-large-xlsr-53-th-cv8-deepcut)\n\n### Docker\nTo use this inside of Docker do the following:\n```sh\ndocker build -t <Your Tag name> .\ndocker run docker run --entrypoint /bin/bash -it <Your Tag name>\n```\nYou will then get access to a interactive shell environment where you can use python with all packages installed.\n\n\n",
"bugtrack_url": null,
"license": "Apache Software License 2.0",
"summary": "Python Thai ASR",
"version": "1.3.0",
"split_keywords": [
"asr"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "401a98d247c0793e79be580277a30c5c40edaff77bde738ffca739d5d120f273",
"md5": "c9acb35dbbb68d10c8a3434216d2d5ef",
"sha256": "650388625249972b7f33225a06d95c1c34d451efe5ab93a909f7b6e6dc680e36"
},
"downloads": -1,
"filename": "pythaiasr-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c9acb35dbbb68d10c8a3434216d2d5ef",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8117,
"upload_time": "2023-03-19T05:07:05",
"upload_time_iso_8601": "2023-03-19T05:07:05.078209Z",
"url": "https://files.pythonhosted.org/packages/40/1a/98d247c0793e79be580277a30c5c40edaff77bde738ffca739d5d120f273/pythaiasr-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "50789a19b6c30b4a252ed975d29be268b5f69517c407df81d26f157148a4dbc3",
"md5": "5e45c66c6fb7e7f88e41eb2b22eec4cb",
"sha256": "7194869ce679292177870d8e18b0b0eb8eb459728e10ba23194537d4a839d2b4"
},
"downloads": -1,
"filename": "pythaiasr-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "5e45c66c6fb7e7f88e41eb2b22eec4cb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3733,
"upload_time": "2023-03-19T05:07:06",
"upload_time_iso_8601": "2023-03-19T05:07:06.686078Z",
"url": "https://files.pythonhosted.org/packages/50/78/9a19b6c30b4a252ed975d29be268b5f69517c407df81d26f157148a4dbc3/pythaiasr-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-19 05:07:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "pythainlp",
"github_project": "pythaiasr",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pythaiasr"
}