从 Google Speech Recognition 中删除亵渎审查员 [英] Remove profanity censor from Google Speech Recognition

查看:27
本文介绍了从 Google Speech Recognition 中删除亵渎审查员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Google 的 Speech to Text API 在 iOS 应用程序中将语音转换为文本.我只是将一些音频数据发送到 URL "https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-US"并且它返回给我(大部分)正确的我说的话.但是,它正在用####"代替任何亵渎.如何用实际的诅咒词替换####"?

I am trying to convert speech to text in an iOS application using Google's Speech to Text API. I am simply sending some audio data to the URL "https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-US" and it is returning me the (mostly) correct words I say. However, it is replacing any profanity with '####'. How can I replace the '####' with the actual curse words?

只是一些附加信息:我正在使用 todoroo SpeechToText 库.请求的代码如下:

Just some additional information: I am using the todoroo SpeechToText library. The code for the request is as follows:

NSURL *url = [NSURL URLWithString:@"https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-US"];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:byteData];
[request addValue:@"audio/x-speex-with-header-byte; rate=16000" forHTTPHeaderField:@"Content-Type"];
[request setURL:url];
[request setTimeoutInterval:15];
NSURLResponse *response;
NSError *error = nil;
....
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

推荐答案

找到了:只需将 &pfilter=0 添加到 URL 中,它就变成了

Found it: Simply add &pfilter=0 to the URL so it becomes

https://www.google.com/speech-api/v1/recognize?xjerr=1&pfilter=0&client=chromium&lang=en-US"

请注意,设置 pfilter=0 会删除脏话过滤器,pfilter = 1 会用####"(始终是 4 个哈希标记)替换任何脏话,而 pfilter = 2 会用其首字母和正确数量的星号替换脏话,即:b**** 或 f***.

Note that setting pfilter=0 removes the profanity filter, pfilter = 1 replaces any profanity with '####' (always 4 hash marks), and pfilter = 2 replaces profanity with its first letter and the correct number of asterisks, i.e: b**** or f***.

这篇关于从 Google Speech Recognition 中删除亵渎审查员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆