我使用谷歌雲視覺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