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

30
LINES

< > BotCompany Repo | #1029010 // Snippets Deep Double Word Index

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (5173L/24K).

1  
!7
2  
3  
cprint SnippetsDeepDoubleWordIndex {
4  
  transient DoubleWordIndex<WithIntArray<S>> wordIndex; // inner string = snippet ID, array = word positions in snippet
5  
6  
  start-thread {
7  
    time "Make double word index" {
8  
      print("Making index");
9  
      new DoubleWordIndex<WithIntArray<S>> wordIndex;
10  
      for (virtual CSnippet sn : dm_allSnippets()) {
11  
        S snippetID = (S) rcall snippetID(sn);
12  
        S text = cast rcall text(sn);
13  
        deepDoubleWordIndex_add(wordIndex, snippetID, text);
14  
      }
15  
      setField(+wordIndex);
16  
    }
17  
    print("Indexed " + nWords(wordIndex.numWords()));
18  
  }
19  
  
20  
  // API
21  
  
22  
  // may return null (no pre-search result)
23  
  Iterable<S> snippetsContainingTextIC_preSearch(S query, O... _) {
24  
    ret deepDoubleWordIndex_lookupString(wordIndex, query, _);
25  
  }
26  
  
27  
  Iterable<Pair<S, Cl<Int>>> snippetsContainingTextIC_preSearch_withPositions(S query, O... _) {
28  
    ret deepDoubleWordIndex_lookupString_withPositions(wordIndex, query, _);
29  
  }
30  
}

Author comment

Began life as a copy of #1029008

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1029010
Snippet name: Snippets Deep Double Word Index
Eternal ID of this version: #1029010/17
Text MD5: 12aa099a2405cab3a3d42c142156c8f8
Transpilation MD5: 4750810f97452fde38bdd3df48ea4182
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-16 22:38:57
Source code size: 1004 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 268 / 691
Version history: 16 change(s)
Referenced in: [show references]