Download presentation
Presentation is loading. Please wait.
Published byReynard Bates Modified over 8 years ago
1
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 1 LTI Grammars and Lexicons Grammar Writing Lecture 5 11-721 Grammars and Lexicons Teruko Mitamura teruko@cs.cmu.edu www.cs.cmu.edu/~teruko
2
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 2 LTI Grammars and Lexicons Schedule: November 19, 2007 Review of “bird.gra” Review of “bird2.gra” Character-based Parsing vs. Word-based Parsing Morphology Start a new grammar exercise (4)
3
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 3 LTI Grammars and Lexicons Bird.gra review General Problems Incomplete F-structure Incorrect F-structure Not enough constraints in the rule Unification problems
4
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 4 LTI Grammars and Lexicons Incomplete F-structures Determiner information is missing from f- structure “A bird flies” and “The bird flies” showed the same F-structure ((subj ((agreement 3sg) (number sg) (root bird))) (form present) (agreement 3sg) (root fly))
5
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 5 LTI Grammars and Lexicons Complete F-structure Contains all the necessary grammatical information Be able to reconstruct the original sentence “A bird flies” ((SUBJ ( (NUMBER SG) (AGREEMENT 3SG) (ROOT BIRD) (DET ((NUMBER SG) (DEFINITENESS -) (ROOT A))) )) (FORM PRESENT) (AGREEMENT 3SG) (ROOT FLY)) Some feature structures are redundant
6
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 6 LTI Grammars and Lexicons Incomplete F-structures (2) Grammar problem: ( ( ) ( ((x1 number) = (x2 number)) (x0 = x2) ))
7
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 7 LTI Grammars and Lexicons Not Enough Constraints The singular noun without determiner can become NP. “Bird flies” may parse. ( ( ) ((x0 = x1))) Problem: No constraint for number. ((x1 number) =c pl)
8
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 8 LTI Grammars and Lexicons Be Aware of Unification ( ( ) ((x0 = x1) (x0 = x2))) ( (t h e) (((x0 definiteness) = +))) ( (b i r d) (((x0 root) = bird) ((x0 number) = sg) ((x0 agreement) = 3sg)))
9
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 9 LTI Grammars and Lexicons Be Aware of Unification (cont.) ( ( ) ((x0 = x1) (x0 = x2))) ( (t h e) (((x0 definiteness) = +) ((x0 root) = the))) ( (b i r d) (((x0 root) = bird) ((x0 number) = sg) ((x0 agreement) = 3sg)))
10
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 10 LTI Grammars and Lexicons Frequently Seen Problems Test equations come before Action (x0 = x2) ;action ((x1 agreement) = (x2 agreement)) ;test No “root” info in f-structure When submitted: –Write your full name in the grammar –Write more comments in the grammar –Turn off (dmode 2) or trace Print out the grammar and results files. –lpr –P e.g. lpr –Pshakthi bird.gra
11
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 11 LTI Grammars and Lexicons Review: Bird 2 Grammar Goal: To learn more on unification Some Problems: –Not scalable semantic features ((x0 semclass) = Morris) –Incomplete f-structures –Incorrect f-structures
12
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 12 LTI Grammars and Lexicons Grammar Exercise (3) Test Sentences "A bird flies“ "Birds fly“ "The bird flies“ "The birds fly“ "The cat runs“ "The cats run“ “Morris runs“ “Morris meows“ "Cats meow“ "A cat meows” "The cats meow“ "The penguins run” "A penguin runs"
13
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 13 LTI Grammars and Lexicons Grammar Exercise (3) Test Sentences (fail) "A bird fly" "A birds flies" "Birds flies" "Bird flies" "The bird fly" "The birds flies"
14
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 14 LTI Grammars and Lexicons Test Sentences (fail) "The cat flies" "The cats fly" "The cat run" "A cat meow" “Morris meow" “Morris flies" "The bird meows" "A penguin meows" “Penguins meow" "The penguin flies"
15
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 15 LTI Grammars and Lexicons Semantic Category Bird fly, run, *meow Cat *fly, run, meow Penguin *fly, run, *meow
16
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 16 LTI Grammars and Lexicons Semantic Features (noun) Bird (sem-class bird) Cat (sem-class cat) Penguin (sem-class penguin) --------------------------------- (animate +)
17
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 17 LTI Grammars and Lexicons Semantic Features (verb) Fly ((subj sem-class) = bird) Meow ((subj sem-class) = cat) Run ((subj animate) = +)
18
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 18 LTI Grammars and Lexicons Unification ( (c a t s) (((x0 root) = cat) ((x0 number) = pl) ((x0 animate) = +) ((x0 sem-class) = cat) ((x0 agreement) = pl))) ( (m e o w) (((x0 root) = meow) ((x0 agreement) = pl) ((x0 subj animate) = +) ((x0 subj sem-class) = cat) ((x0 form) = present)))
19
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 19 LTI Grammars and Lexicons Unification ( ( ) (((x1 agreement) = (x2 agreement)) ((x0 subj) = x1) (x0 = x2)))
20
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 20 LTI Grammars and Lexicons Character-based Parsing Morphological rules can be parsed Input string: tabeta eat-past taberu eat-present ( ( r u) ((x0 = x1) ((x0 tense) = present))) ( ( t a) ((x0 = x1) ((x0 tense) = past))) ( (t a b e) (((x0 root) = taberu))
21
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 21 LTI Grammars and Lexicons Japanese morphology tabe-sase-rare-ta eat-caus-pass-past ( (t a b e) (((x0 root) = taberu))) ( ( s a s e) (((x1 pass) = *undefined*) ((x1 tense) = *undefined*) (x0 = x1) ((x0 caus) = +))) ( ( r a r e) (((x1 tense) = *undefined*) (x0 = x1) ((x0 pass) = +))) ( ( t a) ((x0 = x1) ((x0 tense) = past))) Tabeta eat-past Tabe-sase-ta eat-caus-past Tabe-rare-ta eat-pass-past Tabe-sase-rare-ta eat-caus-pass-past *tabe-rare-sase-ta eat-pass-caus-past *tabe-ta-sase-rare eat-past-caus-pass *tabe-ta-rare-sase eat-past-pass-caus *tabe-rare-ta-sase eat-pass-past-caus *tabe-sase-ta-rare eat-caus-past-pass *tabe-rare-sase eat-pass-caus *tabe-ta-sase eat-past-caus
22
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 22 LTI Grammars and Lexicons Word-based Parsing ( (sushi) (((x0 = root) = sushi))) Instead of: ( (s u s h i) (((x0 = root) = sushi))) For parsing: (parse-list list of symbols $) e.g. (parse-list ‘(a bird flies $))
23
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 23 LTI Grammars and Lexicons Grammar Exercise (4) Start grammar exercise (4): mlb.gra Files are in /afs/cs/project/cmt-55/lti/Lab/Modules/ GNL-721/2007/ Test file: mlb-test.lisp
24
Carnegie Mellon School of Computer Science Copyright © 2007, Carnegie Mellon. All Rights Reserved. 24 LTI Grammars and Lexicons Next Class: Nov 26 Return bird2.gra Return Assignment #1 Grammar Writing Project Evaluation Criteria Finish mlb.gra Start a new exercise
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.