Uses 911K of libraries. Click here for Pure Java version (20996L/115K).
1 | !7 |
2 | |
3 | concept Musing { |
4 | S text; |
5 | S verificationResult; |
6 | |
7 | sS _fieldOrder = "text verificationResult"; |
8 | } |
9 | |
10 | cmodule AIMusingsCRUD > DynCRUD<Musing> { |
11 | // API |
12 | |
13 | void storeMusing(S text) { |
14 | storeMusing(text, null); |
15 | } |
16 | |
17 | void storeMusing(S text, S verificationResult) { |
18 | Musing m = uniq Musing(+text); |
19 | if (nempty(verificationResult)) cset(m, +verificationResult); |
20 | else |
21 | dm_q(r { testMusing(m) }); |
22 | } |
23 | |
24 | void testMusing(Musing m) { |
25 | if (m == null) ret; |
26 | try { |
27 | int n = ai_checkMusing(m.text); |
28 | cset(m, verificationResult := "OK (" + n + ")"); |
29 | } catch print e { |
30 | cset(m, verificationResult := "ERROR: " + exceptionToStringShort(e)); |
31 | } |
32 | } |
33 | |
34 | start { |
35 | crud.multiLineFields = litset("text"); |
36 | } |
37 | |
38 | afterVisualize { |
39 | addSelectionDependentButton("Test", r { testMusing(selected()) }); |
40 | } |
41 | } |
Began life as a copy of #1027413
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: | #1027437 |
Snippet name: | AI Musings CRUD (PhilosophyBot test cases) |
Eternal ID of this version: | #1027437/7 |
Text MD5: | 90926332d979ea5a37e91e6b16428b46 |
Transpilation MD5: | 83d66dd14b423a4bfbf05bb0a073ffb2 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-20 16:31:22 |
Source code size: | 890 bytes / 41 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 262 / 876 |
Version history: | 6 change(s) |
Referenced in: | [show references] |