!include once #1015415 // GrabbedImage svoid ocr_teachPhraseForm(final GrabbedImage gi, final SimpleRecognizer sr, final VF1 onTaught) { analyzeGrabbedImage(gi, sr); // make form final JTextField tf = jTypeWriterTextField(ocr_joinAsGrouped(gi.groupedRecognition)); final JCheckBox grouped = jCheckBox("grouped (" + ocrCharGroupingHelpText() + ")", true); final JButton btnSubmit = jbutton("Submit", r { S s = trim(tf.getText()); bool group = isChecked(grouped); L rects = gi.rects; if (group) { rects = ocr_groupRects(rects, s); s = ocr_unmerge(s); } saveScreenClip(gi.image); L characterMD5s = md5OfBWImageParts(gi.image, rects); if (sr.fullSearchMap != null) for i over rects: sr.fullSearchMap.put(gi.image.clip(rects.get(i)), characterMD5s.get(i)); S line = "The images " + quote(join(" ", characterMD5s)) + " are the " + (group ? "grouped " : "") + "characters " + quote(s) + "."; print(">> " + line); S imageMD5 = ocrMD5OfBWImage(gi.image); logQuoted(glyphTeachLog(), "[" + localDateWithSeconds() + "] Image " + imageMD5 + ": " + line); saveTextFile(newFile(screenClipsDir(), imageMD5 + ".line"), line); sr.load(line); disposePossiblyInternalFrame(tf); pcallF(onTaught, s); }); onUpdateAndNow(ll(tf, grouped), r { S s = trim(tf.getText()); btnSubmit.setEnabled((isChecked(grouped) ? ocr_glyphCount(s) : l(dropSpaces(s))) == l(gi.characters)); }); // show form growFrameSouth(50, showFormTitled("Teach", "Image:" , jscroll_minHeight(75, zoomedImageSurface(2, gi.image.getBufferedImage())), "Split:" , jscroll_minHeight(75, zoomedImageSurface(2, gi.visualizedSplit.getBufferedImage())), "Meaning:", tf, "", grouped, "", btnSubmit)); selectAllLater(tf, 100); }