本文整理匯總了Java中com.microsoft.projectoxford.vision.contract.LanguageCodes類的典型用法代碼示例。如果您正苦於以下問題:Java LanguageCodes類的具體用法?Java LanguageCodes怎麽用?Java LanguageCodes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
LanguageCodes類屬於com.microsoft.projectoxford.vision.contract包,在下文中一共展示了LanguageCodes類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPasedMiscSoftText
import com.microsoft.projectoxford.vision.contract.LanguageCodes; //導入依賴的package包/類
public String getPasedMiscSoftText(OCR ocr) {
String result = "";
for (Region reg : ocr.regions) {
for (Line line : reg.lines) {
for (Word word : line.words) {
result += word.text + " ";
}
result += "\n";
}
result += "\n\n";
}
if (ocr.language.equalsIgnoreCase(LanguageCodes.ChineseSimplified) || ocr.language.equalsIgnoreCase(LanguageCodes.ChineseTraditional)) {
result = result.replaceAll(" ", "");
}
if (TextUtils.isEmpty(result))
result = "no text found";
return result;
}
示例2: process
import com.microsoft.projectoxford.vision.contract.LanguageCodes; //導入依賴的package包/類
private String process() throws VisionServiceException, IOException {
Gson gson = new Gson();
// Put the image into an input stream for detection.
ByteArrayOutputStream output = new ByteArrayOutputStream();
mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, output);
ByteArrayInputStream inputStream = new ByteArrayInputStream(output.toByteArray());
OCR ocr;
ocr = this.client.recognizeText(inputStream, LanguageCodes.AutoDetect, true);
String result = gson.toJson(ocr);
Log.d("result", result);
return result;
}