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

62
LINES

< > BotCompany Repo | #1023778 // "My name is John" [pronoun resolution, dev.]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (11902L/67K).

1  
!7
2  
3  
// Text + questions from https://lingua.com/english/reading/john/
4  
5  
cmodule John > DynPrintLog {
6  
  transient ReadingComprehensionTest test;
7  
  switchable S text = [[
8  
    
9  
    Hi! Nice to meet you! My name is John Smith. I am 19 and a student in college. I go to college in New York. My favorite courses are Geometry, French, and History. English is my hardest course. My professors are very friendly and smart. It’s my second year in college now. I love it!
10  
    
11  
    I live in a big house on Ivy Street. It’s near the college campus. I share the house with three other students. Their names are Bill, Tony, and Paul. We help each other with homework. On the weekend, we play football together.
12  
    
13  
    I have a younger brother. He just started high school. He is 14 and lives with my parents. They live on Mulberry Street in Boston. Sometimes they visit me in New York. I am happy when they visit. My Mom always brings me sweets and candy when they come. I really miss them, too!    
14  
    
15  
    Question 1:
16  
    Where does John Smith go to college?
17  
    1 Berlin    2 Boston
18  
    3 New York  4 Paris
19  
    
20  
    Question 2:
21  
    What is John Smith’s hardest course?
22  
    1 Art   2 English
23  
    3 Math  4 French
24  
    
25  
    Question 3:
26  
    Who shares a house with John Smith?
27  
    1 Anna, Margaret, and Tanya 2 Bill, John, and Tom
28  
    3 Frank, Tony, and Mike     4 Bill, Tony, and Paul
29  
    
30  
    Question 4:
31  
    How old is John Smith’s younger brother?
32  
    1 fourteen  2 eleven
33  
    3 seven     4 thirteen
34  
    
35  
    Question 5:
36  
    What does John Smith’s Mom bring him when they visit?
37  
    1 Candy and ice cream 2 Fruits and vegetables
38  
    3 Sweets and candy    4 Flowers and coffee
39  
40  
  ]];
41  
  
42  
  start-thread {
43  
    test = ai_parseReadingComprehensionTest_v1(text, printText := false);
44  
    LS sentences = switcheroo_iToSpeakersName(test.sentences);
45  
    
46  
    pnl(sentences);
47  
    Set<S> brw = ai_backReferencingWords();
48  
    FullPhraseCache nounStash = fullPhraseCache(ai_nounsAndNounPhrases());
49  
    for (S s : sentences) {
50  
      LS tok = wordTok(s);
51  
      L<Int> indices = indicesOfCodeTokensContainedInSet(tok, brw);
52  
      L<IntRange> nounIndices = fullPhraseCache_intRanges(nounStash, tok);
53  
      LS nouns = map_curry joinSubList_intRange(tok, nounIndices);
54  
      print(sfu(nouns) + " | " + sfu(getIndices(tok, indices)) + " | " + s);
55  
      
56  
    }
57  
    
58  
    for (S s : sentences) {
59  
      //fullPhraseCache_intRanges(mechFullPhraseCache(sentences));
60  
    }
61  
  }
62  
}

Author comment

Began life as a copy of #1023755

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023778
Snippet name: "My name is John" [pronoun resolution, dev.]
Eternal ID of this version: #1023778/15
Text MD5: a385de723ddb3af76663b0d844928296
Transpilation MD5: 5e8761991712aa25a20f218dd4e038b1
Author: stefan
Category: javax / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-09 13:10:14
Source code size: 2512 bytes / 62 lines
Pitched / IR pitched: No / No
Views / Downloads: 347 / 711
Version history: 14 change(s)
Referenced in: [show references]