Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable profanity filter for recognition via Web Speech API

Tags:

I am using webkitSpeechRecognition instance to access the native speech recognition in Chrome. The problem is that the Web Speech API specification does not cover the topic of profanity filtering, yet Google's Speech API, by default, has the profanity filter enabled. It is not a major problem - luckily the default filter for Web Speech API shows the first letter and hides the rest under the asterisks. However there are cases when a word starting with a certain letter and having a certain length be derived from different cuss words and guessing what the person has said may not give an accurate result.

The question here is: how can the profanity filtering level of Web Speech API in Chrome be controlled? The JavaScript instance does not expose any additional (platform specific) variables to play around with. The actual Speech API had the pfilter URL parameter which can be set to 0 (no filtering), 1 (filtering and replacing words with ####) or 2 (filtering and replacing all but the first letter with asterisks). This parameter is also exposed for Chrome Extension developers, it is located in SpeechInputStartOptions (however it is a boolean variable).

P.S. The SpeechInputStartOptions documentation talks about default Chrome filtering settings. I could not find the setting for this or any information about where it is located. Even though ideally, the solution should not involve user having to do something, finding the in-Chrome setting for it would still be a breakthrough.

like image 575
Xeos Avatar asked Feb 08 '15 21:02

Xeos


People also ask

How do I turn off Profanity Filter in Chrome?

Open up the Settings app on your phone and scroll down to “Languages & input.” Next, tap “Virtual keyboard.” Tap “Google voice typing.” Disable the “Block offensive words” toggle.

What is Speech Recognition API?

The speech recognition part of the Web Speech API allows authorized Web applications to access the device's microphone and produces a transcript of the voice being recorded. This allows Web applications to use voice as one of the input & control method, similar to touch or keyboard.

What is profanity filter?

A profanity filter is a type of software that scans user-generated content (UGC) to filter out profanity within online communities, social platforms, marketplaces, and more. Moderators decide on which words to censor, including swear words, words associated with hate speech, harassment, etc.


1 Answers

Currently, Chrome does not allow disabling the profanity filter on webkitSpeechRecognition.

I was able to find these 2 bugs:

  1. bug filed on WICG

  2. bug on Chromium to support disabling profanity filter

The Chromium source code does seem to have the option called filter_profanities but seems to be defaulting it to true for the web version.

( In case you are interested, link to Chromium source for speech_recognition_session_config.h that defines filter_profanities)

Closest working solution I could find was Google's Speech to text cloud solution which does allow removing the profanity filter.

like image 168
vineethbc Avatar answered Sep 20 '22 13:09

vineethbc