101035 中文信息处理 Chinese NLP Lecture 8.

Slides:



Advertisements
Similar presentations
Albert Gatt Corpora and Statistical Methods Lecture 11.
Advertisements

Syntactic analysis using Context Free Grammars. Analysis of language Morphological analysis – Chairs, Part Of Speech (POS) tagging – The/DT man/NN left/VBD.
Context-Free Grammars Julia Hirschberg CS 4705 Slides with contributions from Owen Rambow, Kathy McKeown, Dan Jurafsky and James Martin.
Grammars, constituency and order A grammar describes the legal strings of a language in terms of constituency and order. For example, a grammar for a fragment.
GRAMMAR & PARSING (Syntactic Analysis) NLP- WEEK 4.
Probabilistic Parsing Chapter 14, Part 2 This slide set was adapted from J. Martin, R. Mihalcea, Rebecca Hwa, and Ray Mooney.
PCFG Parsing, Evaluation, & Improvements Ling 571 Deep Processing Techniques for NLP January 24, 2011.
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27
Albert Gatt LIN3022 Natural Language Processing Lecture 8.
Parsing with PCFG Ling 571 Fei Xia Week 3: 10/11-10/13/05.
Features and Unification
Introduction to Syntax, with Part-of-Speech Tagging Owen Rambow September 17 & 19.
Unit 1 How do you study for a test ?. 重申目标 ( 1 )学习单词 : specific, memorize, grammmar, differently, frustrate, frustrating, quickly, add ( 2 )掌握短语: ask.
Syntax and Context-Free Grammars CMSC 723: Computational Linguistics I ― Session #6 Jimmy Lin The iSchool University of Maryland Wednesday, October 7,
1 CONTEXT-FREE GRAMMARS. NLE 2 Syntactic analysis (Parsing) S NPVP ATNNSVBD NP AT NNthechildrenate thecake.
Chapter 3: Formal Translation Models
Context-Free Grammar CSCI-GA.2590 – Lecture 3 Ralph Grishman NYU.
11 CS 388: Natural Language Processing: Syntactic Parsing Raymond J. Mooney University of Texas at Austin.
Context Free Grammars Reading: Chap 12-13, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Paul Tarau, based on Rada.
School of something FACULTY OF OTHER School of Computing FACULTY OF ENGINEERING COMP3310 Natural Language Processing Eric Atwell, Language Research Group.
Compiler Construction 1. Objectives Given a context-free grammar, G, and the grammar- independent functions for a recursive-descent parser, complete the.
Context Free Grammars Reading: Chap 12-13, Jurafsky & Martin This slide set was adapted from J. Martin and Rada Mihalcea.
TEORIE E TECNICHE DEL RICONOSCIMENTO Linguistica computazionale in Python: -Analisi sintattica (parsing)
Probabilistic Parsing Reading: Chap 14, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Paul Tarau, based on Rada.
1 Words and rules Linguistics lecture #2 October 31, 2006.
中文信息处理 Chinese NLP Lecture 9.
1 Statistical Parsing Chapter 14 October 2012 Lecture #9.
Natural Language Processing Lecture 6 : Revision.
10/12/2015CPSC503 Winter CPSC 503 Computational Linguistics Lecture 10 Giuseppe Carenini.
GRAMMARS David Kauchak CS159 – Fall 2014 some slides adapted from Ray Mooney.
Chapter 12: FORMAL GRAMMARS OF ENGLISH Heshaam Faili University of Tehran.
A sentence (S) is composed of a noun phrase (NP) and a verb phrase (VP). A noun phrase may be composed of a determiner (D/DET) and a noun (N). A noun phrase.
PARSING David Kauchak CS159 – Spring 2011 some slides adapted from Ray Mooney.
Context Free Grammars Reading: Chap 9, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Rada Mihalcea.
11 Chapter 14 Part 1 Statistical Parsing Based on slides by Ray Mooney.
Page 1 Probabilistic Parsing and Treebanks L545 Spring 2000.
1 LIN6932 Spring 2007 LIN6932 Topics in Computational Linguistics Lecture 6: Grammar and Parsing (I) February 15, 2007 Hana Filip.
Parsing Introduction Syntactic Analysis I. Parsing Introduction 2 The Role of the Parser The Syntactic Analyzer, or Parser, is the heart of the front.
Albert Gatt Corpora and Statistical Methods Lecture 11.
For Wednesday Read chapter 23 Homework: –Chapter 22, exercises 1,4, 7, and 14.
Parsing with Context-Free Grammars for ASR Julia Hirschberg CS 4706 Slides with contributions from Owen Rambow, Kathy McKeown, Dan Jurafsky and James Martin.
CPE 480 Natural Language Processing Lecture 4: Syntax Adapted from Owen Rambow’s slides for CSc Fall 2006.
Chapter 3 Describing Syntax and Semantics
CSA2050 Introduction to Computational Linguistics Parsing I.
PARSING 2 David Kauchak CS159 – Spring 2011 some slides adapted from Ray Mooney.
1 Context Free Grammars October Syntactic Grammaticality Doesn’t depend on Having heard the sentence before The sentence being true –I saw a unicorn.
Grammars Hopcroft, Motawi, Ullman, Chap 5. Grammars Describes underlying rules (syntax) of programming languages Compilers (parsers) are based on such.
Grammars CS 130: Theory of Computation HMU textbook, Chap 5.
CPSC 422, Lecture 27Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27 Nov, 16, 2015.
Natural Language Processing Lecture 14—10/13/2015 Jim Martin.
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Fall 2005-Lecture 3.
GRAMMARS David Kauchak CS457 – Spring 2011 some slides adapted from Ray Mooney.
CSC312 Automata Theory Lecture # 26 Chapter # 12 by Cohen Context Free Grammars.
短语回顾: clean up give out cheer up put off come up with write down put up hand out call up 打扫干净 分发 使高兴起来 推迟;拖延 想出 写下 张贴 把 … 拿出来 打电话.
Section A(1a-2c). Aims and language points: Teaching aims (教学目标) 1. 主要是学习一般过去时的定义,能用一般过去时描述过去发生的事情, 学会使用一般过去时的陈述句,及一般疑问句和答语。 2. 学会使用知道 go, milk, ride,
PARSING David Kauchak CS159 – Fall Admin Assignment 3 Quiz #1  High: 36  Average: 33 (92%)  Median: 33.5 (93%)
Unit 12 My favorite subject is science. Period I.
Chapter 12: Probabilistic Parsing and Treebanks Heshaam Faili University of Tehran.
Roadmap Probabilistic CFGs –Handling ambiguity – more likely analyses –Adding probabilities Grammar Parsing: probabilistic CYK Learning probabilities:
Context Free Grammars. Slide 1 Syntax Syntax = rules describing how words can connect to each other * that and after year last I saw you yesterday colorless.
Natural Language Processing Vasile Rus
Natural Language Processing Vasile Rus
Basic Parsing with Context Free Grammars Chapter 13
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27
CS 388: Natural Language Processing: Statistical Parsing
CS 388: Natural Language Processing: Syntactic Parsing
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 26
David Kauchak CS159 – Spring 2019
David Kauchak CS159 – Spring 2019
Presentation transcript:

101035 中文信息处理 Chinese NLP Lecture 8

句——语法分析(1) Grammatical Analysis (1) 语法分析基础(Basics) 形式语法(Formal grammars) 上下文无关语法(Context-free grammars) 依存语法(Dependency grammar)

语法分析基础 Basics Constituency(句子成分) Grammar, or strictly speaking syntax, is about how words are put together to make sentences. A constituent is a group of words, assuming a certain syntactic role. A constituent stands in certain grammatical relations to other constituents.

Examples of Constituents English noun phrases English noun phrases appear in similar syntactic environments. But an individual word in a noun phrase cannot. Harry the Horse, a high-class spot such as Mindy’s the Broadway coppers, the reason he comes into the Hot Box a high-class spot such as Mindy’s attracts. . . the Broadway coppers love. . . * a high-class attracts. . . * the love. . .

Examples of Constituents Chinese phrases “把……”,“被……” Structural account 老师被迟到的学生逗乐了。= 迟到的学生把老师逗乐了。 ≠ * 老师被迟到的学生被逗乐了。 老师被冤枉的事情传开了。≠ * 冤枉的事情把老师传开了。 = 老师被冤枉的事情被传开了。 电话被监听的老师找到了。= 监听的老师把电话找到了。 = 电话被监听的老师被找到了。

形式语法 Formal Grammars Enumeration The grammar of a language can be the set of all enumerated sentences. We cannot exhaust all possible sentences or deal with new sentences. Rather, we should use recursive language to describe sentences with internal structure.

Regular expressions Symbols of a language (POS) ART(冠词), PRON(代词) N(名词), V(动词), ADJ(形容词), ADV(副词) Combination patterns of the symbols ART+N;ART+N+V;ART+ADJ+N+V Regular expression symbols *: occurs zero or more times ART+ADJ*+N +: occurs 1 or more times ART+ADJ++N ( ): occurs zero or 1 time ART+(ADJ)+N |: disjunctions N | PRON + V

In-Class Exercise Write a regular expression that can describe all the following phrases. 老张是一个环卫工 老张是一个聪明的环卫工。 老张是一个聪明勤劳的环卫工。 他是一个聪明的人。

Rules in a Formal Grammar A set of rules or productions express the ways that symbols of the language can be grouped and ordered together. S(句子), NP(名词短语), VP(动词短语), PP(介词短语) Formal Definition of a Formal Grammar N: a set of non-terminal symbols (or variables) Σ: a set of terminal symbols (disjoint from N) R: a set of rules or productions, each of the form A  β, where A is a nonterminal, β is a string of symbols from the infinite set of strings (Σ ∪N)∗ S: a designated start symbol S  NP VP, NP  Det N, VP  V NP, PP  Prep NP

上下文无关语法 Context-Free Grammars Definition As a kind of formal grammar, Context-Free Grammars (CFGs) are the most commonly used mathematical system for modeling the constituent structure of a language. They are also called Phrase- Structure Grammars.

Parse tree A parse tree is a tree structure that shows how the rules in a CFG are used in a sequence to expand a non-terminal node into terminal nodes. NP → Det Nominal Det → a Nominal → Noun Noun → flight

I prefer a morning flight. An English Example Lexicon I prefer a morning flight.

I prefer a morning flight. An English Example Grammar I prefer a morning flight.

I prefer a morning flight. An English Example Parse Tree I prefer a morning flight.

Chinese Examples

Treebanks A Treebank is a corpus in which every sentence is syntactically annotated with a parse tree. Treebanks are invaluable resources for NLP, especially parsing. The Penn Treebank Project is a representative treebank. Samples from Penn Treebank.

Chomsky Normal Form VP → VBD NP PP VP → VP PP VP -> VBD NP PP* A CFG is in Chomsky Normal Form (CNF) if each production is either of the form A → B C or A → a. That is, the right-hand side of each rule either has two non-terminal symbols or one terminal symbol. Conversion to CNF VP → VBD NP PP VP → VP PP VP -> VBD NP PP*

依存语法 Dependency Grammar Definition It is a kind of grammar where the syntactic structure of a sentence is described purely in terms of words and binary semantic or syntactic relations between these words. Dependency relations are directional. There are no structural levels or non-terminal nodes as in CFG.

A Chinese Example Dependency Tree Dependency Graph 那个小孩喜欢通俗歌曲

Axioms of Dependency Only one constituent in a sentence is independent. All the other constituents in the sentence are dependent on some constituent. No constituent is dependent on two or more other constituents. If A is dependent on B and C is situated between A and B in the sentence, then either C is dependent on A or B, or C is dependent on a constituent between A and B.

Conditions of Dependency Tree Single Type Node: A dependency tree has only terminal nodes and no non-terminal nodes. Single Parent Node: The root node is the only parent node. All the other nodes have only one parent node. Unique Root Node: A dependency tree has only one root node, which governs all the other nodes. Non-overlapping: A dependency tree’s branches cannot overlap with each other. Mutual exclusiveness: The relations of governing and preceding are exclusive. If two nodes have a “governing” relation between them, they cannot have a “preceding” relation.

Dependency Relations There are more than 50 dependency relations in English (Stanford Parser) Dependency relation Meaning Example amod adjectival modifier Sam eats red meat amod(meat, red) dobj direct object She gave me a raise dobj(gave, raise) nsubj nominal subject Clinton defeated Dole nsubj (defeated, Clinton) pcomp prepositional complement They heard about you missing classes pcomp(about, missing) tmod temporal modifier Last night, I swam in the pool tmod(swam, night)

In-Class Exercise Given the sentence The sausage was eaten by his dog, complete the following dependency relations by choosing from the list of {nsubj, amod, dobj, pcomp, tmod}. _____(eat, sausage) _____(eat, dog)

Workers dumped sacks into a bin. Heads and Dependency Syntactic constituents could be associated with a lexical head. N is the head of an NP, V is the head of a VP … Workers dumped sacks into a bin.

Vinken will join the board as a nonexecutive director Nov 29. Heads and Dependency A dependency graph can be automatically derived from a context-free parse by using the head rules. Vinken will join the board as a nonexecutive director Nov 29.

Wrap-Up 语法分析基础 形式语法 依存语法 上下文无关语法 Examples Constituents Treebanks Regular Expressions Symbols and Rules Formal Definition 上下文无关语法 Parse Tree Examples Treebanks 依存语法 Axioms Dependency Tree and Graph Dependency Relations Heads and Dependency