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.19.tar.gz
(25.5 kB
view details)
Built Distributions
asrp-0.0.19-py3.7.egg
(47.9 kB
view details)
asrp-0.0.19-py3-none-any.whl
(24.5 kB
view details)
File details
Details for the file asrp-0.0.19.tar.gz
.
File metadata
- Download URL: asrp-0.0.19.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 | 80d101da729614e16f0fa2ef629cd7a3fa7357c5257dbdd4f7a838774692ae1c |
|
MD5 | c30a01bc7916974ebaf754eadbba0002 |
|
BLAKE2b-256 | 9b45036918845332b4c7be228ff5959f8efea3d44a5f793b4389d5dca2b404ed |
File details
Details for the file asrp-0.0.19-py3.7.egg
.
File metadata
- Download URL: asrp-0.0.19-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 | e23c22e37f6ca57ed90eac45255b3998aaae9e5360c7ab9971b47a23d7a89e42 |
|
MD5 | 2e789f569795dac48d8edf6b03a61eb1 |
|
BLAKE2b-256 | 2246812975d05b9222bb4760c029309f86154b8bd297a241971253500889c3c6 |
File details
Details for the file asrp-0.0.19-py3-none-any.whl
.
File metadata
- Download URL: asrp-0.0.19-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 | 63a0e848d607ec3f53e32e2e295246254ea9d701276c4054aa60fb1997256ca8 |
|
MD5 | c1834a897eb4eb68e3fd8c31f1f1ee7b |
|
BLAKE2b-256 | 769a0937ad7af103d836a9ce22b066134cf9ac0262fab064e0f1a754c0b93c98 |