Skip to main content

Package to utilize the speech to text API powered by AILabs.tw

Project description

AILabs ASR Python software development kit

PyPI PyPI - License

Development Environment

  • Python 3.9
# install portaudio first if you develop on MAC OS X
brew install portaudio

pip install --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' -r requirements_dev.txt

# please check PyAudio site: https://people.csail.mit.edu/hubert/pyaudio/
# if you encouter some issues while installing PyAudio

Installation

pip install ailabs-asr

Samples

# init the streaming client
asr_client = StreamingClient('api-key-applied-from-devconsole')

# start streaming with wav file
asr_client.start_streaming_wav(
  pipeline='asr-zh-en-std',
  file='voice.wav'
  verbose=False, # enable verbose to show detailed recognition result
  on_processing_sentence=on_processing_sentence,
  on_final_sentence=on_final_sentence)

# without file to start streaming with the computer's microphone
asr_client.start_streaming_wav(
  pipeline='asr-zh-en-std',
  on_processing_sentence=on_processing_sentence,
  on_final_sentence=on_final_sentence)

:bulb: start_streaming_wav() method allow users to provide callback function to handle the recognition result see the result format below

:bulb: lookup the available pipelines in the next section

:bulb: see more samples in the sample respository

Support Language(pipeline)

pipeline Info language
asr-zh-en-std Use it when speakers speak Chinese more than English Mandarin and English
asr-zh-tw-std Use it when speakers speak Chinese and Taiwanese. Mandarin and Taiwanese
asr-en-std English English
asr-jp-std Japanese Japanese

Message Format

There are 2 kinds of recognized result:

The Processing Sentence(Segment)

{
  "asr_sentence": "範例句子"
}

The Final Sentence(Complete Sentence)

{
  "asr_final": true,
  "asr_begin_time": 9.314,
  "asr_end_time": 11.314,
  "asr_sentence": "完整的範例句子",
  "asr_confidence": 0.5263263653207881,
  "asr_word_time_stamp": [
    {
      "word": "完整的",
      "begin_time": 9.74021875,
      "end_time": 10.100875
    },
    {
      "word": "範例句子",
      "begin_time": 10.100875,
      "end_time": 10.1664375
    }
  ],
  "text_segmented": "完整的 範例句子"
}

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

ailabs-asr-0.0.9.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

ailabs_asr-0.0.9-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file ailabs-asr-0.0.9.tar.gz.

File metadata

  • Download URL: ailabs-asr-0.0.9.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for ailabs-asr-0.0.9.tar.gz
Algorithm Hash digest
SHA256 fba267d28751687777b255fb453278cdef8ee835d79d799e36382e91333d42c7
MD5 0615854414bb6bc3ce268f8792275b35
BLAKE2b-256 9b6aed4c9355f462747ef4ebd3695251b3b6eb9a888403b6f20aa6b28a872a71

See more details on using hashes here.

File details

Details for the file ailabs_asr-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: ailabs_asr-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for ailabs_asr-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 3e0fae6adb5591232397f813b5610c340d401dfb74e50589df653f6c16cd1e97
MD5 beab04e1ed032c25c3947690032aa5f1
BLAKE2b-256 728e64204b4cb8e82bf78441f6102acc06dfc97511603be72db9ed699e247319

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