Generation 5: Artificial Intelligence Repository - Quake 2 AdvAI
Logo

IQATS (Intelligent Question and Answer Test Summarizer)

Author: S. Hsiung.
Platform: MIT-Scheme Environment. (The binaries are native)
Requires: MIT-Scheme 7.4.2+ (R4RS).

iqats.zip Download everything here - binaries, code, documentation.

In A Nutshell

IQATS (Intelligent Question and Answer Test Summarizer) is natural language proccessing program that creates questions and answers given a piece of text (a sentence) through a simple pattern matching algorithm.

IQATS comprises of a context-free parser, a question and learning pattern learning engine, and a question and learning pattern matcher and creator.

Screenshots

IQATS in action (1) (screen01.jpg)
IQATS in action (2) (screen02.jpg)
IQATS in action (3) Learning new Q&A's (screen03.jpg)

Implementation and File Organization of IQATS

File
Description
Parser.scm Contains Parsers 1-3, and data file collection engine and algorithms. As of December this is the largest
Parser.com Compiled parser
Manip.scm Contains understanding, question manipulation engine
Manip.com Learning and pattern matching algorithms created from scratch
Talk.scm A rough make-shift interface for IQATS. Here the user is able to both input sentences for analysis and teach IQATS additional patterns to recognize in generating Q's and A's.
Startup.scm Implements parser.com and manip.com to create parsed sentences for testing (load time is long, approximately 1 minute)
Grammar.dat Contains rudimentary phrase markers for 1st parsing.
Grammar.lst Order for phrase markers to be applied first in grammar.dat
Identify.dat Contains phrase markers that are applied based on the phrase trees from the first parsing for the second parsing.
Identify.lst Order of phrase markers to be applied in identify.dat
Manip.dat Contains the patterns for recognizing sentences.
Manip.lst List of pattern names for all pattern-matching data files
Question.dat Contains whether or not to change the tense of a verb for a pattern
Answer.dat Pattern/order for generating answers (excess of manip.ord)
Manip.ord Pattern/order for generating questions.
Apply.dat Contains phrases for which to start off a question
Semantic.dat Contains data for parsing simple semantics to be used directly for pattern-matching
Semantic.lst List/order for the above.
Iqats.log Contains the log of all entries into talk.scm, possibly to be used to supplement the Case Based Reasoning planner to index successes and failures.

Overview of IQATS

Example

Input: Bill Clinton was the President in 1993

1. ((proper-noun ("Bill")) (proper-noun ("Clinton")) (verb-to-be ("was")) (determiner ("the")) (proper-noun ("President")) (preposition-proximity ("in")) (number ("1993")) (eos ("."))) - Grammar.dat, Grammar.lst.

The first parsing is simple (function: conv-sent-fully), phrase markers such as verb-to-be, determiner, preposition-proximity are listed as categories in Grammar.dat. IQATS searches for the words that are in these categories, then parses them. Those words were chosen to indicate something that would later suggest a question to ask. For example "was" in this case is already semantically defined as something that is designating an object to also be another object. (Note: all data files are in plain-text and can be edited by the user). Phrase markers such as proper-noun, number require another form of identification on parsing. They are procedural based and can only be edited inside the source code. Proper-noun are recognized as words that are not in Grammar.dat but are capitalized.

2. ((noun-phrase (proper-noun ("Bill")) (proper-noun ("Clinton"))) (verb-to-be-phrase (verb-to-be ("was"))) (noun-phrase (determiner ("the")) (proper-noun ("President"))) (preposition-time-phrase (preposition- proximity ("in")) (number ("1993"))) (eos ("."))) - Identify.dat, Identify.lst, (function: group-all-sentence).

In IQATS, a prepositional phrase can contain another prepositional phrase. However this may provide some inconvenience because the pattern matcher only includes 2nd level phrase markers. For example, in the 2nd leaf, we have (proper-noun ("Clinton")) inside a noun-phrase, the noun-phrase would be 2nd level, while 'proper-noun' would be 1st Level, (visualizing it as a tree would be helpful). Notice the distinction of a preposition-time-phrase with just another prepositional phrase. In the data files, phrase-markers from the last parsing as well as this parsing are used to identify with the present parsing. Therefore, order is certainly an issue. Identify.dat also distinguishes phrase leaves which are required, and ones that can be included, but are not necessarily indicators of that marker. This is always the second value under the category (refer to Indentify.dat in the appendix or exhibit). It also has a flexibility factor of 'unknown' words.

3. ((person (noun-phrase (proper-noun ("Bill")) (proper-noun ("Clinton")))) (verb-to-be-phrase (verb-to-be ("was"))) (object (noun-phrase (determiner ("the")) (proper-noun ("President")))) (time (preposition-time- phrase (preposition-proximity ("in")) (number ("1993")))) (eos ("."))). - Semantic.dat, Semantic.lst (function: apply-semantics-sentence).

This parsing is semantic; most of these markers are used directly for pattern matching. For example (cat-listing-basic sentence) would return (person verb-to-be- phrase object time). Note also that there are two types of objects (but not in this case), object and object- minor. Object designates a noun-phrase and object-minor designates a recipient- a prepositional phrase or a direct object.

4. (person verb-to-be-phrase object time) (manip.dat) Question: (verb-to-be-phrase object time) (manip.ord) Answer: (person) (answer.dat). (("Who" "was" "the" "President" "in" "1993" "?") ("Bill" "Clinton")).

(Note: Question words such as who are in apply.dat, IQATS also stores the need to change from past->present tense inside question.dat). All the patterns (above) are stored in data files to be accessed and applied. IQATS first tries to pattern match the sentence, if successful, it will store the name of the pattern in memory to match with the patterns for the question and answer to be applied. By tracing each phrase-marker with their respective words this can easily be seen. This foundation easily gives ground to learning, as should be noted, there are certainly other ways to ask questions from the evidence given by "Bill Clinton was the President in 1993". If IQATS is unable to match the pattern of a specific sentence, or if the user feels another question can also be asked, the user can simply input an appropriate question and answer designated for the sentence. IQATS will learn the pattern and apply it to other sentences with that pattern.

5. Take the previous sentence. Assume that the user wishes that IQATS also ask 'When was Bill Clinton the President?' and answer 'in 1993'. IQATS will parse 'was Bill Clinton the President', leaving 'when' out, by checking for question words in apply.dat. Then it will retrieve the pattern: (verb-to-be-phrase person object), as for the answer: (time), and index them into its memory. IQATS will also check to see if it needs to change tense by comparing if the previous sentence's verbs were past-tense and if the question was not present-tense (question.dat). The next time the user executes IQATS, it will look for the pattern for that particular sentence and find those patterns, listed above (note: more than one question can be generated at a time, no one question overrides another), outputing the appropriate question and answer.

Sample Question and Answers

The following examples consist of LISP/SCHEME data structures (lists). The embedded parsed sentences are followed by their respective question and answers.

The city Abu Dhabi is found in Saudi Arabia

    ((object (noun-phrase (determiner ("The")) (unknown ("city")) (proper-noun ("Abu")) (proper-noun ("Dhabi")))) (verb-to-be-phrase (verb-to-be ("is"))) (object-minor (preposition-phrase (unknown ("found")) (preposition-proximity ("in")) (proper-noun ("Saudi")) (proper-noun ("Arabia")))) (eos (".")))

    (("Where" "is" "The" "city" "Abu" "Dhabi" "?") ("Found" "in" "Saudi" "Arabia")

    ("What" "is" "found" "in" "Saudi" "Arabia" "?") ("The" "city" "Abu" "Dhabi"))

Andrew Jackson became the president because of the election of 1800
    ((person (noun-phrase (proper-noun ("Andrew")) (proper-noun ("Jackson")))) (verb-be ("became")) (object (noun-phrase (determiner ("the")) (unknown ("president")))) (by-reason ("because")) (object-minor (preposition-phrase (preposition-helper ("of")) (determiner ("the")) (unknown ("election")))) (time (preposition-time-phrase (preposition-helper ("of")) (number ("1800")))) (eos (".")))

    (("Why" "did" "Andrew" "Jackson" "became" "the" "president" "?") ("Because" "of" "the" "election" "of" "1800"))

Anions are groups of ions with a negative charge
    ((object (noun-phrase (proper-noun ("Anions")))) (verb-to-be-phrase (verb-to-be ("are"))) (object-minor (preposition-phrase (unknown ("groups")) (preposition-helper ("of")) (unknown ("ions")) (preposition-helper ("with")) (determiner ("a")) (unknown ("negative")) (unknown ("charge")))) (eos (".")))

    (("What" "are" "Anions" "?") ("Groups" "of" "ions" "with" "a" "negative" "charge") ("What" "are" "groups" "of" "ions" "with" "a" "negative" "charge" "?") ("Anions"))

The Civil War occurred from 1861 to 1865
    ((object (noun-phrase (determiner ("The")) (proper-noun ("Civil")) (proper-noun ("War")))) (verb-time-phrase (verb-time ("occurred"))) (time (preposition-time-phrase (preposition-proximity ("from")) (number ("1861")) (preposition-helper ("to")) (number ("1865")))) (eos (".")))

    (("When" "did" "The" "Civil" "War" "occur" "?") ("From" "1861" "to" "1865"))

IQATS v0.8 Alpha released.

Bugs

1. IQATS does not yet distinguish patterns with duplicate phrase markers and will overwrite ones the last of any duplicate phrase marker, with the first. This will be immediately implemented upon the next release.

2. Removing 'Unknown markers from identify.dat may cause IQATS to crash. The reason is yet 'unknown' :)


  • Interview with Roger Schank - Pioneer of CR.
  • An Introduction to NLP Theory.
  • Another Introduction to NLP Theory!
  • Does the Top-Down or Bottom-Up Approach Best Model the Human Brain? - Has CR Theory.
  • IQATS - Intelligent Question Analyser and Test Summarizer.