https://github.com/pythainlp/pythaiasr
Python Thai Automatic Speech Recognition
https://github.com/pythainlp/pythaiasr
asr automatic-speech-recognition hacktoberfest hacktoberfest2022 thai-language thai-nlp
Last synced: 6 months ago
JSON representation
Python Thai Automatic Speech Recognition
- Host: GitHub
- URL: https://github.com/pythainlp/pythaiasr
- Owner: PyThaiNLP
- License: apache-2.0
- Created: 2021-05-10T14:24:36.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-19T05:05:58.000Z (over 2 years ago)
- Last Synced: 2025-03-26T22:11:11.513Z (7 months ago)
- Topics: asr, automatic-speech-recognition, hacktoberfest, hacktoberfest2022, thai-language, thai-nlp
- Language: Python
- Homepage:
- Size: 178 KB
- Stars: 66
- Watchers: 5
- Forks: 13
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyThaiASR
Python Thai Automatic Speech Recognition
[](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 asrfile = "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 .
docker run docker run --entrypoint /bin/bash -it
```
You will then get access to a interactive shell environment where you can use python with all packages installed.