Uses 11335K of libraries. Click here for Pure Java version (11294L/75K).
sS ai_ruleOfThree_solver_4(S db, S input) { ret fixAOrAn(getVar(lastThat(ti -> !isTrue(getOptDyn(ti, "splitOffSuffixes")), too_transformInput_returnAll(input, too -> { // load rules too.addAll(lambdaMap ai_parseBasicLogicRule(tlft(db))); // find suffixes, transform everything accordingly too.addTransformer(func(BasicLogicRule<S> r) { Set<S> suffixes = ai_suffixesFromSharedWordStarts(r); if (nempty(suffixes)) { print(+suffixes); // found suffixes. now transform all inputs & rules too.addTransformer(func(IInput<S> i) { setOptAndReturn(TransformedInput(ai_splitOffWordSuffixes(suffixes, i!)), splitOffSuffixes := true) }); too.addTransformer(func(BasicLogicRule<S> r) { mapBasicLogicRule(r, s -> ai_splitOffWordSuffixes(suffixes, s)) }); // tack suffixes back on too.addTransformer(func(IInput<S> i) { TransformedInput(ai_remergeWordSuffixes(suffixes, i!)) }); } null; }); // turn words appearing in LHS and RHS into variables too.addTransformer(f<BasicLogicRule<S>, O> ai_sharedPhrasesIntoDollarVars); // match input with rules too_flexMatchRulesToTransformInput(too); })))); }
Began life as a copy of #1028917
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: | #1028934 |
Snippet name: | ai_ruleOfThree_solver_4 - like solver_1 but finds suffixes from repeated word parts (e.g. "fall-ing") |
Eternal ID of this version: | #1028934/14 |
Text MD5: | fe6abdd241c7ea55b5d838ad045bf12f |
Transpilation MD5: | d0a2ab95838ac5688454a35bf7fa1c44 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-12 13:17:22 |
Source code size: | 1289 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 304 / 411 |
Version history: | 13 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |