本文整理汇总了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;
}