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

12
LINES

< > BotCompany Repo | #1026589 // wordRangesIterator - all word ranges (without full by default)

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

Libraryless. Click here for Pure Java version (3100L/19K).

static ItIt<S> wordRangesIterator(S s, O... _) {
  ret wordRangesIterator(javaTokNPunctuationWithBrackets(s), _);
}

static ItIt<S> wordRangesIterator(LS tok, O... _) {
  boolPar plusFull;
  int n = countTokens(tok);
  ret nestedIterator(
    countIterator_exclusive(0, n), from -> mapI(
    countIterator_inclusive(from+1, from == 0 && !plusFull ? n-1 : n), to ->
      wordRange(tok, from, to)));
}

Author comment

Began life as a copy of #1026527

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: #1026589
Snippet name: wordRangesIterator - all word ranges (without full by default)
Eternal ID of this version: #1026589/5
Text MD5: 02d7b2ac5399f6fa28ccdc04be9ee665
Transpilation MD5: 88ff7f0abf0de43a262b40090c4bb3c7
Author: stefan
Category: javax / nlp
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-16 14:57:52
Source code size: 411 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 151 / 234
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1026606 - wordIntRangesIterator - all word ranges as IntRange (without full by default)