Libraryless. Click here for Pure Java version (20712L/158K).
1 | !7 |
2 | |
3 | sclass Example { |
4 | S sentence, converted; |
5 | } |
6 | |
7 | concept Solver { |
8 | S code, codeHints; |
9 | long modified, testedWhen; |
10 | double score, total; |
11 | S errorCases; |
12 | } |
13 | |
14 | module ConvertTo3rdPersonSolver > DynCRUD<Solver> { |
15 | *() { super(Solver); } |
16 | |
17 | start { |
18 | crud.excludeFieldsFromEditing('testedWhen, 'score, 'total, 'errorCases); |
19 | crud.multiLineFields = litset('code); |
20 | crud.modifiedField = 'modified; |
21 | } |
22 | |
23 | afterVisualize { |
24 | addButton(tableDependentButton(table(), "Test Solver", rThread { testSolver(selected(), scorerWithErrors()) })); |
25 | addButton(tableDependentButton(table(), "Show Errors", rThread { |
26 | showText("Errors of solver " + selected().id, sfuLines(safeUnstructList(selected().errorCases))); |
27 | })); |
28 | } |
29 | |
30 | Scorer testSolver(Solver solver, Scorer scorer) enter { |
31 | set codeWithHintsToFunctionOnString_verbose; |
32 | F1<S> f = codeWithHintsToFunctionOnString(solver.code, solver.codeHints); |
33 | L<Example> examples = dm_importCrudModuleConcepts(Example, "#1020639/ConvertTo3rdPersonExamples"); |
34 | cset(solver, score := 0.0, testedWhen := now(), total := l(examples)); |
35 | for (Example e : examples) { |
36 | S got = pcallF(f, e.sentence); |
37 | scorer.add(eqic(e.converted, got), pair(e, got)); |
38 | } |
39 | cset(solver, score := scorer.score, errorCases := struct(scorer.errors)); |
40 | ret scorer; |
41 | } |
42 | |
43 | // API |
44 | |
45 | void addSolver(S code) { |
46 | uniq_sync(Solver, +code); |
47 | } |
48 | } |
Began life as a copy of #1020639
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020641 |
Snippet name: | Convert to third person Solvers |
Eternal ID of this version: | #1020641/23 |
Text MD5: | aaf8f589829e048174b6112f721a0c0b |
Transpilation MD5: | c3309680c6b9114aae97a305230a283e |
Author: | stefan |
Category: | javax / stefan's os / nlp |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-01-05 11:07:39 |
Source code size: | 1452 bytes / 48 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 414 / 7555 |
Version history: | 22 change(s) |
Referenced in: | [show references] |