Group Project for AI
Total Page:16
File Type:pdf, Size:1020Kb
Group project for AI
Report Members of the team: Yunsong Meng, Ravi Kiran Reddy Palla and Tae-Won Kim
Overview of the project Our program can be considered to have 4 steps as described below: Step 1: Obtain the logic form of the puzzles Step 2: Extracting “information in terms of the domains” and “information in terms of positive, negative and difficult relationships between different objects of the domains”. This information is extracted from the logic forms using a predefined set of rules (interface.pl). Step 3: Form SMODELS program from the information we extract. Step 4: Run SMODELS and solve the puzzles.
Step 2: The domain description can be obtained by writing English sentences to describe the domains and objects in each domain. Using interface.pl, we can obtain the domain description in the following manner: group(domain1,object1) – This implies the object object1 belongs to the domain domain1.
Ex: group (son, john) – john belongs to the domain son.
The clues in all the puzzles can be divided into 3 categories: (1) positive relationships between objects Ex: The nurse is 60 years old. (2) negative relationships between objects Ex: The policeman is not 50 years old. (3) difficult relationships between objects Ex: The nurse is older than the driver.
The logic form of the english sentences is appended with interface.pl and the resulting file is executed using smodels. According to the above examples, the information extracted is of the following form: posr(nurse,60), negr(policeman,50), diffr(nurse,driver,more,measure).
Difficult relationships: There are eight types of difficult relationships extracted: (1) diffr ( A, B, more, measure ). Ex: The nurse (A) is older than the driver (B). (2) diffr ( A, B, less, measure ). Ex: The nurse (A) is younger than the driver (B). (3) diffr ( A, B, jmore, measure). Ex: The nurse (A) is next older than the driver (B). (4) diffr ( A, B, jless, measure). Ex: The nurse (A) is just younger than the driver (B). (5) diffr ( some, B, more, measure ). Ex: The nurse (B) is not the oldest. (6) diffr ( none, B, more, measure). Ex: The nurse (B) is the oldest. (7) diffr ( some, B, less, measure). Ex: The nurse (B) is not the youngest Group project for AI
(8) diffr ( none, B, less, measure). Ex: The nurse (B) is the youngest.
Please note that exactly one of the domains should contain only numbers as objects in order for such rules to work.
Step 3: Our program then converts the information extracted into a smodels program.
Enumeration: This is done using the domain description obtained: domain1(o11,o12,o13,o14,o15). domain2(o21,o22,o23,o24,o25). domain3(o31,o32,o33,o34,o35). domain4(o41,o42,o43,o44,o45).
1{map(T,D,S,C):domain1(T):domain2(D):domain3(S)}1 :- domain4(C).
:-map(T1,D1,S1,C1),map(T2,D2,S2,C2), domain1(T1;T2), domain2(D1;D2), domain3(S1;S2), domain4(C1;C2),T1==T2,C1!=C2.
:-map(T1,D1,S1,C1),map(T2,D2,S2,C2), domain1(T1;T2), domain2(D1;D2), domain3(S1;S2), domain4(C1;C2),D1==D2,C1!=C2.
:-map(T1,D1,S1,C1),map(T2,D2,S2,C2), domain1(T1;T2), domain2(D1;D2), domain3(S1;S2), domain4(C1;C2),S1==S2,C1!=C2.
Positive relationship Pos(nurse,60). Let nurse belong to domain 3 and 60 to domain 4. posid :- map(T,D,nurse,60), domian1(T), domain2(D). :- not posid
Negative relationship Negr(policeman,50). Let policeman belong to domain 3 and 50 to domain 4. :- map(T,D,policeman,50), domain1(T), domain2(D).
Difficult relationships The difficult relationships can also be converted to rules in smodels. Ex: The nurse is older than the policeman. diffr ( nurse, policeman, more, measure ). Let domain 4 be the measure(age), domain 3 be the occupation(nurse,policeman). The smodels rules will be:
:- map ( T1, D1, nurse, C1), map ( T2, D2, policeman, C2 ), C1 <= C2, domain1(T1;T2), domain2(D1;D2), domain4(C1;C2). Group project for AI
English description in order to obtain the groups and relationships:
Collection of types and their elements (groups)
Addition of sentences and issues:
For collection of types and their elements, we should add in sentences that describe the tables specifically in the form like: “Black_Swan and Eagle and Hecate and Pegasus are Ships” from puzzle 6. Subscript is needed for “Black_Swan” for simplicity and the form is restricted since this is the best way we found that the parser can understand multiple conjunctions. Each element should be capitalized since we only generate rules for objects that have names except for the first noun of sentences.
Look at the example: Input sentence is: “Airleak and Engine_Fault and No_Pilot and Security_Alert are causes.” from puzzle 6, and its logic form returned by parser is: nn(x1,airleak,1). nn(x2,engine_fault,1). ne(x2,othername,1). cc(x7,x1,x2,cc_and,1). nn(x3,no_pilot,1). ne(x3,othername,1). nn(x4,security_alert,1). ne(x4,othername,1). cc(x8,x4,x5,cc_and,1). cc(x9,x7,x8,cc_and,1). nn(x6,cause,1). sr(prd,x6,x9).
LFT form provides a semantic relation named sr(prd, _, _) and we can identify group(cause, airleak ). group(cause, engine_fault ). group(cause, no_pilot ). group(cause, security_alert). directly. Note that even if there is no name for airleak, we generate group(cause, airleak) anyway since it is the first word of the sentence. We have to do it this way because the parser sometimes fails to give name to the first word.
Here, it is interesting to note that the tree structures for multiple conjunctions are actually different for different types of objects. Group project for AI
Collection of positive relationships Changes in the sentences and issues: For positive relations, we tried to reduce the rules on the file (interface.pl). There is some interesting point about the relationship between possession and object naming. EX: Violet Finney’s father was a Publican. (It is from the puzzle 49) Attempt 1) Using underscore between first name and last name Violet_Finney’s father was a Publican. In this case, LFT does not extract the information of possession; pos(x3, x4, s, 1). There is no possession relationship, which is the incorrect meaning in the sentence. Attempt 2) Using space between the first name and the last name Violet Finney’s father was a Publican. In this case, LFT recognizes possession relationship and extracts it, but we need to add extra rules for possession compared to other puzzles whose object names are a kind of animals. For instance, Perdita’s home is in one of the posh houses in Chapel Lane. Perdita is a name of cats which does not have a last name. (It is from the puzzle 29). Its LFT form is different from the sentence in Attempt 2. Attempt 3) Removing the last name Violet’s father was a Publican. In this case, LFT extracts the possession relationship. In addition to this, we do not make additional rules because of the reason to Attempt 2. Hence, we only wrote the first name of a full name which is relation to possession in a sentence.
Collection of negative relationships
Changes in the sentences and issues: For negative relations, we try to generalize the rule as much as possible. As a result, some expressions stated in the clues are not allowed. EX: the sentence “The service to Terra Nova wasn’t the one delayed because the ship’s pilot failed to turn up for duty” is changed to “The service to Terra_Nova” wasn’t the one with No_Pilot” since the parser will get incorrect result when structure of sentence is complicate. Specially, we have a preference on the form “Subject + Verb + Object” for simplicity reason, but we can also deal with other forms as well. Since negative relations have very special occurrences in logic form (We preprocess it into not_vb(x, y, z).), it can be easily recognized and would never affect other translations.
Collection of difficult relationships The English sentences from which difficult rules are identified are generally of the form: “ object1 …. relation object2 “ (Ex: The nurse is taller than the policeman) Group project for AI
or “ object1 … relation domain ….verb….object2”(Ex: A should have left before the flight delayed by an air leak) where relation describes object1’s relation with object2. The relation is generally one of “older than”, “taller than”, “shorter than”, “next longer than”, “below”, “above”, “after”, “before”, “just before”, etc.
The logic form depends on the structure of the sentence. For Ex: (1) Tracy looks after fewer children than Helen (2) Tracy looks after fewer children than the number of children looked after by Helen
(1) and (2) have different logic forms and so different rules have to be defined in interface.pl
Changes in the sentences and issues:
(1) Some sentences have to be changed in order to identify the objects: Ex: The nurse is taller than the person who cleans windows for a living. The domain description contains window_cleaner. So, the sentence has to be changed to “The nurse is taller than the window_cleaner”
(2) Some sentences have to be changed as the parser cannot understand the meaning of the statement: Ex: The fireman has less number of letters in his name than the policeman.
(3) Some sentences have to be changed in order to eliminate “not” in the sentence as the server gives the wrong form Ex: The Red_Lion was not the oldest. This has to be changed to “some pub is older than Red_Lion”.
Conclusion Puzzles of this form generally contain clues defining positive, negative and difficult relationships as described above. Our approach can be used to solve more puzzles of this form by just adding additional rules in interface.pl if the sentences in the new puzzles are not covered by the rules already defined. However, it is possible to reduce the number of rules using more intelligent approaches.