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

12
LINES

< > BotCompany Repo | #1017497 // ai_askForUnknownWordTypes - uses emit

JavaX fragment (include)

svoid ai_askForUnknownWordTypes(S s) {
  PTElement tree = ai_parseToTreeWithGuessing(s);
  L<S> unknownWords = ai_unknownWordsInSentence(s);
  for (S word : unknownWords) {
    L<PTElement> e = ai_scanParseTreeForWord_all_tighter(tree, word);
    L<S> categories = uniquify(notNulls(mapMethod(e, 'category)));
    if (empty(categories))
      emit("What type of word is " + quote(word) + "?");
    else
      emit("Is " + quote(word) + " " + curlyOpt(textOut_or_orAll_curly(map a(map deAngleBracket(categories)))) + "?");
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017497
Snippet name: ai_askForUnknownWordTypes - uses emit
Eternal ID of this version: #1017497/4
Text MD5: 483ccc110c2783367dc69ec14ae8a37d
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-24 01:41:00
Source code size: 538 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 330 / 376
Version history: 3 change(s)
Referenced in: [show references]