Warning: session_start(): open(/var/lib/php/sessions/sess_95nunl54gj1jue9dbuvle3ru5k, 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
!7
concept WordInfo {
S word;
int position;
S fact, wordType;
}
concept Text { S text; }
cmodule InfoAboutWords > DynCRUD {
S case;
S text, comment;
start {
onChange(r { cset(uniq_sync(Text), +text) });
text = cget text(conceptWhere(Text));
}
enhanceFrame {
internalFramePopupMenu(f/JInternalFrame, voidfunc(JPopupMenu popupMenu) {
popupMenu.add(jDynamicScrollingMenu("Select case", voidfunc(JPopupMenu menu) {
addMenuItem(menu, "Default case", rThread { dm_showNewModule(dm_moduleLibID()) });
for (fS name : subDirectoryNamesWithout(programDir(), "backups"))
addMenuItem(menu, name, rThread {
dm_showNewModuleWithParams(dm_moduleLibID(), caseID := name)
});
}));
addMenuItem(popupMenu, "Save as case...", rThread {
inputText("Case name", numberFileNameNotUsedInDir_startingWith2(programDir()), voidfunc(S caseID) {
assertNempty(caseID);
conceptsObject().save();
copyConceptsFile(programIDWithCase(), programID() + "/" + caseID);
dm_restartModuleWithParams(this, +caseID);
});
});
});
}
visualize as northCenterSouthSections(
"Input Text" := fontSizeTimes(1.25, dm_centeredTextField('text)),
"Facts" := super.visualize(),
"Tell me something about a word:" := dm_textFieldAndSubmit('comment, 'submitComment));
void submitComment {
S word = unquote(firstWord(comment)); // magic
int i = indexOfIC_fullWord(text, word); // magic
if (i < 0) shit: quote(word) + " not found in sentence";
new Matches m;
if (match_vbar("* is an adjective|* is an adjective here", comment, m))
cset(uniq_sync WordInfo(+word, position := i), wordType := "adjective", wordType_info := now());
uniq_sync WordInfo(+word, position := i, fact := comment);
}
}