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

23
LINES

< > BotCompany Repo | #1021130 // Word Auto-Splitter [splits once]

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

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

!7

cmodule WordAutoSplitter {
  S typingText, text, html;
  
  enhanceFrame { minFrameSize(f, 300, 300); }

  visualize {
    ret northAndCenterWithMargins(dm_bigInputAndSubmit('typingText, "Split", rThread { setText(typingText) }),
      fontSizePlus(5, dm_centeredLabel('html)));
  }
  
  void setText(S text) enter {
    setField(+text);
    NavigableSet<S> words = asCISet((LS) dm_call(dm_actualWordsCRUD(), 'actualWords));
    new LS out;
    S s = text;
    for (S part : prefixesInCISet(words, s))
      out.add(part + " " + unicode_middleDot() + " " + substring(s, l(part)));
    sortByCalculatedFieldDesc_inPlace(out, func(S s) -> bool { contains(words, afterLastSpace(s)) });
    setField(html := jlabel_textAsHTML_center(lines_rtrim(out));
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1021130
Snippet name: Word Auto-Splitter [splits once]
Eternal ID of this version: #1021130/14
Text MD5: d75bb0a12b020c9e04411577ae157e74
Transpilation MD5: c18ef026115583fc550da3fb91237311
Author: stefan
Category: javax / stefan's os / nlp
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-23 16:26:13
Source code size: 779 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 246 / 1328
Version history: 13 change(s)
Referenced in: [show references]