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

25
LINES

< > BotCompany Repo | #1017457 // Test guessing category for unknown word v2 [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (11053L/81K).

!7

p-exp {
  S sentence = "This is extrememely smart";
  PTElement tree = ai_parseBottomUpToTree(sentence);
  print(tree);
  assertNull(tree);
  
  L<S> words = ai_uncategorizedWordsInSentence(sentence);
  print("Have " + n2(words, "unknown word"));
  
  new AI_BottomUpParser1 parser;
  parser.wordsToCategories = DerivedMap(ai_wordToCategories());
  Map<S, Map<S, Double>> guessMap = new HashMap; // word -> category-> weight
  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));
  }
  PTElement tree2 = ai_parseBottomUpToTree(parser, sentence);
  ai_printParseTree(tree2);
  print();
  parser.printWordsAndGroups();
}

Author comment

Began life as a copy of #1017450

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: #1017457
Snippet name: Test guessing category for unknown word v2 [OK]
Eternal ID of this version: #1017457/14
Text MD5: d5c0bafb29fff1b4cdac25e02476f309
Transpilation MD5: 82c7bf7a8ad96ee98a700d6cec2b0407
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-23 16:31:44
Source code size: 839 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 477 / 1033
Version history: 13 change(s)
Referenced in: