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

16
LINES

< > BotCompany Repo | #1017679 // ai_parseToTreeWithGuessing_fromTok - uses pretokenized input [dev.]

JavaX fragment (include)

static PTElement ai_parseToTreeWithGuessing_fromTok(L<S> tok) {
  tok = dropPunctuation(tok);
  L<S> words = ai_uncategorizedWordsInSentence(tok);
  //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, tok);
}

Author comment

Began life as a copy of #1017469

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: #1017679
Snippet name: ai_parseToTreeWithGuessing_fromTok - uses pretokenized input [dev.]
Eternal ID of this version: #1017679/1
Text MD5: fdae03257d9e0600ddfb7643a2fe27c1
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-02 16:25:25
Source code size: 655 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 266 / 290
Referenced in: [show references]