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

14
LINES

< > BotCompany Repo | #1013299 // scoredSearch3 - with Boyer-Moore

JavaX fragment (include)

static L<S> scoredSearch3(S query, Iterable<S> data, O... _) {
  new MultiMap<Int, String> map;
  L<S> prepared = scoredSearch_prepare(query);
  new L<BoyerMooreStringSearch> searchers;
  for (S s : prepared) searchers.add(BoyerMooreStringSearch(s));
  if (data != null) for (S s : data) {
    int score = 0;
    for (BoyerMooreStringSearch searcher : searchers)
      if (searcher.containedIn(s)) ++score;
    if (score == 0) continue;
    map.put(score, s);
  }
  ret nValuesFromMultiMapByKeyDesc(optPar maxResults(_, 1000), map);
}

Author comment

Began life as a copy of #1013292

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: #1013299
Snippet name: scoredSearch3 - with Boyer-Moore
Eternal ID of this version: #1013299/5
Text MD5: 2c9708a5969dc16761e2e2c92e7eeb9a
Author: stefan
Category: javax / text
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-12 12:43:09
Source code size: 547 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 365 / 399
Version history: 4 change(s)
Referenced in: [show references]