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

15
LINES

< > BotCompany Repo | #1017469 // ai_parseToTreeWithGuessing - guesses categories for unknown words

JavaX fragment (include)

static PTElement ai_parseToTreeWithGuessing(S input) {
    L<S> words = ai_uncategorizedWordsInSentence(input);
  //print("Have " + n2(words, "unknown word"));
  
  new AI_BottomUpParser1 parser;
  parser.wordsToCategories = DerivedMap(ai_wordToCategories());
  Map<S, Map<S, Double>> guessMap = new HashMap;
  temp tempSetThreadLocal(ai_getWordToCategoryWeight_map, guessMap);
  for (S word : words) {
    Map<S, Double> map = ai_guessCategoriesForUnknownWord_weighted(word);
    guessMap.put(word, map);
    parser.wordsToCategories.put(word, keys(map));
  }
  ret ai_parseBottomUpToTree(parser, input);
}

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: #1017469
Snippet name: ai_parseToTreeWithGuessing - guesses categories for unknown words
Eternal ID of this version: #1017469/4
Text MD5: 61d1464ac4df6b1be99dceba70be4b57
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-23 16:40:53
Source code size: 621 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 348 / 388
Version history: 3 change(s)
Referenced in: [show references]