Grammar Writing Lecture 7

20
1 Carnegie Mellon School of Computer Science LTI Grammars and Lexicons Copyright © 2007, Carnegie Mellon. All Rights Reserved. Grammar Writing Lecture 7 11-721 Grammars and Lexicons Teruko Mitamura [email protected] www.cs.cmu.edu/~teruko

description

Grammar Writing Lecture 7. 11-721 Grammars and Lexicons. Teruko Mitamura [email protected] www.cs.cmu.edu/~teruko. Schedule: November 28. Q/A on Grammar Writing Project Q/A sessions by TA Equations Finish Japanese Grammar exercise (jpn.gra) Start a new grammar. - PowerPoint PPT Presentation

Transcript of Grammar Writing Lecture 7

Page 1: Grammar Writing Lecture 7

1Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Grammar WritingLecture 7

11-721

Grammars and Lexicons

Teruko Mitamura

[email protected]/~teruko

Page 2: Grammar Writing Lecture 7

2Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Schedule: November 28

• Q/A on Grammar Writing Project

• Q/A sessions by TA

• Equations

• Finish Japanese Grammar exercise (jpn.gra)

• Start a new grammar

Page 3: Grammar Writing Lecture 7

3Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

*UNDEFINED* and *DEFINED*

• The word *UNDEFINED* and *DEFINED* can be used on the right hand side of an equation.

• *UNDEFINED* makes sure that the left hand side of the equation has no value.

• *DEFINED* makes sure that the left hand side of the equation has a value.

((x1 negation) = *UNDEFINED*)

Page 4: Grammar Writing Lecture 7

4Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Assigning Multiple Values• Multiple values can be assigned to a feature.• Use the grater-than sign (>) in place of the equal

sign.• If the following rule applies recursively, the pp-

adjunct function will have several different values at the same time:

(<S> <==> (<S> <PP>) ((x0 = x1) ((x0 pp-adjunct) > x2))) ; This rule should

come last.• Multiple rule is sensitive to rule ordering

Page 5: Grammar Writing Lecture 7

5Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Grammar Exercise (Japanese Grammar)

• Free word-order language• SOV language• Case markers determine grammatical relations (ga, wo, ni, de, etc)• Grammar file: jpn.gra• Test files: jpn-test1.lisp/afs/cs/project/cmt-55/lti/Lab/Modules/GNL-721/2007/

Page 6: Grammar Writing Lecture 7

6Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Japanese Lexicon nichiyoubi (Sunday) nyuuyooku (New York) hoomuran (home run) itta (went) utta (hit-past) Hideki, Ichiro (person’s name) ga (NOM case) wo (ACC case) ni (Time-on) ni (Loc-to) e (Loc-to) de (Loc-at)

Page 7: Grammar Writing Lecture 7

7Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Japanese Examples

Nichiyoubi ni Hideki ga Nyuuyook e itta.Sunday on Hideki NOM New York to go PAST

“Hideki went to New York on Sunday.”

Nichiyoubi ni Nyuuyooku e Hideki ga itta.Hideki ga nichiyoubi ni Nyuuyooku e itta.Hideki ga Nyuuyooku e nichiyoubi ni itta.Nyuuyooku e Hideki ga nichiyoubi ni itta.Nyuuyooku e nichiyoubi ni Hideki ga itta.

Page 8: Grammar Writing Lecture 7

8Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Japanese Examples (2)

Hideki ga Nyuuyooku e ittaNyuuyooku e Hideki ga ittaNichiyoubi ni Nyuuyooku e ittaNyuuyooku e nichiyoubi ni ittaHideki ga nichiyoubi ni ittaNichiyoubi ni Hideki ga ittaHideki ga ittaNyuuyooku e ittaNichiyoubi ni itta

Page 9: Grammar Writing Lecture 7

9Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Japanese Example

Nichiyoubi ni Ichiro ga hoomuran wo utta.Sunday on Ichiro NOM home run ACC hit-PAST

“Ichiro hit a home run on Sunday.”

Page 10: Grammar Writing Lecture 7

10Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Ungrammatical Sentences

• You can’t have two nominatives or accusatives in a sentence. (jpn-test1.lisp)

*Hideki ga nichiyoubi ga itta

*Hideki ga Hideki ga itta

*Hideki ga hoomuran ga utta

*Hideki wo hoomuran wo utta

Page 11: Grammar Writing Lecture 7

11Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Japanese Grammar

• Use of recursive rules

(<S> < == > (<NP> <S>)

(<S> < == > (<V>)

Page 12: Grammar Writing Lecture 7

12Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Recursive Rules

S

NP S

NP S

N P N P V

Hideki ga Nyuuyooku e itta

Page 13: Grammar Writing Lecture 7

13Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Japanese Grammar (2)

• “ni” is ambiguous in Japanese

Time-on, Loc-to

Nichiyoubi ni itta (went on Sunday)

Nyuuyooku ni itta (went to New York)

• “ni” and “e” can be used for Loc-to

Nyuuyooku ni/e itta (went to New York)

Page 14: Grammar Writing Lecture 7

14Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Japanese grammar exercise

• Grammar file: /afs/cs/project/cmt-55/lti/Lab/Modules/GNL721/2007/jpn.gra

• Test file:

jpn-test1.lisp

Page 15: Grammar Writing Lecture 7

15Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Japanese Grammar (2)

• “ni” is ambiguous in Japanese

Time-on, Loc-to

Nichiyoubi ni itta (went on Sunday)

Nyuuyooku ni itta (went to New York)

• “ni” and “e” can be used for Loc-to

Nyuuyooku ni/e itta (went to New York)

Page 16: Grammar Writing Lecture 7

16Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Japanese Grammar (3)

• “de” is Loc-in/Loc-at with action verbs

Nyuuyooku de tabeta (ate in New York)

CMU de tabeta (ate at CMU)

Nyuuyooku de hoomuran wo utta

(hit hoomuran in New York)

Page 17: Grammar Writing Lecture 7

17Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Ungrammatical Sentences (2)

“itta (went)” doesn’t take Loc-at/in “de”

*Nyuuyooku de itta (*went in/at New York)

“tabeta (ate)” doesn’t take Loc-to “ni/e”

*Nyuuyooku ni/e tabeta (*ate to New York)

Time expression doesn’t take Loc-at, Loc-to

*Nichiyoubi de/e itta (*went at/to Sunday)

*Nichiyoubi de/e utta (*hit at/to Sunday)

*Nichiyoubi de/e tabeta (*ate at/to Sunday)

Page 18: Grammar Writing Lecture 7

18Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Ungrammatical Sentences (3)

• Wrong case marker (jpn-test2.lisp) Nyuuyooku ni/e itta (Loc-to) *Nyuuyooku de itta (Loc-at) Nyuuyooku de tabeta (Loc-at) *Nyuuyooku ni/e tabeta (Loc-to) Nichiyoubi ni itta/tabeta (Time-on) *Nichiyoubi de itta/tabeta (Loc-at) *Nichiyoubi e itta/tabeta (Loc-to)

Page 19: Grammar Writing Lecture 7

19Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Japanese grammar exercise

• Grammar file: /afs/cs/project/cmt-55/lti/Lab/Modules/GNL721/2007/jpn.gra

• Test file:

jpn-test2.lisp

• Work on test2 and test-fail2

• Run test1 to see if it is still working

Page 20: Grammar Writing Lecture 7

20Carnegie MellonSchool of Computer Science LTI Grammars and Lexicons

Copyright © 2007, Carnegie Mellon. All Rights Reserved.

Questions?