Libraryless. Click here for Pure Java version (2144L/15K/46K).
!752 sS info = [[ The images "9176714c9a935fc91e14595dbb3adddf 35731666e72dd0c9448f616ff3a7464a da9bc5a24bd503e898f69ad43bb9b92e" are the characters "yet". The images "412f9e0f8e177817a4fa285415c5a13f 386b289407599f31e3a7c57c3adb2587 6cd2a2284a5a6fda3a7cad3e3a048671 b0c47c014d665ec5b658f510c258dc47 b273ff598fe6afa04cfed9f9e8fb4109" are the grouped characters "[Ob]ject". //The image abcd12 is the character "a" //The image abcd34 is the characters "abc" //The image abcd34 can be the character "I" or "l" ]]; sclass GlyphInfo { S meaning; bool multi; // multiple meanings seen } // key = md5 static new Map<S, GlyphInfo> glyphInfos; p { new Matches m; for (S s : toLinesFullTrim(info)) { if "the images * are the characters *" { L<S> md5s = splitAtSpace($1); L<S> characters = eachCharAsString($2); saveMeanings(md5s, characters); } else if "the images * are the grouped characters *" { L<S> md5s = splitAtSpace($1); L<S> characters = ungroupCharacters($2); saveMeanings(md5s, characters); } else if (nempty(javaTokC(s))) { print("huh? " + s); } } psl(glyphInfos); } svoid saveMeaning(S md5, S meaning) { GlyphInfo info = getGlyphInfo(md5); if (info.multi) ret; if (hasDifferent(info.meaning, meaning)) { info.meaning = null; info.multi = true; print("multi"); } else info.meaning = meaning; } static GlyphInfo getGlyphInfo(S md5) { GlyphInfo info = glyphInfos.get(md5); if (info == null) glyphInfos.put(md5, info = new GlyphInfo); ret info; } svoid saveMeanings(L<S> md5s, L<S> characters) { if (l(md5s) != l(characters)) { print("huh?"); ret; } for i over md5s: saveMeaning(md5s.get(i), characters.get(i)); }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006103 |
Snippet name: | Simple Recognizer (dev.) |
Eternal ID of this version: | #1006103/1 |
Text MD5: | ee1a06fef402dffab6e22fe3e7b12b4b |
Transpilation MD5: | 5877c3b68291c00f31c0ad4fae99b3b9 |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-18 12:33:27 |
Source code size: | 1789 bytes / 59 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 536 / 627 |
Referenced in: | #1006108 - SimpleRecognizer - recognizes a line of text |