speech_recognition icon indicating copy to clipboard operation
speech_recognition copied to clipboard

recognize_google should have pfilter = 0 by default but it's censoring words as if it's running pfilter = 1

Open blu3str opened this issue 2 years ago • 3 comments

Steps to reproduce

def speech_to_text(self):
        recognizer = sr.Recognizer()
        with sr.Microphone() as mic:
            print("listening...")
            recognizer.adjust_for_ambient_noise(mic,duration=2)
            audio = recognizer.listen(mic)
        try:
            self.text = recognizer.recognize_google(audio, language = "en-US")
            print(text)

"what the shit" "what the s***" -> This is what is recorded, and in theory the correct result of pfitler = 1, But even in the source code it looks like it's running pfilter = 0.

Expected behaviour

I would expect this to return without the censorship and if i provide pfitler = 1 then I should get the above result. Or if you are really lazy until a real fix comes out, a quick update to say the default is returning the results of pfitler = 1

System information

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

My system is macOS Monterey

My Python version is 3.9.12

My Pip version is 22.0.4

My SpeechRecognition library version is 3.7.1

My PyAudio library version is 0.2.11

blu3str avatar Apr 16 '22 17:04 blu3str

I have this problem. Can somebody help?

savva643 avatar May 19 '22 05:05 savva643

        if key is None: key = "AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw"
        url = "http://www.google.com/speech-api/v2/recognize?{}".format(urlencode({
            "client": "chromium",
            "lang": language,
            "key": key,
            "pFilter": pfilter
        }))

Looks like this is handled on the server side. This should be reported to Google.

Ccode-lang avatar May 25 '22 18:05 Ccode-lang

I have just reported to Google that this repository, in my opinion, is exposing this fraudulent API key

codreporter avatar Dec 08 '23 10:12 codreporter