我在试着做一个广域网的语音识别。我有文件,谷歌,Google_Cloud,和Houndify。
我注意到,对于后两者,它们对亵渎没有问题,但是Google语音识别器过滤了这个词,例如f*,s*。
这给我带来了一个问题,因为我想用LIWC做一个多愁善感的分析,这个程序没有给像f*这样过滤过的单词赋予亵渎的权重。
我试过以上所有的方法。
(1)关闭污秽过滤器
recognizer_instance.recognize_google(audio_data: AudioData, key: Union[str, None] = None, language: str = "en-US", , pfilter: Union[0, 1], show_all: bool = False) -> Union[str, Dict[str, Any]]recognition/blob/master/reference/library-reference.rst
(2) Remove profanity censor from Google Speech Recognition
但他们没有解决这个问题
r.recognize_google(example_audio)->你到底怎么了?
但后来,
r.recognize_google(example_audio, pfilter=0)给出
TypeError Traceback (most recent call last)
<ipython-input-21-b158a03c879c> in <module>
----> 1 r.recognize_google(example_audio, pfilter=0)
TypeError: recognize_google() got an unexpected keyword argument 'pfilter'我该如何解决这个问题?
我知道,许多在Stackoverflow上编写的解决方案都是指Google的识别器。我确实有Google_Cloud (r.recognize_google_cloud)在工作,所以我想要一个recognize_google的解决方案,而不是Google_Cloud。我想比较一下结果。
发布于 2022-06-07 20:07:22
我打的也是一样的东西。在.py这里查看github中的代码,我可以看到支持pfilter参数,如文档所示,但是我从pip获得的版本(也称它为3.8.1 )刚刚删除了pfilter。
但是,查看实现,它只会影响"pfilter":0\1是否被添加到请求的字典中,所以只需在本地编辑副本以将其添加到字典中就可以了。
这种不一致很令人沮丧:
发布于 2022-06-22 00:44:31
您需要打开__init__.py (speech_recognition),
发现
def recognize_google(self, audio_data, key=None, language="en-US", show_all=False):并编辑到
def recognize_google(self, audio_data, key=None, language="en-US", show_all=False, pfilter=1):下一步
发现
url = "http://www.google.com/speech-api/v2/recognize?{}".format(urlencode({
"client": "chromium",
"lang": language,
"key": key,
}))并编辑到
url = "http://www.google.com/speech-api/v2/recognize?{}".format(urlencode({
"client": "chromium",
"lang": language,
"key": key,
"pFilter": pfilter,
}))和
r.recognize_google(example_audio, pfilter=0)将开始工作
https://stackoverflow.com/questions/56167934
复制相似问题