* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download 2630 - Yappie The Parrot
Modern Greek grammar wikipedia , lookup
Germanic weak verb wikipedia , lookup
Macedonian grammar wikipedia , lookup
Navajo grammar wikipedia , lookup
Kannada grammar wikipedia , lookup
Swedish grammar wikipedia , lookup
American Sign Language grammar wikipedia , lookup
Esperanto grammar wikipedia , lookup
Chinese grammar wikipedia , lookup
French grammar wikipedia , lookup
Portuguese grammar wikipedia , lookup
Old English grammar wikipedia , lookup
Ukrainian grammar wikipedia , lookup
Serbo-Croatian grammar wikipedia , lookup
Lexical semantics wikipedia , lookup
Japanese grammar wikipedia , lookup
Modern Hebrew grammar wikipedia , lookup
Russian grammar wikipedia , lookup
Ancient Greek grammar wikipedia , lookup
Kagoshima verb conjugations wikipedia , lookup
Polish grammar wikipedia , lookup
Yiddish grammar wikipedia , lookup
Icelandic grammar wikipedia , lookup
Georgian grammar wikipedia , lookup
Latin syntax wikipedia , lookup
2630 - Yappie The Parrot Asia - Manila - 2002/2003 Aviabotics Inc. is a company that specializes in smart electronic toys. For this coming Christmas season, Aviabotics plans to rollout its latest electronic pet parrot toy named Yappie. Yappie basically repeats English sentences that it hears, as real parrots would do. For the cheaper version of the toy, only the following English grammar rules are allowed: 1. Subject + Verb To Be (i.e., IS or ARE) + Adjective or Adjective Verb Examples: A perfume is fragrant. Belle is smiling. The rock band members are adulated. 2. Subject + Intransitive Verb Examples: The cat purrs. The snake swallows. A dog barks. 3. Subject + Transitive Verb + Object Examples: The python swallows the cow. The butcher cuts the meat. The cat eats the rat. 4. Subject or Object may contain an adjective and/or an adjective phrase that starts with THAT. Example: The black cat that purrs eats the rat that stinks. 5. The articles THE, A, AN may or may not be used. When a person speaks multiple sentences, Yappie tries to combine statements as much as it can. Sentence combination takes place according to the following rules in decreasing priority: Rule 1. Statements of the form Subject-IS/ARE-Adjective are added into the statement of the form Subject-Transitive Verb-Object. (The order of the adjectives in the combined statement follows the order of the statements from where they come from). Example: The python is humongous. 2630 - Yappie The Parrot 1/4 The cow is spotted. The python swallows the cow. Yappie's Response: The humongous python swallows the spotted cow. Rule 2. Statements of the form Subject-IS/ARE-Adjective are added into the statement of the form Subject-Intransitive Verb. (The order of the adjectives in the combined statement follows the order of the statements from where they come from). Example: The computer is old. The computer crashes. The computer is idiot. Yappie's Response: The old idiot computer crashes. Rule 3. When all statements with common Subject or Object are only of the form Subject-IS/ARE- Adjective, they are all combined into Subject-IS/ARE-Adjective with the last adjective preceded by ``AND". (The order of the adjectives in the combined statement follows the order of the statements from where they come from). Example: The cat is furry. The cat is fat. The cat is dirty. Yappie's Response: The cat is furry, fat, and dirty. Rule 4. When statements are of the form Subject-Transitive Verb-Object, they are combined such that one statement becomes the main sentence, and the other modifies the common Subject or Object by ``THAT". (The first statement that appears becomes the main sentence). Example: The big fish eats the medium fish. The medium fish eats the small fish. The small fish bites the big fish. Yappie's Response: The big fish eats the medium fish that eats the small fish that bites the big fish. Rule 5. Statements of the form Subject-Intransitive Verb are combined into any other statement form by using THAT 2630 - Yappie The Parrot 2/4 Example: The dog bites the cat. The cat purrs. The dog barks. Yappie's Response: The dog that barks bites the cat that purrs. Rule 6. Combinations of statements not stated above are simply repeated. Example: The snake slithers. The snake swallows. Yappie's Response: The snake slithers. The snake swallows. Write a program firmware that can be embedded in Yappie's memory, in time for the Christmas season. Input The input contains only one test case. A series of any number of statements each of which can be either of two types. The first type starts with the keyword `VERBS' followed by a colon (`:') and a list of transitive or intransitive verbs other than ``IS" or ``ARE". The verbs are delimited by a comma (`,'). The second type contains one or more ordinary English statements, terminated by periods (`.'), whose format is as described in the 5 grammar rules. The input always terminates with the word ``END". Output A combined sentence or a group of combined sentences (in any order) whose form follows the results of applying the 6 indicated combination rules. Sample Input VERBS: bites,crashes,purrs VERBS: barks The dog is long-eared. The cat is furry. The computer is idiot. Snakes slither. The rat is small. VERBS: slither The cat is fat. The rat is gray. The dog bites the cat. The rat is stinking. The cat purrs. The computer crashes. The dog barks. The rat is stinking. END 2630 - Yappie The Parrot 3/4 Sample Output The long-eared dog that barks bites the furry fat cat that purrs. The idiot computer crashes. The rat is small, gray, and stinking. Snakes slither. Manila 2002-2003 2630 - Yappie The Parrot 4/4