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

37
LINES

< > BotCompany Repo | #1025819 // Sentence Analysis Spike [dev.]

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

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

1  
!7
2  
3  
cmodule SentenceAnalysis > DynPrintLog {
4  
  transient new LS analyzers;
5  
  
6  
  start-thread {
7  
    addAll(analyzers,
8  
      f dropLeadingPunctuation,
9  
      f ai_dropFillers);
10  
11  
    new Analyzer().analyze("OTOH, openbot streams from youtube");
12  
  }
13  
  
14  
  class Analyzer {
15  
    new SeenAndQueue<S> seen;
16  
    
17  
    {
18  
      seen.max = 100;
19  
      seen.onAddedToQueue(voidfunc(S s) { print("> " + s); });
20  
    }
21  
22  
    void analyze(S initial) {
23  
      seen.add(initial);
24  
      for (S s : seen) {
25  
        for (O f : analyzers) {
26  
          O result = callF(f, s);
27  
          if (result cast S)
28  
            seen.add(result);
29  
          else if (result cast Iterable)
30  
            seen.addAll(result);
31  
          else if (result != null)
32  
            print("Ignoring result: " + className(result) + " from " + f);
33  
        }
34  
      }
35  
    }
36  
  }
37  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1025819
Snippet name: Sentence Analysis Spike [dev.]
Eternal ID of this version: #1025819/3
Text MD5: a09a5f6fdc524767bb1e168917c66532
Transpilation MD5: 83def1c7410463989caaea0f3f4d0ecc
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-23 13:32:06
Source code size: 854 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 186 / 411
Version history: 2 change(s)
Referenced in: [show references]