最近,我尝试使用IBM的Watson文本助手。我选择用Java对它进行编程,一切都很好,直到我尝试使用德语短语,也就是使用元音,ö,ü。
技能语言也是德语。
当收到接口的响应时,所有的变音都替换为�。
代码如下:
public String inquiry(String anfrage){
MessageInput input = new MessageInput();
input.setText(anfrage);
MessageOptions options = new MessageOptions.Builder(WORKSPACEID)
.input(input)
.build();
MessageResponse response = assistant.message(options)
.execute()
.getResult();
return response.getOutput().getGeneric().get(0).text();
}您知道从IBM API中正确获取变音的方法吗?
发布于 2020-06-17 21:43:12
在我的例子中,这行代码做到了。(感谢@data_henrik)
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out), true, "UTF-8"));https://stackoverflow.com/questions/62428061
复制相似问题