master
周文涛 2 years ago
parent c9b067e36a
commit 80b4634b2f

@ -994,8 +994,6 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
text = null; text = null;
text = ocrItem.getString("text");//ocr 识别的文本 text = ocrItem.getString("text");//ocr 识别的文本
probability = ocrItem.getDouble("probability");//置信度 probability = ocrItem.getDouble("probability");//置信度
log.info("ocrItem:");
log.info(ocrItem.toJSONString());
if ("101".equals(ruleInfo)) { if ("101".equals(ruleInfo)) {
if (StringUtils.isBlank(text) || StringUtils.isBlank(inputText)) { if (StringUtils.isBlank(text) || StringUtils.isBlank(inputText)) {
//没识别值 //没识别值
@ -1063,10 +1061,6 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
fieldRightMap.put(field, false); fieldRightMap.put(field, false);
} }
} }
System.out.println("----------------------");
for (OcrResultDTO result : ocrResultDTOList) {
System.out.println(result.toString());
}
} }
Date overDataCheckTime = new Date(); Date overDataCheckTime = new Date();
@ -1078,11 +1072,15 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
//OCR和NlU执行时间总和 //OCR和NlU执行时间总和
double ocrAndNluTimeSum = identifyDetailList.stream().mapToDouble(i -> (i.getOcrTime() == null ? 0 : i.getOcrTime()) + (i.getNluTime() == null ? 0 : i.getNluTime())).sum(); double ocrAndNluTimeSum = identifyDetailList.stream().mapToDouble(i -> (i.getOcrTime() == null ? 0 : i.getOcrTime()) + (i.getNluTime() == null ? 0 : i.getNluTime())).sum();
//执行时间(毫秒) //执行时间(毫秒)
double executionTime = (ocrAndNluTimeSum * 1000) + overDataCheckTime.getTime() - startDataCheckTime.getTime(); double dataStructuredTime = overDataCheckTime.getTime() - startDataCheckTime.getTime();
double executionTime = (ocrAndNluTimeSum * 1000) + dataStructuredTime;
responseBody.put("min",min); responseBody.put("min",min);
responseBody.put("max",max); responseBody.put("max",max);
responseBody.put("executionTime",executionTime); responseBody.put("dataStructuredTime",dataStructuredTime);
responseBody.put("allExecutionTime",executionTime);
responseBody.put("detailList", ocrResultDTOList); responseBody.put("detailList", ocrResultDTOList);
long count = ocrResultDTOList.stream().filter(o -> !o.getRuleValidation()).count();
responseBody.put("taskResult",count>0?0:1);//匹配成功或失败
return responseBody; return responseBody;
} }

@ -162,7 +162,10 @@ public class StrCharUtil {
*/ */
public static double similarityRatio(String strA, String strB) { public static double similarityRatio(String strA, String strB) {
double v = Similarity.charBasedSimilarity(strA, strB); double v = Similarity.charBasedSimilarity(strA, strB);
return new BigDecimal(v).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); if (v!=0) {
v=new BigDecimal(v).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}
return v;
/*System.out.println(word1 + " vs " + word2 + " 字面相似度值:" + charBasedSimilarityResult); /*System.out.println(word1 + " vs " + word2 + " 字面相似度值:" + charBasedSimilarityResult);
if (StringUtils.isBlank(strA)||StringUtils.isBlank(strB)) { if (StringUtils.isBlank(strA)||StringUtils.isBlank(strB)) {
return 0; return 0;

Loading…
Cancel
Save