1 | svoid gazelle_saveExampleFromCommentAsAppliedRule(S ruleID) { |
2 | for (S example : gazelle_goodExamplesFromComments(ruleID)) { |
3 | PairS xmp = splitAtDoubleArrow_pair(example); |
4 | if (xmp == null) continue; |
5 | GazelleEvalContext ctx = dm_gazelle_stdEvalContext(ll(t3(dm_textForRule(ruleID), dm_commentOfRule(ruleID), ruleID))); |
6 | L<RuleEngine2_MatchedRule> l = ai_ruleEngine2_rulesForInput_5(ctx.engine, litmap(standard := xmp.a)); |
7 | print("Matched: " + sfu(l)); |
8 | if (empty(l)) continue; |
9 | RuleEngine2_MatchedRule mr = first(l); |
10 | LS tokC = mr.outTokenize(mr.rule.out); |
11 | LS tokI = mr.outTokenize(xmp.b); |
12 | printStruct(tokI); |
13 | SS map = zipTwoListsToCIMap_strict_withoutEquals(tokC, tokI); |
14 | if (!gazelle_addMatch(mr, map, tokC, tokI)) continue; |
15 | print("Got map: " + mr.map); |
16 | dm_gazelle_saveAppliedRule( |
17 | judgement := 'good, |
18 | matchedRuleStruct := struct(mr), |
19 | context := "comment on " + ruleID); |
20 | } |
21 | } |
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
Snippet ID: | #1021884 |
Snippet name: | gazelle_saveExampleFromCommentAsAppliedRule |
Eternal ID of this version: | #1021884/8 |
Text MD5: | da6364827d486cdd2311b37d683262a4 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-03 00:10:14 |
Source code size: | 962 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 261 / 308 |
Version history: | 7 change(s) |
Referenced in: | [show references] |