Python Thai ASR
Project description
PyThaiASR
Python Thai Automatic Speech Recognition
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
Google Colab: Link Google colab
Model homepage: https://huggingface.co/airesearch/wav2vec2-large-xlsr-53-th
Install
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.
pip install pythaiasr[lm]
pip install https://github.com/kpu/kenlm/archive/refs/heads/master.zip
Usage
from pythaiasr import asr
file = "a.wav"
print(asr(file))
API
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
- annaphong/wav2vec2-large-xlsr-53-th-cv8-newmm - Thai Wav2Vec2 with CommonVoice V8 (newmm tokenizer) + language model
- wannaphong/wav2vec2-large-xlsr-53-th-cv8-deepcut - Thai Wav2Vec2 with CommonVoice V8 (deepcut tokenizer) + language model
Docker
To use this inside of Docker do the following:
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.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file pythaiasr-1.3.0.tar.gz
.
File metadata
- Download URL: pythaiasr-1.3.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7194869ce679292177870d8e18b0b0eb8eb459728e10ba23194537d4a839d2b4 |
|
MD5 | 5e45c66c6fb7e7f88e41eb2b22eec4cb |
|
BLAKE2b-256 | 50789a19b6c30b4a252ed975d29be268b5f69517c407df81d26f157148a4dbc3 |
File details
Details for the file pythaiasr-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: pythaiasr-1.3.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 650388625249972b7f33225a06d95c1c34d451efe5ab93a909f7b6e6dc680e36 |
|
MD5 | c9acb35dbbb68d10c8a3434216d2d5ef |
|
BLAKE2b-256 | 401a98d247c0793e79be580277a30c5c40edaff77bde738ffca739d5d120f273 |