本文整理匯總了Java中com.cyzapps.mathrecog.MisrecogWordMgr類的典型用法代碼示例。如果您正苦於以下問題:Java MisrecogWordMgr類的具體用法?Java MisrecogWordMgr怎麽用?Java MisrecogWordMgr使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MisrecogWordMgr類屬於com.cyzapps.mathrecog包,在下文中一共展示了MisrecogWordMgr類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: recognizeMathExpr
import com.cyzapps.mathrecog.MisrecogWordMgr; //導入依賴的package包/類
public static void recognizeMathExpr(String strImageFile, CharLearningMgr clm, MisrecogWordMgr mwm, boolean bFilter) throws InterruptedException {
BufferedImage image = ImageMgr.readImg(strImageFile);
byte[][] biMatrix = ImageMgr.convertImg2BiMatrix(image);
ImageChop imgChop = new ImageChop();
imgChop.setImageChop(biMatrix, 0, 0, biMatrix.length, biMatrix[0].length, ImageChop.TYPE_UNKNOWN);
imgChop = imgChop.convert2MinContainer();
System.out.println("Now reading image file " + strImageFile + " :");
long startTime = System.nanoTime();
String strOutput = "\\Exception";
try {
StructExprRecog ser = ExprRecognizer.recognize(imgChop, null, -1, 0, 0);
StructExprRecog serOld = ser;
//System.out.println("Before raw filter, image " + strImageFile + " includes expression : " + ser.toString());
if (bFilter) {
ser = ExprFilter.filterRawSER(ser, null);
serOld = ser;
}
if (ser != null) {
//System.out.println("Before restruct, image " + strImageFile + " includes expression : " + ser.toString());
ser = ser.restruct();
serOld = ser;
if (bFilter) {
ser = ExprFilter.filterRestructedSER(ser, null, null);
serOld = ser;
}
if (ser != null) {
ser.rectifyMisRecogChars1stRnd(clm);
ser.rectifyMisRecogChars2ndRnd();
ser.rectifyMisRecogWords(mwm);
SerMFPTransFlags smtFlags = new SerMFPTransFlags();
smtFlags.mbConvertAssign2Eq = true;
strOutput = SerMFPTranslator.cvtSer2MFPExpr(ser, null, new CurPos(0), mwm, smtFlags);
} else {
strOutput = "NO VALID EXPRESSION FOUND.";
}
} else {
strOutput = "NO VALID EXPRESSION FOUND.";
}
} catch(ExprRecognizeException e) {
if (e.getMessage().compareTo(ExprRecognizer.TOO_DEEP_CALL_STACK) == 0) {
strOutput = "Expression is too complicated to recognize.";
}
}
long endTime = System.nanoTime();
System.out.println("After restruct, image " + strImageFile + " includes expression :\n" + strOutput);
//System.out.println(String.format("recognize %s takes %s", strImageFile, toString(endTime - startTime)));
}