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.25.tar.gz
(25.7 kB
view details)
Built Distributions
asrp-0.0.25-py3.7.egg
(48.4 kB
view details)
asrp-0.0.25-py3-none-any.whl
(24.7 kB
view details)
File details
Details for the file asrp-0.0.25.tar.gz
.
File metadata
- Download URL: asrp-0.0.25.tar.gz
- Upload date:
- Size: 25.7 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 | 84b11c1cf859165fd3873a8050c8917b73df23daa26a743a8375aaf34d1d5566 |
|
MD5 | be942bd11c8da6fb4931cfe761ea6ca9 |
|
BLAKE2b-256 | a819a5dcf1ac473f19485a270248055a282d825410b2af026f3797e59bdfffcd |
File details
Details for the file asrp-0.0.25-py3.7.egg
.
File metadata
- Download URL: asrp-0.0.25-py3.7.egg
- Upload date:
- Size: 48.4 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 | 16f6486fca905961d91f61c987497d7232d568b5337e9214af4d7df406d132c1 |
|
MD5 | d479da7a790fd9b066bd30cf2f17fbc6 |
|
BLAKE2b-256 | 07ff31ef45b472821cb2cd43695601ab401926a9a1db83fc1b6fc326aac96a38 |
File details
Details for the file asrp-0.0.25-py3-none-any.whl
.
File metadata
- Download URL: asrp-0.0.25-py3-none-any.whl
- Upload date:
- Size: 24.7 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 | a2e38381c8d33de4f93748368ac187cd64d2f319a7fa62f18be7699e5d546b58 |
|
MD5 | ebbe47c719ffc5acb110fd1934c34770 |
|
BLAKE2b-256 | c0782ffb3f5eab2c541df6890e35b76032583cee211cbd34a010b88d66ed7d5b |