我应用小鸭来提取书面数字并将其转换为数字。当我用德语传递句子时:“ fünf sechs sieben ”,它触发了一个错误:{'message': ' An invalid response was received from the upstream server '}
你知道如何对句子进行编码以避免错误吗?没有德语“元音变音”的句子效果很好。
url = "https://duckling..../parse"
payload = f'locale=de_DE&text={input_transcript}&dims=number'
headers = {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
}
try:
response = requests.post(
url,
data=payload,
headers=headers,
)
if response.status_code == 200:
json_response = response.json()