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

14
LINES

< > BotCompany Repo | #1011164 // ai_negateVerb

JavaX fragment (include)

static SS ai_negateVerb_map = asCaseInsensitiveMap(litorderedmap_bidi("is not", "is", "isn't", "is", "are", "aren't", "am", "am not", "was", "wasn't", "can", "can't");

static S ai_negateVerb(S verb) {
  try answer mapGet(ai_negateVerb_map, verb);
  if (endsWithIC(verb, " not")) ret dropSuffixICTrim("not", verb);
  
  // Try first word
  L<S> tok = nlTok(verb);
  S s = mapGet(ai_negateVerb_map, second(tok));
  if (s != null) ret s + joinSubList(tok, 2);
  
  if (isThirdPersonVerb(verb)) ret "doesn't " + verbToBaseForm(verb);
  ret "don't " + verb;
}

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: #1011164
Snippet name: ai_negateVerb
Eternal ID of this version: #1011164/10
Text MD5: 230b44eac4ad07c5b2f1d2f2f3e5a860
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-01 16:23:55
Source code size: 568 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 471 / 494
Version history: 9 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)