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

59
LINES

< > BotCompany Repo | #1023825 // "My name is John" [parsing all sentences, dev., ext program, OK now]

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

Download Jar. Libraryless. Click here for Pure Java version (14547L/110K).

1  
!7
2  
3  
// Text + questions from https://lingua.com/english/reading/john/
4  
5  
static ReadingComprehensionTest test;
6  
sS text = [[
7  
    
8  
    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!
9  
    
10  
    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.
11  
    
12  
    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!    
13  
    
14  
    Question 1:
15  
    Where does John Smith go to college?
16  
    1 Berlin    2 Boston
17  
    3 New York  4 Paris
18  
    
19  
    Question 2:
20  
    What is John Smith’s hardest course?
21  
    1 Art   2 English
22  
    3 Math  4 French
23  
    
24  
    Question 3:
25  
    Who shares a house with John Smith?
26  
    1 Anna, Margaret, and Tanya 2 Bill, John, and Tom
27  
    3 Frank, Tony, and Mike     4 Bill, Tony, and Paul
28  
    
29  
    Question 4:
30  
    How old is John Smith’s younger brother?
31  
    1 fourteen  2 eleven
32  
    3 seven     4 thirteen
33  
    
34  
    Question 5:
35  
    What does John Smith’s Mom bring him when they visit?
36  
    1 Candy and ice cream 2 Fruits and vegetables
37  
    3 Sweets and candy    4 Flowers and coffee
38  
39  
  ]];
40  
  
41  
p-exp {
42  
  mechCacheTimeInfinite();
43  
  test = ai_parseReadingComprehensionTest_v1(text, printText := false);
44  
  LS sentences = switcheroo_iToSpeakersName(test.sentences);
45  
  
46  
  //pnl(sentences);
47  
  
48  
  for (S s : sentences) {
49  
    print_nlBefore("Parsing: " + s);
50  
    new AI_BottomUpParser1 parser;
51  
    set ai_parseTree_makeWeights_verbose;
52  
    //parser.maxDepth = 10;
53  
    parser.afterIteration = r {
54  
      //if ((parser.iterations % 10) == 0)
55  
        print("Iterations: " + parser.iterations + ", changes: " + parser.changes);
56  
    };
57  
    ai_printParseTree(ai_parseToCulledTree(s, parser));
58  
  }
59  
}

Author comment

Began life as a copy of #1023822

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: #1023825
Snippet name: "My name is John" [parsing all sentences, dev., ext program, OK now]
Eternal ID of this version: #1023825/18
Text MD5: dc53ccdc41e54d163dec5b449a42a50b
Transpilation MD5: 547aba5e56ca2cb23ec49a14ba59c144
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-10 20:30:29
Source code size: 2288 bytes / 59 lines
Pitched / IR pitched: No / No
Views / Downloads: 359 / 1222
Version history: 17 change(s)
Referenced in: [show references]