Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

48
LINES

< > BotCompany Repo | #1020641 // Convert to third person Solvers

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (20712L/158K).

!7

sclass Example {
  S sentence, converted;
}

concept Solver {
  S code, codeHints;
  long modified, testedWhen;
  double score, total;
  S errorCases;
}

module ConvertTo3rdPersonSolver > DynCRUD<Solver> {
  *() { super(Solver); }
  
  start {
    crud.excludeFieldsFromEditing('testedWhen, 'score, 'total, 'errorCases);
    crud.multiLineFields = litset('code);
    crud.modifiedField = 'modified;
  }
  
  afterVisualize {
    addButton(tableDependentButton(table(), "Test Solver", rThread { testSolver(selected(), scorerWithErrors()) }));
    addButton(tableDependentButton(table(), "Show Errors", rThread {
      showText("Errors of solver " + selected().id, sfuLines(safeUnstructList(selected().errorCases)));
    }));
  }
  
  Scorer testSolver(Solver solver, Scorer scorer) enter {
    set codeWithHintsToFunctionOnString_verbose;
    F1<S> f = codeWithHintsToFunctionOnString(solver.code, solver.codeHints);
    L<Example> examples = dm_importCrudModuleConcepts(Example, "#1020639/ConvertTo3rdPersonExamples");
    cset(solver, score := 0.0, testedWhen := now(), total := l(examples));
    for (Example e : examples) {
      S got = pcallF(f, e.sentence);
      scorer.add(eqic(e.converted, got), pair(e, got));
    }
    cset(solver, score := scorer.score, errorCases := struct(scorer.errors));
    ret scorer;
  }
  
  // API
  
  void addSolver(S code) {
    uniq_sync(Solver, +code);
  }
}

Author comment

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: 413 / 7553
Version history: 22 change(s)
Referenced in: [show references]