Warning: session_start(): open(/var/lib/php/sessions/sess_ksfe6hvdso3feupgjrpttr4iov, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!752
concepts.
concept Example {
BWImage image;
S imageMD5;
S text;
// new fields in this program:
BWImage visualizedSplit;
bool countMatch;
}
concept Theory {
new Ref fromExample;
BWImage image;
S imageMD5;
S text;
}
p {
loadConceptsFrom("#1006005");
Concepts in = mainConcepts;
JTable table = showConceptsTable(Example);
setFrameTitle(table, "Theories");
for (Example e : in.list(Example)) {
L rects = horizontalAutoSplit2ThenAutoCrop(e.image);
cset(e, visualizedSplit := new BWImage(mergeImagePartsHorizontally(e.image.toRGB(), rects)));
S text = e.text.replace(" ", "");
cset(e, countMatch := l(rects) == l(text));
if (!e.countMatch)
print("Bad number of characters: " + l(rects) + " vs " + l(text));
else {
for i over rects: {
BWImage cImg = e.image.clip(rects.get(i));
cnew(Theory, fromExample := e,
image := cImg,
imageMD5 := md5OfBWImage(cImg),
text := substring(text, i, i+1));
}
print("Made " + l(rects) + " theories");
}
}
}