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).

set flag Reparse.
//set flag AllowMetaCode.
//meta-transform { tok_andVarMixIn }
//meta-transform { tok_stages }
  
sclass SharedPhrases_characterMode extends Stages & Var<LS> {
  //*(S...|Cl<S> strings) { addAll(this.strings, strings); }
  *(S... strings)  { addAll(this.strings, strings); }
  *(Cl<S> strings) { addAll(this.strings, strings); }
  
  new LS strings;
  int minLength = 2;

  LLS lineSplits;
  CISet ci;

  // stage 1. split all the lines
  stage { lineSplits = stringsToLineCompSplits(strings); }
  
  // stage 2. find similarities
  stage { ci = intersectCISets(lineSplits); }
  
  // stage 3. forget the one letter stuff and sort by length (LONG first of course)
  stage { set(longStrings(ci, minLength)); }
    
  get :: before { run(); } // bring together Stages & Var
}

static LS sharedPhrases_characterMode(S... strings) {
  ret new SharedPhrases_characterMode(strings)!;
}

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: 242 / 478
Version history: 22 change(s)
Referenced in: [show references]