Skip to main content

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


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.35.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

asrp-0.0.35-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file asrp-0.0.35.tar.gz.

File metadata

  • Download URL: asrp-0.0.35.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.9

File hashes

Hashes for asrp-0.0.35.tar.gz
Algorithm Hash digest
SHA256 ba3768185877c7bfad8782555e29f6a2b1f07b7df47fe1ff8af746c464e01328
MD5 61bd77ca7af3fed108c7ec827157e66f
BLAKE2b-256 2ce19c49544228face0a1eb536d0fcd3c809e930065f307f6918acadf4e15bf2

See more details on using hashes here.

File details

Details for the file asrp-0.0.35-py3-none-any.whl.

File metadata

  • Download URL: asrp-0.0.35-py3-none-any.whl
  • Upload date:
  • Size: 29.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.9

File hashes

Hashes for asrp-0.0.35-py3-none-any.whl
Algorithm Hash digest
SHA256 b94a4e47ada7f14499d02292e4c4cc0b3475d43aaae609407be8eeea41f9c93d
MD5 14164d759cc0b563d49916a96d24ccfd
BLAKE2b-256 6109e794959c0f068d3c65e252812d5b620188b30cb64a4fa89b53c1a2d1ed9b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page