static bool web_matchNodeLists_debug;
static int web_matchNodeLists(L<WebNode> l1, L<WebNode> l2) {
if (l(l1) != l(l2)) ret -1000;
int score = 0;
if (empty(l1)) ret score;
HashMap<WebNode> map = twoListsToHashMap(l1, l2);
Web web = first(l1).web, web2 = first(l2).web;
// Score nodes
for i over l1: {
WebNode a = l1.get(i), b = l2.get(i);
if (web_isAnythingVariable(a)) continue;
//if (neq(web_labels(a), web_labels(b))) --score;
if (!containsAllIC_lisp(web_labels(b), web_labels(a))) --score;
}
// Score relations
for (WebRelation rel : web_relationObjects(web)) {
WebNode aa = map.get(rel.a), bb = map.get(rel.b);
if (aa == null || bb == null) continue;
WebRelation rel2 = web2.getRelationOpt(aa, bb);
if (web_matchNodeLists_debug)
print("a=" + rel.a + ", b=" + rel.b + ", aa=" + aa + ", bb=" + bb + ", rel2 labels=" + (rel2 == null ? "-" : str(web_labels(rel2)) + ", labels=" + rel.labels);
if (rel2 == null || !containsAllIC_lisp(web_labels(rel2), web_labels(rel)))
--score;
}
ret score;
}download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1010326 |
| Snippet name: | web_matchNodeLists - returns match score (0 or negative); now case insensitve |
| Eternal ID of this version: | #1010326/12 |
| Text MD5: | 04b116069f1e281d8976d5a9854a8108 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-11-02 03:20:56 |
| Source code size: | 1100 bytes / 29 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 853 / 901 |
| Version history: | 11 change(s) |
| Referenced in: | [show references] |