Skip to main content

WeChat Middleware for EH Forwarder Bot to convert voice to text, based on Baidu and Microsoft API.

Project description

VoiceRecogMiddleware: A middleware for EFB

Notice

Middleware ID: catbaron.voice_recog

VoiceRecogMiddleware is a middleware for EFB to recognize content of voice message. This middleware is modified based on ehForwarderBot 1.0

example

  • Baidu
  • Azure Cognitive Service
    • Azure Cognitive Service offers 5 audio hours per month for free.
    • You need to get Key1 and Endpoint from https://portal.azure.com/
  • IFlyTek
    • IFlyTek offers 500 queries per day fro free to new users. Additional free bundles are available from 50,000 queries/90 days to 100,000 queries/year.
    • You need to get APPID, APISecret and APIKey from https://console.xfyun.cn/services/iat
  • Tencent
  • You need to use VoiceRecogMiddleware on top of EFB. Please check the document and install EFB first.

Dependense

  • Python >= 3.6
  • EFB >= 2.0.0b15
  • pydub

Install and configuration

Install

git clone https://github.com/catbaron0/efb-voice_recog-middleware
cd efb-voice_recog-middleware
sudo python setup.py install

Enable

Register to EFB Following this document to edit the config file. The config file by default is $HOME/.ehforwarderbot/profiles/default. It should look like:

master_channel: foo.demo_master
slave_channels:
- foo.demo_slave
- bar.dummy
middlewares:
- foo.other_middlewares
- catbaron.voice_recog

You only need to add the last line to your config file.

Configure the middleware

The config file by default is $HOME/.ehforwarderbot/profiles/default/catbaron.voice_recog. Please create the config file if thers is not one. Edit it as:

speech_api:
    baidu:
        api_key: API_KEY
        secret_key: SECRET_KEY
        # supported language:
        #   zh, zh-x-en, en, zh-yue, zh-x-sichuan, zh-x-farfield
        lang: zh
    azure:
        key1: KEY_1
        endpoint: ENDPOINT
        # supported language:
        #   ar-EG, ar-SA, ar-AE, ar-KW, ar-QA, ca-ES,
        #   da-DK, de-DE, en-AU, en-CA, en-GB, en-IN,
        #   en-NZ, en-US, es-ES, es-MX, fi-FI, fr-CA,
        #   fr-FR, gu-IN, hi-IN, it-IT, ja-JP, ko-KR,
        #   mr-IN, nb-NO, nl-NL, pl-PL, pt-BR, pt-PT,
        #   ru-RU, sv-SE, ta-IN, te-IN, zh-CN, zh-HK,
        #   zh-TW, th-TH, tr-TR
        lang: zh
    tencent:
        secret_id: SECRET_ID
        secret_key: SECRET_KEY
        # supported language: en, zh
        lang: en
    iflytek:
        app_id: APP_ID
        api_secret: API_SECRET
        api_key: APP_KEY
        # supported language: zh, en
        lang: en
auto: true

Replace the section with all-caps to your own ones.

Note that you may omit the section that you do not want to enable.


Turn off auto if you want to disable auto recognition to all voice messages. Alternatively, you may reply recog` to a voice message to recognise it.

Restart EFB.

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

efb-voice_recog-middleware-0.2.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

efb_voice_recog_middleware-0.2.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file efb-voice_recog-middleware-0.2.0.tar.gz.

File metadata

  • Download URL: efb-voice_recog-middleware-0.2.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.1.1 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.9

File hashes

Hashes for efb-voice_recog-middleware-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2d09d49567e7cab6571f8e17a71a587f626897c47c26f225f282e49a398211aa
MD5 8ef74f3c79ef2f3cd1ae0b428097bb3a
BLAKE2b-256 3e67625ccd83d37cce924c397fcbaf6ecbc564c086311c6c21f27f8a70018bd2

See more details on using hashes here.

File details

Details for the file efb_voice_recog_middleware-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: efb_voice_recog_middleware-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.1.1 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.9

File hashes

Hashes for efb_voice_recog_middleware-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0db16d67690b727c1adecf3152dee36bed009f92f343c62d43f6fa9bd63cde5d
MD5 437a439bd563ae52dd2420ced286f465
BLAKE2b-256 a976b2a4ef4882065d904b0cd7e2d6ba281e6c2f3a9da5e28b9f41c7e9733b71

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