Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1010591 // web_matchAllPerms_partial_scoreF - pattern may be subnet of input

JavaX fragment (include)

static Map<WebNode> web_matchAllPerms_partial_scoreF(Web patternWeb, Web inputWeb, O scoreFunction) {
  L<WebNode> patternNodes = web_nodes(patternWeb);
  L<WebNode> inputNodes = web_nodes(inputWeb);
  if (l(patternNodes) > l(inputNodes))
    null;

  new Best<L<WebNode>> best;
  LL<WebNode> subsets = allSubsetsOfLength(l(patternNodes), inputNodes);
  for (L<WebNode> subset : subsets) {
    LL<WebNode> perms = allPermutations(subset);
    for (L<WebNode> perm : perms)
      best.put(perm, toDouble(callF(scoreFunction, patternNodes, perm)));
  }
  
  L<WebNode> l = best.getIfScoreAbove(0);
  ret l == null ? null : twoListsToOrderedMap(patternNodes, l);
}

Author comment

Began life as a copy of #1010467

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: #1010591
Snippet name: web_matchAllPerms_partial_scoreF - pattern may be subnet of input
Eternal ID of this version: #1010591/1
Text MD5: 8d76aeab674a77f5e3a7feb08e2f98d3
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-22 17:28:40
Source code size: 677 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 458 / 498
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)