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

!7

// Text + questions from https://lingua.com/english/reading/john/

static ReadingComprehensionTest test;
sS text = [[
    
    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!
    
    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.
    
    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!    
    
    Question 1:
    Where does John Smith go to college?
    1 Berlin    2 Boston
    3 New York  4 Paris
    
    Question 2:
    What is John Smith’s hardest course?
    1 Art   2 English
    3 Math  4 French
    
    Question 3:
    Who shares a house with John Smith?
    1 Anna, Margaret, and Tanya 2 Bill, John, and Tom
    3 Frank, Tony, and Mike     4 Bill, Tony, and Paul
    
    Question 4:
    How old is John Smith’s younger brother?
    1 fourteen  2 eleven
    3 seven     4 thirteen
    
    Question 5:
    What does John Smith’s Mom bring him when they visit?
    1 Candy and ice cream 2 Fruits and vegetables
    3 Sweets and candy    4 Flowers and coffee

  ]];
  
p-exp {
  mechCacheTimeInfinite();
  test = ai_parseReadingComprehensionTest_v1(text, printText := false);
  LS sentences = switcheroo_iToSpeakersName(test.sentences);
  
  //pnl(sentences);
  
  for (S s : sentences) {
    print_nlBefore("Parsing: " + s);
    new AI_BottomUpParser1 parser;
    set ai_parseTree_makeWeights_verbose;
    //parser.maxDepth = 10;
    parser.afterIteration = r {
      //if ((parser.iterations % 10) == 0)
        print("Iterations: " + parser.iterations + ", changes: " + parser.changes);
    };
    ai_printParseTree(ai_parseToCulledTree(s, parser));
  }
}

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: 357 / 1215
Version history: 17 change(s)
Referenced in: [show references]