Transpiled version (2316L) is out of date.
!759 !include #1004027 // WordAdapter p { genLog_set(latestChatLog()); print("Result: " + bla()); } static bool adapt_debug; static S bla() { L<S> log = gLog(); S bestResult = null; double bestValue = 0; thislearn: for (L<S> learn : gLearns()) { if (adapt_debug) print("Testing learn: " + struct(learn)); // j is starting point of match in log j: for (int j = l(log)-l(learn)+1; j < l(log); j++) pcall { if (adapt_debug) print("\nl(log)=" + l(log) + ", j=" + j); Adapter adapter = new WordAdapter; int k; for (k = j; k < l(log); k++) { S in = learn.get(k-j), out = log.get(k); if (adapt_debug) print(in + " => " + out); if (!adapter.canMatch(in, out)) { if (adapt_debug) print("Can't match"); continue j; } adapter = adapter.plus(in, out); if (adapt_debug) printStructure(" ", adapter); } double v = adapter.size(); if (bestResult == null || v < bestValue) { bestResult = adapter.get(learn.get(k-j)); bestValue = v; if (adapt_debug) print("New best: " + formatDouble(bestValue, 1) + " -- " + bestResult); } } } ret bestResult; }
Began life as a copy of #1004026
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004028 |
Snippet name: | Test Adapter |
Eternal ID of this version: | #1004028/1 |
Text MD5: | c7c83b675796ababc2f0b33649824ee1 |
Author: | stefan |
Category: | javax / talking robots |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-04 02:53:46 |
Source code size: | 1252 bytes / 43 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 585 / 655 |
Referenced in: | -