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

56
LINES

< > BotCompany Repo | #1022283 // Gazelle: Preprocessed Chat Lines

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

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

1  
!7
2  
3  
concept Entry {
4  
  long msgID;
5  
  S line;
6  
  S preprocessed;
7  
  S ruleIDs; // rule(s) used for preprocessing
8  
9  
  sS _fieldOrder = "msgID line preprocessed";
10  
}
11  
12  
set flag DynModule.
13  
14  
cmodule GPreprocessedLines > DynCRUD<Entry> {
15  
  transient int maxInterpretablesPerLine = 20;
16  
  
17  
  start {
18  
    dbIndexing(Entry, 'msgID);
19  
    addCountToName();
20  
  }
21  
  
22  
  visualize {
23  
    ret withCenteredButtons(super.visualize(), "Full Scan", rThread fullScan);
24  
  }
25  
  
26  
  void fullScan enter {
27  
    new L<Entry> list;
28  
    new Flag interrupted;
29  
    temp AutoCloseable action = dm_currentAction("Scanning chat", rRaiseFlag(interrupted));
30  
    F0<GazelleEvalContext> contextMaker = new GazelleContextCache_v2().fill();
31  
    L<GazelleLine> lines = dm_discord_allLines();
32  
    for (GazelleLine line : iterateOverListSendingPercentage(voidfunc(O percent) { callOpt(action, 'setText, percent + "% - Scanning chat") }, reversed(lines))) {
33  
      if (!licensed() || interrupted!) break;
34  
      scanLine(line, +contextMaker);
35  
    }
36  
  }
37  
  
38  
  void scanLine(GazelleLine line, O... _) {
39  
    new L<Entry> list;
40  
    Collection<GInterpretable> l = takeFirst(maxInterpretablesPerLine, gazelle_preprocess(line.text, _));
41  
    for (GInterpretable intp : l) {
42  
      if (eq(intp.text, line.text)) continue;
43  
      list.add(unlistedWithValues Entry(
44  
        msgID := line.msgID,
45  
        line := line.text,
46  
        preprocessed := intp.text,
47  
        ruleIDs := intp.ruleID));
48  
    }
49  
    replaceItemsForMessage(line.msgID, list);
50  
  }
51  
  
52  
  void replaceItemsForMessage(long msgID, L<Entry> items) {
53  
    deleteConceptsWhere Entry(+msgID);
54  
    registerAll(items);
55  
  }
56  
}

Author comment

Began life as a copy of #1022191

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1022283
Snippet name: Gazelle: Preprocessed Chat Lines
Eternal ID of this version: #1022283/9
Text MD5: a417c9aa3b6d29a171ab19287fbce41b
Transpilation MD5: b1625f9a9354005c972790d9ec0d4b4c
Author: stefan
Category: javax / gazelle
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-12 20:41:33
Source code size: 1662 bytes / 56 lines
Pitched / IR pitched: No / No
Views / Downloads: 364 / 2984
Version history: 8 change(s)
Referenced in: [show references]