No project description provided
Project description
asrp
ASR text preprocessing utility
install
pip install asrp
usage - preprocess
input: dictionary, with key sentence
output: preprocessed result, inplace handling.
import asrp
batch_data = {
'sentence': "I'm fine, thanks."
}
asrp.fun_en(batch_data)
dynamic loading
import asrp
batch_data = {
'sentence': "I'm fine, thanks."
}
preprocessor = getattr(asrp, 'fun_en')
preprocessor(batch_data)
usage - evaluation
import asrp
targets = ['HuggingFace is great!', 'Love Transformers!', 'Let\'s wav2vec!']
preds = ['HuggingFace is awesome!', 'Transformers is powerful.', 'Let\'s finetune wav2vec!']
print("chunk size WER: {:2f}".format(100 * asrp.chunked_wer(targets, preds, chunk_size=None)))
print("chunk size CER: {:2f}".format(100 * asrp.chunked_cer(targets, preds, chunk_size=None)))
usage - hubertcode
import asrp
hc = asrp.HubertCode("facebook/hubert-large-ll60k", './km_feat_100_layer_20', 20)
hc('voice file path')
usage - code2speech
import asrp
code = [] # discrete unit
# download tts checkpoint and waveglow_checkpint from https://github.com/pytorch/fairseq/tree/main/examples/textless_nlp/gslm/unit2speech
cs = asrp.Code2Speech(tts_checkpoint='./tts_checkpoint_best.pt', waveglow_checkpint='waveglow_256channels_new.pt')
cs(code)
# play on notebook
import IPython.display as ipd
ipd.Audio(data=cs(code), autoplay=False, rate=cs.sample_rate)
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
asrp-0.0.20.tar.gz
(25.5 kB
view details)
Built Distributions
asrp-0.0.20-py3.7.egg
(47.9 kB
view details)
asrp-0.0.20-py3-none-any.whl
(24.5 kB
view details)
File details
Details for the file asrp-0.0.20.tar.gz
.
File metadata
- Download URL: asrp-0.0.20.tar.gz
- Upload date:
- Size: 25.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0574a7baac52abe4cf4723e6d460f267601b367d230d18ba47800067408cf3f0 |
|
MD5 | f9ce392aed56fb5c6e7539ccc13919f8 |
|
BLAKE2b-256 | 81e6b22fb84f53248722db8b7c8a0c991d75dc244d1e342cd1dc208d6253db7c |
File details
Details for the file asrp-0.0.20-py3.7.egg
.
File metadata
- Download URL: asrp-0.0.20-py3.7.egg
- Upload date:
- Size: 47.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f56df844c3ee53b85c1d59839d78aa3598f20ac905f1b2483a41b0083c9a1d5 |
|
MD5 | 13a640d16d15d71d901f6a42ed349e3e |
|
BLAKE2b-256 | 2e60658d67856b88ec55932a252796ec7fc4ad90efd0e98c907457eb3af866e2 |
File details
Details for the file asrp-0.0.20-py3-none-any.whl
.
File metadata
- Download URL: asrp-0.0.20-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 478546ceb0b958c4a4c56c33fe686e28fa84b260e271260d248e3a8562408827 |
|
MD5 | 8cac6a05866cad3f04a7488607646d78 |
|
BLAKE2b-256 | 0232396fb15d79bc7b32ae03135eef1367dc35dc1e9796d1abe46869e081e055 |