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).

1  
!7
2  
3  
p-exp {
4  
  S sentence = "This is extrememely smart";
5  
  PTElement tree = ai_parseBottomUpToTree(sentence);
6  
  print(tree);
7  
  assertNull(tree);
8  
  
9  
  L<S> words = ai_uncategorizedWordsInSentence(sentence);
10  
  print("Have " + n2(words, "unknown word"));
11  
  
12  
  new AI_BottomUpParser1 parser;
13  
  parser.wordsToCategories = DerivedMap(ai_wordToCategories());
14  
  Map<S, Map<S, Double>> guessMap = new HashMap; // word -> category-> weight
15  
  temp tempSetThreadLocal(ai_getWordToCategoryWeight_map, guessMap);
16  
  for (S word : words) {
17  
    Map<S, Double> map = ai_guessCategoriesForUnknownWord_weighted(word);
18  
    guessMap.put(word, map);
19  
    parser.wordsToCategories.put(word, keys(map));
20  
  }
21  
  PTElement tree2 = ai_parseBottomUpToTree(parser, sentence);
22  
  ai_printParseTree(tree2);
23  
  print();
24  
  parser.printWordsAndGroups();
25  
}

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: 358 / 778
Version history: 13 change(s)
Referenced in: [show references]