google-云语音speech.types.RecognitionConfig
google-cloud-speech speech.types.RecognitionConfig
我目前 运行 在 Debian 8 Jessie 上 Python 2.7 和当前 google-cloud-speech and storage(今天升级了)。当我尝试配置时失败:
ValueError:协议消息 RecognitionConfig 没有 "enable_automatic_punctuation" 字段。
来自这个电话:
config = speech.types.RecognitionConfig(
encoding=speech.enums.RecognitionConfig.AudioEncoding.LINEAR16,
sample_rate_hertz=8000,
language_code='en-US',
# Enable automatic punctuation
enable_automatic_punctuation=True)
呼叫直接来自“https://cloud.google.com/speech-to-text/docs/automatic-punctuation#speech-enhanced-model-python”copy/paste。
嗯?
enable_automatic_punctuation
仅在导入 speech_v1p1beta1
而不是 speech_v1
时可用。比较 RecognitionConfig
和 beta and non beta.
的文档
此外,在您链接的同一个示例中,如果单击 View on Github,您可以看到以下导入:
from google.cloud import speech_v1p1beta1 as speech
此外,。
编辑:
此外,该代码在 Python 3 上,而您使用的是 Python 2.7,请注意这一点。
我目前 运行 在 Debian 8 Jessie 上 Python 2.7 和当前 google-cloud-speech and storage(今天升级了)。当我尝试配置时失败:
ValueError:协议消息 RecognitionConfig 没有 "enable_automatic_punctuation" 字段。
来自这个电话:
config = speech.types.RecognitionConfig(
encoding=speech.enums.RecognitionConfig.AudioEncoding.LINEAR16,
sample_rate_hertz=8000,
language_code='en-US',
# Enable automatic punctuation
enable_automatic_punctuation=True)
呼叫直接来自“https://cloud.google.com/speech-to-text/docs/automatic-punctuation#speech-enhanced-model-python”copy/paste。
嗯?
enable_automatic_punctuation
仅在导入 speech_v1p1beta1
而不是 speech_v1
时可用。比较 RecognitionConfig
和 beta and non beta.
此外,在您链接的同一个示例中,如果单击 View on Github,您可以看到以下导入:
from google.cloud import speech_v1p1beta1 as speech
此外,
编辑:
此外,该代码在 Python 3 上,而您使用的是 Python 2.7,请注意这一点。