如何在Google语音中获取定时信息以发送文本Python API客户端?

时间:2019-05-31 08:14:49

标签: python python-3.x google-api-client

根据https://cloud.google.com/speech-to-text/docs/reference/rest/v1beta1/speech/syncrecognize#SpeechRecognitionAlternative输出对象只有以下内容:

{
 "transcript": string,
 "confidence": number,
}

如何在此处获取成绩单的计时信息?

下面是代码段:

from google.cloud import speech_v1p1beta1 as speech

ip = sys.argv[1]
op = sys.argv[2]
# Instantiates a client
client = speech.SpeechClient()

operation = client.long_running_recognize(
    audio=speech.types.RecognitionAudio(
        uri='gs://my-bucket/' + ip,
    ),
    config=speech.types.RecognitionConfig(
        encoding=speech.enums.RecognitionConfig.AudioEncoding.LINEAR16,
        sample_rate_hertz=16000,
        language_code='en-US',
        model='default',#model='video',
    ),
)

我想从其输出中创建字幕文件,因此计时信息至关重要。

更多详细信息:https://cloud.google.com/speech-to-text/docs/reference/libraries#client-libraries-install-python

0 个答案:

没有答案