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(file: str, model: str = _model_name, lm: bool=False, device: str=None)
- file: path of sound file
- model: The ASR model
- lm: Use language model (except airesearch/wav2vec2-large-xlsr-53-th model)
- device: device
- 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
Hashes for pythaiasr-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f4e22f43a707c099d7239be8bac63cecf23dc19b24fb63905b75894d9bd3457 |
|
MD5 | 31c5abcc16f4cfd02c7d8ec9d6b8f767 |
|
BLAKE2b-256 | 423bab9da723dd4c757df28c01b5e391544499171691293e13d2cfc69e601e20 |