backmeupplz / voicy

@voicybot Telegram bot main repository
https://voicybot.com
MIT License
893 stars 160 forks source link

peech recognition is not supported for language: Persian #18

Closed shahinesi closed 4 years ago

shahinesi commented 4 years ago

hi i'm used wit.ai for recognition language persian but error peech recognition is not supported for language: Persian how do you used wai.ai for recognation for persian? tnx

backmeupplz commented 4 years ago

I don't know, please, contact Wit

shahinesi commented 4 years ago

So how does your program work? If you use API?

backmeupplz commented 4 years ago

@shahinesi same as anyone's

shahinesi commented 4 years ago

@shahinesi same as anyone's

Amazing!

shahinesi commented 4 years ago
import requests
import json
from Recorder import record_audio, read_audio
# Wit speech API endpoint
API_ENDPOINT = 'https://api.wit.ai/speech?v=20191105'

# Wit.ai api access token
wit_access_token = 'E64XTTGVVCFWL4HGGEOU3I4TJ7CHFIHL'
def RecognizeSpeech(AUDIO_FILENAME, num_seconds = 5):

    # reading audio
    audio = read_audio(AUDIO_FILENAME)

    # defining headers for HTTP request
    headers = {'authorization': 'Bearer ' + wit_access_token,
               'Content-Type': 'audio/raw;encoding=signed-integer;bits=16;rate=16000;endian=little'}

    # making an HTTP post request
    resp = requests.post(API_ENDPOINT, headers = headers,
                         data = audio)

    # converting response content to JSON format
    data = json.loads(resp.content)

    # get text from data
    #text = data['_text']

    # return the text
    return data

This is my code for python!