我希望将一份德语播客转录成文字,并且我已经将其存储在我的计算机和Google Storage存储桶中。我正在使用 这个教程 作为参考。
这是我的代码:
frame_rate, channels = frame_rate_channel('pod.wav')
gcs_uri = 'gs://callsaudiofiles21/pod.wav'
client = speech.SpeechClient()
audio = types.RecognitionAudio(uri=gcs_uri)
config = types.RecognitionConfig(
encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16,
sample_rate_hertz=frame_rate,
language_code='de-DE')
transcript = ''
operation = client.long_running_recognize(config, audio)
response = operation.result(timeout=10000)
for result in response.results:
transcript += result.alternatives[0].transcript
但它停在了operation
这一行,输出TypeError: long_running_recognize() takes from 1 to 2 positional arguments but 3 were given
。该教程是一年前发布的,因此 API 中必定有所更改。不过我不确定需要修改什么。