Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books 88-6801 עיבוד שפות טבעיות - שיעור שבע Tagging, Partial Parsing Context.

Slides:



Advertisements
Similar presentations
School of something FACULTY OF OTHER School of Computing FACULTY OF ENGINEERING Chunking: Shallow Parsing Eric Atwell, Language Research Group.
Advertisements

Syntactic analysis using Context Free Grammars. Analysis of language Morphological analysis – Chairs, Part Of Speech (POS) tagging – The/DT man/NN left/VBD.
Sequence Classification: Chunking Shallow Processing Techniques for NLP Ling570 November 28, 2011.
Chunk Parsing CS1573: AI Application Development, Spring 2003 (modified from Steven Bird’s notes)
March 1, 2009 Dr. Muhammed Al-Mulhem 1 ICS 482 Natural Language Processing Probabilistic Context Free Grammars (Chapter 14) Muhammed Al-Mulhem March 1,
Shallow Parsing CS 4705 Julia Hirschberg 1. Shallow or Partial Parsing Sometimes we don’t need a complete parse tree –Information extraction –Question.
For Monday Read Chapter 23, sections 3-4 Homework –Chapter 23, exercises 1, 6, 14, 19 –Do them in order. Do NOT read ahead.
Albert Gatt LIN3022 Natural Language Processing Lecture 8.
Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books עיבוד שפות טבעיות - שיעור עשר Chart Parsing (cont) Features.
1 SIMS 290-2: Applied Natural Language Processing Marti Hearst Sept 20, 2004.
Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books עיבוד שפות טבעיות - שיעור שמונה Context Free Grammars and.
Introduction to Syntax, with Part-of-Speech Tagging Owen Rambow September 17 & 19.
Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books עיבוד שפות טבעיות - שיעור שישי Viterbi Tagging Syntax עידו.
Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books עיבוד שפות טבעיות - שיעור חמישי POS Tagging Algorithms עידו.
1 CONTEXT-FREE GRAMMARS. NLE 2 Syntactic analysis (Parsing) S NPVP ATNNSVBD NP AT NNthechildrenate thecake.
Machine Learning in Natural Language Processing Noriko Tomuro November 16, 2006.
Artificial Intelligence 2004 Natural Language Processing - Syntax and Parsing - Language Syntax Parsing.
Stochastic POS tagging Stochastic taggers choose tags that result in the highest probability: P(word | tag) * P(tag | previous n tags) Stochastic taggers.
Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books עיבוד שפות טבעיות - שיעור תשע Bottom Up Parsing עידו דגן.
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.
March 2006 CLINT-CS 1 Introduction to Computational Linguistics Chunk Parsing.
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.
Lemmatization Tagging LELA /20 Lemmatization Basic form of annotation involving identification of underlying lemmas (lexemes) of the words in.
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 CPE 480 Natural Language Processing Lecture 5: Parser Asst. Prof. Nuttanart Facundes, Ph.D.
For Friday Finish chapter 23 Homework: –Chapter 22, exercise 9.
October 2005CSA3180: Text Processing II1 CSA3180: Natural Language Processing Text Processing 2 Shallow Parsing and Chunking Python and NLTK NLTK Exercises.
Natural Language Processing Lecture 6 : Revision.
GRAMMARS David Kauchak CS159 – Fall 2014 some slides adapted from Ray Mooney.
10. Parsing with Context-free Grammars -Speech and Language Processing- 발표자 : 정영임 발표일 :
May 2006CLINT-LN Parsing1 Computational Linguistics Introduction Parsing with Context Free Grammars.
Parsing I: Earley Parser CMSC Natural Language Processing May 1, 2003.
CS774. Markov Random Field : Theory and Application Lecture 19 Kyomin Jung KAIST Nov
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.
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.
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.
Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books עיבוד שפות טבעיות - שיעור שבע Partial Parsing אורן גליקמן.
Rules, Movement, Ambiguity
CSA2050 Introduction to Computational Linguistics Parsing I.
Natural Language - General
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.
CS 4705 Lecture 10 The Earley Algorithm. Review Top-Down vs. Bottom-Up Parsers –Both generate too many useless trees –Combine the two to avoid over-generation:
February 2007CSA3050: Tagging III and Chunking 1 CSA2050: Natural Language Processing Tagging 3 and Chunking Transformation Based Tagging Chunking.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
CPSC 422, Lecture 27Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 27 Nov, 16, 2015.
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Spring 2006-Lecture 2.
Natural Language Processing Lecture 14—10/13/2015 Jim Martin.
October 2005CSA3180: Text Processing II1 CSA3180: Natural Language Processing Text Processing 2 Python and NLTK Shallow Parsing and Chunking NLTK Lite.
English Syntax Read J & M Chapter 9.. Two Kinds of Issues Linguistic – what are the facts about language? The rules of syntax (grammar) Algorithmic –
Instructor: Nick Cercone CSEB - 1 Parsing and Context Free Grammars Parsers, Top Down, Bottom Up, Left Corner, Earley.
Chunk Parsing. Also called chunking, light parsing, or partial parsing. Method: Assign some additional structure to input over tagging Used when full.
Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books עיבוד שפות טבעיות - שיעור שמונה Context Free Parsing אורן.
NATURAL LANGUAGE PROCESSING
Natural Language Processing : Probabilistic Context Free Grammars Updated 8/07.
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
CS 388: Natural Language Processing: Syntactic Parsing
Natural Language - General
Parsing and More Parsing
Chunk Parsing CS1573: AI Application Development, Spring 2003
David Kauchak CS159 – Spring 2019
Presentation transcript:

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books עיבוד שפות טבעיות - שיעור שבע Tagging, Partial Parsing Context Free Grammar עידו דגן המחלקה למדעי המחשב אוניברסיטת בר אילן

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Up from bigrams The POS tagging model we described used a history of just the previous tag: P(t i |t 1,…,t i-1 ) ≈ P(t i |t i-1 ) i.e. a First Order Markovian Assumption In this case each state in the HMM corresponds to a POS tag One can build an HMM for POS trigrams P(t i |t 1,…,t i-1 ) ≈ P(t i |t i-2,t i-1 )

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books POS Trigram HMM Model More accurate (also empirically) than a bigram model –He clearly marked –is clearly marked Sparseness problem – smoothing, back-off In such a model the HMM states do NOT correspond to POS tags. Why not 4-grams? –Too many states, not enough data!

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Supervised/Unsupervised Is the HMM based tagging a supervised algorithm? –Yes, because we need a tagged corpus to estimate the transition and emission probabilities (!) What do we do if we don’t have an annotated corpus but, –Have a dictionary –Have an annotated corpus from a different domain and an un-annotated corpus in desired domain.

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Baum-Welch Algorithm also known as the Forward-Backward Algorithm An EM algorithm for HMMs. Maximization by Iterative hill climbing The algorithm iteratively improves the model parameters based on un- annotated training data.

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Baum-Welch Algorithm… Start of with parameters based on the dictionary: –P(w|t) = 1 if t is possible tag for w –P(w|t) = 0 otherwise –Uniform distribution on state transitions This is enough to bootstrap from. Could also be used to tune a system to a new domain. But best results, and common practice, is using supervised estimation

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Completely unsupervised? What if there is no dictionary and no annotated corpus?  Then POS tagging becomes clustering – doesn’t correspond to linguistic POS

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Syntax The study of grammatical relations between words and other units within the sentence. The Concise Oxford Dictionary of Linguistics the way in which linguistic elements (as words) are put together to form constituents (as phrases or clauses) Merriam-Webster Dictionary

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Brackets “I prefer a morning flight” [ S [ NP [ pro I]][ VP [ V prefer][ NP [ Det a] [ Nom [ N morning] [ N flight]]]]]]

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Parse Tree Noun Nom NounDet VerbPronoun Ipreferamorning flight NP S VP

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Parsing The problem of mapping from a string of words to to its parse tree is called parsing.

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Generative Grammar A set of rules which indicate precisely what can be and cannot be a sentence in a language. A grammar which precisely specifies the membership of the set of all the grammatical sentences in the language in question and therefore excludes all the ungrammatical sentences.

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Formal Language Approach The set of all grammatical sentences in a given natural language –In practice – a complete grammar is not available Are natural languages regular?

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books English is not a regular language! a n b n is not regular Look at the following English sentences: –John and Mary like to eat and sleep, respectively. –John, Mary, and Sue like to eat, sleep, and dance, respectively. –John, Mary, Sue, and Bob like to eat, sleep, dance, and cook, respectively. Anti missile missile

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Constituents Certain groupings of words behave as constituents. Constituents are able to occur in various sentence positions: –ראיתי את הילד הרזה –ראיתי אותו מדבר עם הילד הרזה –הילד הרזה גר ממול

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books The Noun Phrase (NP) Examples: –He –Ariel Sharon –The prime minister –The minister of defense during the war in Lebanon. They can all appear in a similar context: ___ was born in Kfar-Malal

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Prepositional Phrases Examples: –the man in the white suit –Come and look at my paintings –Are you fond of animals? –Put that thing on the floor

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Verb Phrases Examples: –He went –He was trying to keep his temper. –She quickly showed me the way to hide.

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Chunking Text chunking is dividing sentences into non- overlapping phrases. Noun phrase chunking deals with extracting the noun phrases from a sentence. While NP chunking is much simpler than parsing, it is still a challenging task to build an accurate and very efficient NP chunker.

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books What is it good for Chunking is useful in many applications: –Information Retrieval & Question Answering –Machine Translation –Preprocessing before full syntactic analysis –Text to speech –…

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books What kind of structures should a partial parser identify? Different structures useful for different tasks: –Partial constituent structure [ NP I] [ VP saw [ NP a tall man in the park]]. –Prosodic segments [I saw] [a tall man] [in the park]. –Content word groups [I] [saw] [a tall man] [in the park].

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Chunk Parsing Goal: divide a sentence into a sequence of chunks. Chunks are non-overlapping regions of a text: –[I] saw [a tall man] in [the park]. Chunks are non-recursive –a chunk can not contain other chunks Chunks are non-exhaustive –not all words must be included in chunks

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Chunk Parsing Examples Noun-phrase chunking: –[I] saw [a tall man] in [the park]. Verb-phrase chunking: –The man who [was in the park] [saw me]. Prosodic chunking: –[I saw] [a tall man] [in the park].

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Chunks and Constituency Constituents: [a tall man in [the park]]. Chunks: [a tall man] in [the park]. Chunks are not constituents –Constituents are recursive Chunks are typically subsequences of Constituents –Chunks do not cross constituent boundaries

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Chunk Parsing: Accuracy Chunk parsing achieves higher accuracy –Smaller solution space –Less word-order flexibility within chunks than between chunks –Better locality: Fewer long-range dependencies Less context dependence –No need to resolve attachment ambiguity –Less error propagation

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Chunk Parsing: Domain Specificity Chunk parsing is less domain specific: Dependencies on lexical/semantic information tend to occur at levels "higher" than chunks: –Attachment –Argument selection –Movement Fewer stylistic differences within chunks

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Chunk Parsing: Efficiency Chunk parsing is more efficient –Smaller solution space –Relevant context is small and local –Chunks are non-recursive –Chunk parsing can be implemented with a finite state machine

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Psycholinguistic Motivations Chunk parsing is psycholinguistically motivated: Chunks as processing units –Humans tend to read texts one chunk at a time – Eye-movement tracking studies Chunks are phonologically marked –Pauses, Stress patterns Chunking might be a first step in full parsing

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Chunk Parsing Techniques Chunk parsers usually ignore lexical content Only need to look at part-of-speech tags Techniques for implementing chunk parsing: –Regular expression matching / Finite State Machines (see next) –Transformation Based Learning –Memory Based Learning –Other tagging-style methods (see further)

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Regular Expression Matching Define a regular expression that matches the sequences of tags in a chunk –A simple noun phrase chunk regexp: ? * * –Chunk all matching subsequences: the/DT little/JJ cat/NN sat/VBD on/IN the/DT mat/NN [the/DT little/JJ cat/NN] sat/VBD on/IN [the/DT mat/NN] –If matching subsequences overlap, the first one or longest one gets priority

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Chunking as Tagging Map Part of Speech tag sequences to {I,O,B}*  I – tag is part of an NP chunk  O – tag is not part of  B – the first tag of an NP chunk which immediately follows another NP chunk  Alternative tags: Begin, End, Outside Example: –Input: The teacher gave Sara the book –Output: I I O I B I

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Chunking State of the Art When addressed as tagging – methods similar to POS tagging can be used –HMM – combining POS and IOB tags –TBL – rules based on POS and IOB tags Depending on task specification and test set: 90-95% for NP chunks

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Homework

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Context Free Grammars Putting the constituents together

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Problems with FS grammars Reasons why finite-state grammars may be inadequate: Cannot represent constituency adequately Cannot represent structural ambiguity Cannot deal with recursion Recursion occurs when an expansion of a non- terminal includes the non-terminal itself, eg.NP containing a PP, which contains an NP

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Context-free grammars A context-free grammar consists of –a lexicon – set of terminals –a set of non-terminals –a set of rules or productions

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books A baby CF grammar for NPs NP  Det Nominal NP  ProperNoun NP  Pronoun Nominal  Noun Nominal  Noun Nominal Det  a Det  the Pronoun  I Noun  flight

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Context-free rules Each context-free rule is of the form: A  γ a single non-terminal symbol  an ordered list of one or more terminals and non-terminals Start symbol S (sentence)

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Context-free grammars CFGs can be used for analyzing or for generating „  “ means: rewrite the symbol on the left with the string of symbols on the right Example: NP  Det Nominal  Det Noun  a Noun  a flight

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Context-free grammars A sequence of rule expansions is called the derivation of a string of words. Formally, a particular CF language is a set of strings which can be derived from a particular CF grammar A derivation is represented by a parse tree

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books The combined baby CFG S  NP VP NP  Pronoun |Det Nominal |ProperNoun Nominal  Noun|Noun Nominal VP  Verb NP | Verb NP PP | Verb PP PP  Preposition NP Noun  flight|flights |trip |morning |... Verb  is |prefer |like|need |want |fly |... Adjective  cheapest|non-stop|first|direct|... Pronoun  me|I |you|it|... ProperNoun  Los Angeles |Chicago |Alaska |... Det  a |the|an |this | these|that|... Preposition  from|to |on |near|... Conjunction  and |or|but|...

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Formal definition of a CFG A context-free grammar is a 4-tuple: –A set of non-terminal symbols N –A set of terminal symbols Σ (disjoint from N) –A set of productions P, each of the form A  α, where A is a non-terminal and α is a string of symbols from the infinite set of strings (Σ  N)* –A designated start symbol S

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books CF language If A  β is a production of P and α and γ are any strings in the set (∑  N)*,we say that αAγ directly derives α β γ, or αAγ  α β γ Derivation is a generalization of direct derivation –Let α1, α2,..., αm be strings in (∑  N)*, m  1, such that α1  α2, α2  α3,..., α(m-1)  αm –we say that α1 derives αm, or α1  * αm

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books CF language The language L(G) generated by a grammar G is the set of strings composed of terminal symbols which can be derived from the designed start symbol S: L(G)= {W| w is in ∑ * and S  * w}

Syllabus Text Books Classes Reading Material Assignments Grades Links Forum Text Books Grammar equivalence Two grammars are strongly equivalent if they generate the same set of strings and if they assign the same phrase structure to each sentence Two grammars are weakly equivalent if they generate the same set of strings but do not assign the same phrase structure to each sentence