;; ;; 11-682 movie-grammar.gra ;; ;; Basic semantic grammar for parsing IMDB questions ;; ;;---------------------------------------------------------- ( <--> () ((x0 = x1))) ;; top-level rules for different question types ( <--> () ((x0 = x1))) ( <--> () ((x0 = x1))) ( <--> () ((x0 = x1))) ( <--> () ((x0 = x1))) ;; rules for actor questions ( <--> ( in ) (((x0 actor) = *query) ((x0 title) = (x4 title)))) ;; rules for time questions ( <--> ( was ) (((x0 year) = *query) ((x0 title) = (x3 title)))) ;; rules for title questions ( <--> ( ) (((x0 title) = *query) ((x0 medium) = (x1 medium)) ((x0 genre) = (x1 genre)) ((x0 actor) = (x3 actor)))) ( <--> ( was in) (((x0 title) = *query) ((x0 genre) = (x1 genre)) ((x0 actor) = (x3 actor)))) ;; rules for director questions ( <--> (who directed ) (((x0 director) = *query) ((x0 title) = (x3 title)))) ( <--> (who directed ) (((x0 director) = *query) ((x0 title) = (x4 title)))) ( <--> (who directed ) (((x0 director) = *query) ((x0 actor) = (x3 actor)))) ( <--> (who directed the actor ) (((x0 director) = *query) ((x0 actor) = (x5 actor)))) ;; actor question verbs ( <--> (was) ((x0 = x1))) ( <--> (were) ((x0 = x1))) ( <--> (%) (((x0 dict) <= (parse-word (x1 value))) ((x0 dict cat) =c V) (*OR* (((x0 dict root) =c "act")) (((x0 dict root) =c "perform")) (((x0 dict root) =c "star"))))) ;; time question verbs ( <--> (%) (((x0 dict) <= (parse-word (x1 value))) ((x0 dict cat) =c V) (*OR* (((x0 dict root) =c "release")) (((x0 dict root) =c "made")) (((x0 dict root) =c "do"))))) ;; title question verbs ( <--> (%) (((x0 dict) <= (parse-word (x1 value))) ((x0 dict cat) =c V) (*OR* (((x0 dict root) =c "star")) (((x0 dict root) =c "have"))))) ;; movie name ( <--> (@CAP %) (((x0 title) <= (get-name (x2 value))))) ;; actor name ( <--> (@CAP %) (((x0 actor) <= (get-name (x2 value))))) ;; actor question WH phrases ( <--> () (((x1 root) =c *who) (x0 = x1))) ( <--> () (((x1 root) =c "actor") (x0 = x1))) ;; time question WH phrases ( <--> () (((x1 root) =c *when) (x0 = x1))) ( <--> () (((x1 root) =c "year") (x0 = x1))) ;; movie title question WH phrases ( <--> () (((x1 root) =c *what) (x0 = x1))) ( <--> () ((*OR* (((x1 root) =c "movie") ((x0 medium) = "movie")) (((x1 root) =c "comedy") ((x0 medium) = "movie") ((x0 genre) = (x1 root))) (((x1 root) =c "drama") ((x0 medium) = "movie") ((x0 genre) = (x1 root))) (((x1 root) =c "thriller") ((x0 medium) = "movie") ((x0 genre) = (x1 root)))) (x0 = x1))) ;; WH words ( <--> (who) (((x0 wh-value) = *+) ((x0 root) = *who) ((x0 agr) = *3-sing) ((x0 type) = *undefined*))) ( <--> (what) (((x0 wh-value) = *+) ((x0 root) = *what) ((x0 type) = *undefined*))) ( <--> (which) (((x0 wh-value) = *+) ((x0 root) = *which) ((x0 type) = *undefined*))) ( <--> (when) (((x0 wh-value) = *+) ((x0 root) = *when) ((x0 type) = *undefined*))) ( <--> ( ) ((*OR* (((x1 root) =c *which)) (((x1 root) =c *what))) (x0 = x2))) ( <--> (%) ((x0 <= (parse-word (x1 value))) ((x0 cat) =c N))) ( <--> (the ) ((*OR* (((x2 root) =c "movie") ((x0 medium) = "movie")) (((x2 root) =c "film") ((x0 medium) = "movie")) (((x2 root) =c "comedy") ((x0 medium) = "movie") ((x0 genre) = (x2 root))) (((x2 root) =c "drama") ((x0 medium) = "movie") ((x0 genre) = (x2 root))) (((x2 root) =c "thriller") ((x0 medium) = "movie") ((x0 genre) = (x2 root)))) (x0 = x2)))