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

25
LINES

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

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

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

1  
!7
2  
3  
static L<S> guessCategories = ll("<noun>", "<verb>", "<adjective>");
4  
5  
p-exp {
6  
  S word = "GKHJGLF";
7  
  S sentence = "What is " + word + "?";
8  
  PTElement tree = ai_parseBottomUpToTree(sentence);
9  
  print(tree);
10  
  assertNull(tree);
11  
  
12  
  L<S> words = ai_uncategorizedWordsInSentence(sentence);
13  
  print("Have " + n2(words, "unknown word"));
14  
  
15  
  for (L<S> combo : allCombinations(rep(guessCategories, l(words)))) {
16  
    new AI_BottomUpParser1 parser;
17  
    parser.wordsToCategories = cloneMap(ai_wordToCategories());
18  
    L<PairS> zipped = zipTwoListsToPairs(words, combo);
19  
    for (PairS p : zipped)
20  
      parser.wordsToCategories.put(p.a, litciset(p.b));
21  
    PTElement tree2 = ai_parseBottomUpToTree(parser, sentence);
22  
    print(zipped + " => " + tree2);
23  
    parser.printWordsAndGroups();
24  
  }
25  
}

Author comment

Began life as a copy of #1017353

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: #1017450
Snippet name: Test guessing category for unknown word v1 [OK]
Eternal ID of this version: #1017450/11
Text MD5: c595e1215c81aca929f982f40171603a
Transpilation MD5: ac5f4d660d636b101a8400baf3a5ae70
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-22 13:42:03
Source code size: 814 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 287 / 654
Version history: 10 change(s)
Referenced in: [show references]