Uses 911K of libraries. Click here for Pure Java version (15340L/82K).
!7 // English: // x is contained in a mech list whose name contains "noun" => x is a noun concept Result { int count; S output; MapSO vars; S result; // yes or no } cmodule FindingNouns > DynCRUD<Result> { S freeText; transient new LPair<S, MapSO> suggestionsAndVars; transient JButton btnYes, btnNo; transient Pair<S, MapSO> current; // proposal and variables used start-thread { db(); LS emits = getEmits_tee(r { javaxSimple(); }); MapSO lastVars = null; for (S s : emits) { MapSO vars = parseLineFromEmitVariables(s); if (vars != null) lastVars = vars; else suggestionsAndVars.add(pair(s, lastVars)); } runByUser(); } visual jtabs("Dialog" := centerAndSouthWithMargins(dm_printLogView(), westAndCenterWithMargin( jline( btnYes = jbutton("Yes", rThread yes), btnNo = jbutton("No", rThread no), jlabel("or free text:")), onEnter(dm_textField freeText(), rThread { storeResult(freeText) }))), "Results" := super); void runByUser { current = random(suggestionsAndVars); if (current == null) ret; printWithPrecedingNL(current.a); print("Correct?"); enableButtons(btnYes, btnNo); } void yes { storeResult("yes"); } void no { storeResult("no"); } void storeResult(S result) enter { if (current == null) ret; print("Storing result: " + result); Result r = uniq(Result, output := current.a, vars := current.b, +result); cset(r, count := r.count+1); disableButtons(btnYes, btnNo); //sleepSeconds(1); runByUser(); } void javaxSimple() { for (S listName : mechListNames()) if (cic(listName, "noun")) for (S s : mL(listName)) { emitVariables(+listName, +s); emit(quote(s) + " is a noun"); } } }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1026487 | 
| Snippet name: | Finding Nouns [dev.] | 
| Eternal ID of this version: | #1026487/16 | 
| Text MD5: | c0eb60e61a2f3d80a485b496c4f24165 | 
| Transpilation MD5: | 4f8be89c80a66352d2a6de0dd28a99d4 | 
| Author: | stefan | 
| Category: | javax / speech recognition | 
| Type: | JavaX source code (Dynamic Module) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2020-01-06 19:58:34 | 
| Source code size: | 1905 bytes / 71 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 427 / 756 | 
| Version history: | 15 change(s) | 
| Referenced in: | [show references] |