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

14
LINES

< > BotCompany Repo | #1011164 // ai_negateVerb

JavaX fragment (include)

1  
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");
2  
3  
static S ai_negateVerb(S verb) {
4  
  try answer mapGet(ai_negateVerb_map, verb);
5  
  if (endsWithIC(verb, " not")) ret dropSuffixICTrim("not", verb);
6  
  
7  
  // Try first word
8  
  L<S> tok = nlTok(verb);
9  
  S s = mapGet(ai_negateVerb_map, second(tok));
10  
  if (s != null) ret s + joinSubList(tok, 2);
11  
  
12  
  if (isThirdPersonVerb(verb)) ret "doesn't " + verbToBaseForm(verb);
13  
  ret "don't " + verb;
14  
}

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: 402 / 428
Version history: 9 change(s)
Referenced in: [show references]