110 likes | 227 Vues
LING/C SC/PSYC 438/538. Lecture 25 Sandiway Fong. Administrivia. Homework 4 Extension due Thursday night Reading JM Chapter 12, also 13. Administrivia. 538 presentations We can’t cover as many topics as we’d like in an introductory class of this sort but I ’d like you to explore more
E N D
LING/C SC/PSYC 438/538 Lecture 25 Sandiway Fong
Administrivia • Homework 4 Extension • due Thursday night • Reading • JM Chapter 12, also 13
Administrivia • 538 presentations • We can’t cover as many topics as we’d like in an introductory class of this sort • but I’d like you to explore more • Select a topic from a chapter (or part of a chapter from the textbook) • Range: chapter 14 through 25 • you can’t pick the same thing as your classmate • First come, first served • Email me your 1st, 2nd and 3rd choices • Present the selected chapter (or part thereof) in class at the end of the semester • produce slides • you’ll be evaluated on the quality of the presentation • how well you communicate the essential ideas/algorithms employed • your understanding of the tradeoffs and limitations etc. • Scheduling • Topic selection: begins now • Time limit: 8 minutes + 2 for questions
FSA Regular Expressions Regular Grammars Recall: Chomsky Hierarchy Diagram from lecture 11 Type-1 = Context-sensitive Type-3 Type-2 = Context-free DCG = Type-0
Definite Clause Grammars • Basic Technology already covered earlier in the course • Review lectures 11—14 • Next homework • Will be on writing a fragment of a grammar
Context-free Definite Clause Grammars • Basically (in DCG format): • LHS --> RHS. • LHS = single non-terminal (context-free restriction) • RHS = a sequence of zero or more terminal or non-terminals (possibly mixed) • cf. the limited possibilities on the RHS for regular grammars • In DCGs • non-terminals may contain extra arguments e.g. np np(NP,Case,Number,Person) • these extra arguments can be to enforce constraints, e.g. agreement, or simply return desired values, e.g. fragment of a parse tree • mechanism can be used to implement grammars more general than type-2
Examples • Type-3 (Regular) • a+b+ • Type-2 (Context-free) not in Type-3 • {anbn|n≥1} • Type-1 (Context-sensitive) not in Type-2 • {anbncn|n≥1}
Review Exercise 1 • Write a definite clause grammar for • {anbncn|n≥1} See Prolog grammar file abc.pl
Review Exercise 2 • Let’s write a context-free grammar that returns parse trees for simple active/passive sentence pairs such as: • John hit a ball/John ate a sandwich • *John hit/John ate • *hit a ball/*ate a sandwich • the ball was hit/the sandwich was eaten • the ball was hit by John/the sandwich was eaten by John • Let’s introduce traces in the case of passives: • [S [NP the ball] [VP [aux was ][VP [V hit] [NPtrace]]]] • [S [NP the ball] [VP [VP [aux was ][VP [V hit] [NPtrace]]][PP [Pby][NP John]]]]
Review Exercise 2 • Note: • need to handle English passive morphology • passive be selects for a V-en Example *was ate (simple past form) was eaten (-en past participle form) • Implementation: • use an extra argument to indicate the verb form • e.g. v(v(ate),past) --> [ate]. v(v(eaten),pastparticiple) --> [eaten].
Review Exercise 2 • Note: • English progressives can be handled along the same lines • e.g. John was eat-ing a sandwich See grammar file english.pl