【问题标题】:what all are symbols not supported by Watson service to avoid BadRequestExceptionWatson 服务不支持哪些符号以避免 BadRequestException
【发布时间】:2017-03-21 05:10:58
【问题描述】:

我目前通过 Java SDK 使用 IBM Watson 的文本转语音 API

代码如下

TextToSpeech textToSpeech = new TextToSpeech();
textToSpeech.setUsernameAndPassword(username, password);
ServiceCall<InputStream> inputStreamServiceCall = textToSpeech.synthesize(text, Voice.EN_ALLISON, AudioFormat.OGG);
InputStream in = inputStreamServiceCall.execute();

在将文本转换为语音时出现以下异常

com.ibm.watson.developer_cloud.service.exception.BadRequestException: 在 com.ibm.watson.developer_cloud.service.WatsonService.processServiceCall(WatsonService.java:416) ~[java-sdk-3.3.0.jar:na] 在 com.ibm.watson.developer_cloud.service.WatsonService$1.execute(WatsonService.java:179) ~[java-sdk-3.3.0.jar:na]

com.ibm.watson.developer_cloud.service.WatsonService processServiceCall 严重:获取 https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?text=Question%20%20%3Cbreak%20time%3D%221s%22/%3E%20Use%20the%20figure%20below%20to%20answer%20the%20following%20question.%20If%20AC||DE,%20which%20of%20the%20following%20justifies%20%CE%94ABC%20~%20%CE%94DBE?%20%20%3Cbreak%20time%3D%221s%22/%3E%20%20Answer%20Choices%20%20%20%3Cbreak%20time%3D%221s%22/%3E%20%20Choice%20A%20%20%3Cbreak%20time%3D%221s%22/%3E%20%20%20Definition%20of%20Similar%20Triangles%20%20%20%3Cbreak%20time%3D%221s%22/%3E%20%20Choice%20B%20%20%3Cbreak%20time%3D%221s%22/%3E%20%20%20SAS%20Similarity%20Theorem%20%20%20%3Cbreak%20time%3D%221s%22/%3E%20%20Choice%20C%20%20%3Cbreak%20time%3D%221s%22/%3E%20%20%20SSS%20Similarity%20Theorem%20%20%20%3Cbreak%20time%3D%221s%22/%3E%20%20Choice%20D%20%20%3Cbreak%20time%3D%221s%22/%3E%20%20%20AA%20Similarity%20Postulate%20&voice=en-US_AllisonVoice&accept=audio/ogg;%20codecs%3Dopus, 状态:400,错误:

我已通过将以下符号“”©—''▒ "{}|`\​ 替换为空格来解决此问题。

请建议 watson 服务不支持哪些符号?

【问题讨论】:

    标签: java text-to-speech ibm-watson watson


    【解决方案1】:

    将您的 com.ibm.watson.developer_cloud java-sdk 升级到更高版本。最新版本是 3.8.0。在 java-sdk-3.3.0.jar 中,一些字符在对 watson 进行 API 调用时未正确编码。

    【讨论】:

      猜你喜欢
      • 2020-11-06
      • 2015-04-15
      • 1970-01-01
      • 1970-01-01
      • 2017-10-11
      • 2016-09-20
      • 1970-01-01
      • 2022-12-14
      • 1970-01-01
      相关资源
      最近更新 更多