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

10
LINES

< > BotCompany Repo | #1001921 // replaceWords - replace certain words in an NL sentence

JavaX fragment (include)

sS replaceWords(S s, S... replacements) {
  SS map = litcimap(replacements);
  LS tok = nlTok(s);
  for (int i = 1; i < l(tok); i += 2) {
    S x = map.get(tok.get(i));
    if (x != null)
      tok.set(i, x);
  }
  ret join(tok);
}

Author comment

Began life as a copy of #1001898

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001921
Snippet name: replaceWords - replace certain words in an NL sentence
Eternal ID of this version: #1001921/3
Text MD5: 971cf44418f91f728dbd4de96dffcd25
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-02 21:32:50
Source code size: 240 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 627 / 822
Version history: 2 change(s)
Referenced in: [show references]