我使用谷歌云视觉API(Text_Detection)这是工作正常,但在谷歌我回来的答案的时候,消息样式如何修复响应文本?像图像
我想只是一个文本如“学术策划师”这样我怎么能去除学术面前“null:”等字?
图像e.g
这里是我的代码;
private String convertResponseToString(BatchAnnotateImagesResponse response) {
String message = "I found these things:\n\n";
List<EntityAnnotation> labels = response.getResponses().get(0).getTextAnnotations();
if (labels != null) {
for (EntityAnnotation label : labels) {
message += String.format("%.3f: %s", label.getScore(), label.getDescription());
message += "\n";
}
} else {
message += "nothing";
}
return message;
}
都能跟得上它不是工作。我尝试但我会得到eror。 imgur.com/uEckW8Z Android工作室不允许这个代码,另一个想法? –
如果你想在这里是完整的代码:https://github.com/GoogleCloudPlatform/cloud-vision/tree/master/android/CloudVision –
糟糕,这些方法只适用于字符串和'EntityAnnotation'不是一个字符串。 ..我测试了我对一系列字符串的调整,很抱歉;看到编辑的答案。 – Dut