speech_recognition icon indicating copy to clipboard operation
speech_recognition copied to clipboard

query = r.recognize_google(audio, language="en-us") supaya jadi bisa pake bahasa indonesia audionya, diganti apa ya? "ind" kah?

Open abdulaziz9797 opened this issue 3 years ago • 2 comments

Steps to reproduce

  1. (How do you make the issue happen? Does it happen every time you try it?)
  2. (Make sure to go into as much detail as needed to reproduce the issue. Posting your code here can help us resolve the problem much faster!)
  3. (If there are any files, like audio recordings, don't forget to include them.)

Expected behaviour

(What did you expect to happen?)

Actual behaviour

(What happened instead? How is it different from what you expected?)

(If the library threw an exception, paste the full stack trace here)

System information

(Delete all the statements that don't apply.)

My system is <INSERT SYSTEM HERE>. (For example, "Ubuntu 16.04 LTS x64", "Windows 10 x64", or "macOS Sierra".)

My Python version is <INSERT VERSION HERE>. (You can check this by running python -V.)

My Pip version is <INSERT VERSION HERE>. (You can check this by running pip -V.)

My SpeechRecognition library version is <INSERT VERSION HERE>. (You can check this by running python -c "import speech_recognition as sr;print(sr.__version__)".)

My PyAudio library version is <INSERT VERSION HERE> / I don't have PyAudio installed. (You can check this by running python -c "import pyaudio as p;print(p.__version__)".)

My microphones are: (You can check this by running python -c "import speech_recognition as sr;print(sr.Microphone.list_microphone_names())".)

My working microphones are: (You can check this by running python -c "import speech_recognition as sr;print(sr.Microphone.list_working_microphones())".)

I installed PocketSphinx from <INSERT SOURCE HERE>. (For example, from the Debian repositories, from Homebrew, or from the source code.)

abdulaziz9797 avatar Apr 24 '21 18:04 abdulaziz9797

use id-ID or check link below

here, recognize google module support multiple language, you can check it out in this link: https://cloud.google.com/speech-to-text/docs/languages

kindvy avatar May 28 '21 15:05 kindvy

from ast import If, Return, Try from curses import has_extended_color_support from distutils.cmd import Command from doctest import master from email.mime import audio from lib2to3.pytree import _Results import re from tokenize import Special from winreg import QueryValue import pyttsx3 import speech_recognition as sr import datetime import wikipedia import webbrowser import os import smtplib

print("Initializing lily") MASTER ="Ashmita" engine = pyttsx3.init('sapi5') voices = engine.getProperty('voices') engine.setProperty('voice',voices[0].id) #speak function will pronounc the string which is passed to it. def speak(text): engine.say(audio) engine.runAndWait()

# This function will wish you as per the current time.

def wishMe():
    hour = int(datetime.datetime.now().hour)
           
    if hour >=0 and hour <12:
        speak("Good Morning"+ MASTER)

    elif hour>=12 and hour<18:
     speak("Good Afternoon"+ MASTER)

    else:
     speak("Good Evening"+ MASTER)
         
   # speak("I am Mily. How may i help you ?")

MASTER = "Ashmita"

This function will take command from the microphone.

def takeCommand(): r = sr.Recognizer() with sr.Microphone() as Source: print("Listening...") audio = r.Listen(source) try: print("Recognizer...") query = r.recognize_google(audio,Language = 'en-in') print(f"user said:{query}\n")

           except Exception as e:
             print("Say that again please")
              query = None
                  return query

Main Program starts here

              speak("Initialize moly")
              wishMe()
              query = takeCommand()

#Logic for executing basic tasks as per the query if 'wikipedia' in query: speak('Searching Wikipedia') query = query.replace("wikipedia","") results = wikipedia.summary(query, sentences = 2) speak(results)

dynamogith21 avatar Aug 29 '22 12:08 dynamogith21