有没有办法用python在意大利语句子中引入标点符号?
正如标题所示,我需要一个API来在意大利语句子中引入标点符号 我使用SpeechRecognition将语音转换为文本,但我实现的代码将句子作为输出,没有标点符号 我的代码如下:有没有办法用python在意大利语句子中引入标点符号?,python,speech-recognition,speech-to-text,speech,Python,Speech Recognition,Speech To Text,Speech,正如标题所示,我需要一个API来在意大利语句子中引入标点符号 我使用SpeechRecognition将语音转换为文本,但我实现的代码将句子作为输出,没有标点符号 我的代码如下: import speech_recognition as sr recognizer_instance = sr.Recognizer() with sr.Microphone() as source: recognizer_instance.adjust_for_ambient_noise(source)
import speech_recognition as sr
recognizer_instance = sr.Recognizer()
with sr.Microphone() as source:
recognizer_instance.adjust_for_ambient_noise(source)
print("I'm listening... say something!")
audio = recognizer_instance.listen(source)
print("Ok! I'm processing the message!")
try:
text = recognizer_instance.recognize_google(audio, language="it-IT")
print("Google understood: \n", text)
except Exception as e:
print(e)
如果我说,在执行期间,这句话:
“米加莫保罗,你呢?”
意思是“我叫保罗,你的?”
输出将如下所示:
import speech_recognition as sr
recognizer_instance = sr.Recognizer()
with sr.Microphone() as source:
recognizer_instance.adjust_for_ambient_noise(source)
print("I'm listening... say something!")
audio = recognizer_instance.listen(source)
print("Ok! I'm processing the message!")
try:
text = recognizer_instance.recognize_google(audio, language="it-IT")
print("Google understood: \n", text)
except Exception as e:
print(e)
我在听。。。说点什么好啊我正在处理消息
谷歌明白:
米加莫保罗图
不考虑标点符号。 如何插入此信息
谢谢 Google语音识别API支持意大利语标点符号,但您需要在识别配置中设置
启用自动标点符号=True
(请参阅)。将此功能添加到SpeechRecognition库的请求为。现在,您可以直接使用GoogleAPI,或者尝试添加标点符号作为后处理步骤(这似乎需要很多努力,因为这很可能需要培训一个类似的模型)