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)

1  
static L<S> scoredSearch3(S query, Iterable<S> data, O... _) {
2  
  new MultiMap<Int, String> map;
3  
  L<S> prepared = scoredSearch_prepare(query);
4  
  new L<BoyerMooreStringSearch> searchers;
5  
  for (S s : prepared) searchers.add(BoyerMooreStringSearch(s));
6  
  if (data != null) for (S s : data) {
7  
    int score = 0;
8  
    for (BoyerMooreStringSearch searcher : searchers)
9  
      if (searcher.containedIn(s)) ++score;
10  
    if (score == 0) continue;
11  
    map.put(score, s);
12  
  }
13  
  ret nValuesFromMultiMapByKeyDesc(optPar maxResults(_, 1000), map);
14  
}

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: 366 / 401
Version history: 4 change(s)
Referenced in: [show references]