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

31
LINES

< > BotCompany Repo | #1030022 // sharedPhrases_characterMode + SharedPhrases_characterMode - example of the Stages class and stage {} construct

JavaX fragment (include) [tags: use-pretranspiled]

Uses 11335K of libraries. Click here for Pure Java version (14188L/75K).

1  
set flag Reparse.
2  
//set flag AllowMetaCode.
3  
//meta-transform { tok_andVarMixIn }
4  
//meta-transform { tok_stages }
5  
  
6  
sclass SharedPhrases_characterMode extends Stages & Var<LS> {
7  
  //*(S...|Cl<S> strings) { addAll(this.strings, strings); }
8  
  *(S... strings)  { addAll(this.strings, strings); }
9  
  *(Cl<S> strings) { addAll(this.strings, strings); }
10  
  
11  
  new LS strings;
12  
  int minLength = 2;
13  
14  
  LLS lineSplits;
15  
  CISet ci;
16  
17  
  // stage 1. split all the lines
18  
  stage { lineSplits = stringsToLineCompSplits(strings); }
19  
  
20  
  // stage 2. find similarities
21  
  stage { ci = intersectCISets(lineSplits); }
22  
  
23  
  // stage 3. forget the one letter stuff and sort by length (LONG first of course)
24  
  stage { set(longStrings(ci, minLength)); }
25  
    
26  
  get :: before { run(); } // bring together Stages & Var
27  
}
28  
29  
static LS sharedPhrases_characterMode(S... strings) {
30  
  ret new SharedPhrases_characterMode(strings)!;
31  
}

Author comment

Began life as a copy of #1028914

download  show line numbers  debug dex  old transpilations   

Travelled to 5 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030022
Snippet name: sharedPhrases_characterMode + SharedPhrases_characterMode - example of the Stages class and stage {} construct
Eternal ID of this version: #1030022/23
Text MD5: 101b86f70ffbc97afff2c0f11df6a4e8
Transpilation MD5: b8807dd96bd33e8e219a57677623b66d
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-12-28 20:45:08
Source code size: 927 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 244 / 481
Version history: 22 change(s)
Referenced in: [show references]