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)

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

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: 719 / 920
Version history: 2 change(s)
Referenced in: [show references]