1 | svoid applyNLLogicFacts(S input, VF1<? super S> postMessage) {
|
2 | new NLLogicChecker_v2 c; |
3 | c.matcher = new NLStringMatcher_dollarVars; |
4 | c.facts.addAll(mL("Random facts"));
|
5 | c.input = input; |
6 | |
7 | for (PairS idAndRule : combineWithGlobalIDs(splitAtEmptyLines(mL_raw("NL Logic Examples")))) pcall {
|
8 | S rule = idAndRule.b; |
9 | NLLogicChecker_v2.Matching m = new NLLogicChecker_v2.Matching(); |
10 | if (c.checkRule(nlLogic_parseRule(rule), m)) {
|
11 | print("Matched " + quote(input) + " with rule " + quote(rule));
|
12 | printStruct(m.matches); |
13 | for (Exp out : m.output) |
14 | for (Exp e : nlLogic_unrollAnd(out)) |
15 | if (e cast Func) |
16 | if (eq(e.name, "output") && e.arg instanceof Sentence) |
17 | callF(postMessage, ((Sentence) e.arg).text()); |
18 | } |
19 | } |
20 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1017647 |
| Snippet name: | applyNLLogicFacts |
| Eternal ID of this version: | #1017647/5 |
| Text MD5: | 821380d483406d40f01ad18861973f00 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-07-31 14:17:46 |
| Source code size: | 804 bytes / 20 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 580 / 628 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |