static bool web_matchNodeLists_x_debug; // nodeMatcher: func(WebNode, WebNode) -> double static int web_matchNodeLists_x(L<WebNode> l1, L<WebNode> l2, O nodeMatcher) { 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); score += toDouble(callF(nodeMatcher, a, b)); } // 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_x_debug) print("a=" + rel.a + ", b=" + rel.b + ", aa=" + aa + ", bb=" + bb + ", rel2 labels=" + (rel2 == null ? "-" : str(rel2.labels)) + ", labels=" + rel.labels); //if (rel2 == null || !containsAll(rel2.labels, rel.labels)) // --score; if (rel2 == null) --score; else score += toDouble(callF(nodeMatcher, rel, rel2)); } ret score; }
Began life as a copy of #1010326
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: | #1010802 |
Snippet name: | web_matchNodeLists_x - returns match score (0 or negative); with node matcher |
Eternal ID of this version: | #1010802/3 |
Text MD5: | fb2b87a77a408696460efc167e73aaf2 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-10-09 02:00:25 |
Source code size: | 1126 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 348 / 390 |
Version history: | 2 change(s) |
Referenced in: | [show references] |