EECS348 Assignment 5 Moving from language to representation solved

$35.00

Category: You will receive a download link of the .ZIP file upon Payment

Description

5/5 - (1 vote)

You!will!be!building!a!simple!parser!that!takes!sentences!in!English!as!input!and!
produces!the!queries!that!can!be!handed!to!Ask!to!get!you!the!information!you!need.
You!will!build!a!parser!that!uses!a!file!of!language!patterns!to!make!its!decisions.!!
This!means!that!as!new!patterns!are!added,!you!will!never!make!changes!at!the!code!
level.
You!will!need!to!be!able!to!manage!questions!of!the!following!type:
What%is the%%of%.• What!is!the!color!of!block17?! D>! (color!block17!?x)• What!is!the!shape!of!block17? D> (shape!block17!?x)• What!is!the!size!of!block17? D> (size!block17!?x)• What!is!block17? D> (inst!block17!?x)What%%is .• What!color!is!block17?! D>! (color!block17!?x)What%<object%type>%are%.• What!blocks!are!blue? D> ((inst!?x!block)!(color!?x!blue))!• What!spheres!are!big?! D> ((inst!?x!sphere)!(size!?x!big))What%<object%type>%is .• What!block is blue? D> ((inst!?x!block)!(color!?x!blue))!• What!sphere is big?! D> ((inst!?x!sphere)!(size!?x!big))What%is .• What!is!on!block17? D> (on!?x!block17)• What!is!under!block17? D> (under!?x!block17)• What!is!bigger!than!block17? D> (bigger!?x!block17)Where is%.The!interesting!thing!is!that!an!object!can!be!many!“places.”! If!can!be!ON,!UNDER!or!IN!other!objects!so!you!need!to!look!for!all!of!these.!!D> (on!block17!?x)D> (under!block17!?x)D> (on!block17!?x)And,!the!answers!here!are!going!to!be!full!statements!(on!block17!table)!rather!than!just!a!feature!“blue.”!!And,!there!may!be!multiple!answers!in!that!a!block!may!be!under!another!block!and!on!the!table.The!strategy!here!should!be!to!start!off!with!a!way!to!represent!the!elements!that!you!will!need!to!recognize,!the!pattern(s)!that!you!need!to!build,!and!the!form!of!the!answer.!!For!recognizing!the!pattern!you!could!build!a!simple!grammar:Feature!Question 1:!”What”,!“is”,!FeaturePhrase,!FeaturePrepPhrase.FeaturePhrase:!“the”,!FeatureFeature:!Color|Size|ShapeFeaturePrepPhrase:!“of”,!NameName:!StringAnd!then!state!that!the!query!you!build!will!be:(!!?x)And!the!answer!will!be:?xPulled!together,!the!first!“What” question!would!be:Feature!Question 1:!Pattern:!”What”,!“is”,!FeaturePhrase,!PrepPhrase.Query:!(!!?x)Answer!?xWhile!the!second!would!be:Feature!Question 2:!Pattern:!”What”,!Feature,!“is”,!Name.Query:!(!!?x)Answer!?xSo!once!the!pattern!matches:What!is!the!color!of!block17. Or!What!color!is!block17The!program builds:(color!block17!?x)Once!you!get!your!bindings!than!the!“?x”!can!be!replaced!with!whatever!matched!it.The!goal!is!to!process!a!file!of!questions!and!for!each!one!build!out!the!query!that!will!go!against!your!KB!using!Ask.!!Then!the!bindings!will!be!used!to!instantiate!the!answer.