1 Part of Speech tagging Lecture 9 Slides adapted from: Dan Jurafsky, Julia Hirschberg, Jim Martin.

Slides:



Advertisements
Similar presentations
School of something FACULTY OF OTHER School of Computing FACULTY OF ENGINEERING PoS-Tagging theory and terminology COMP3310 Natural Language Processing.
Advertisements

Introduction to Syntax, with Part-of-Speech Tagging Owen Rambow September 17 & 19.
Outline Why part of speech tagging? Word classes
Word Classes and Part-of-Speech (POS) Tagging
Ch 9 Part of Speech Tagging (slides adapted from Dan Jurafsky, Jim Martin, Dekang Lin, Rada Mihalcea, and Bonnie Dorr and Mitch Marcus.) ‏
Chapter 8. Word Classes and Part-of-Speech Tagging From: Chapter 8 of An Introduction to Natural Language Processing, Computational Linguistics, and Speech.
BİL711 Natural Language Processing
Part-of-speech tagging. Parts of Speech Perhaps starting with Aristotle in the West (384–322 BCE) the idea of having parts of speech lexical categories,
Part of Speech Tagging Importance Resolving ambiguities by assigning lower probabilities to words that don’t fit Applying to language grammatical rules.
February 2007CSA3050: Tagging II1 CSA2050: Natural Language Processing Tagging 2 Rule-Based Tagging Stochastic Tagging Hidden Markov Models (HMMs) N-Grams.
Natural Language Processing Lecture 8—9/24/2013 Jim Martin.
Hidden Markov Models IP notice: slides from Dan Jurafsky.
LING 388 Language and Computers Lecture 22 11/25/03 Sandiway FONG.
1 Words and the Lexicon September 10th 2009 Lecture #3.
1 Part of Speech Tagging (Chapter 5) September 2009 Lecture #6.
Part II. Statistical NLP Advanced Artificial Intelligence Part of Speech Tagging Wolfram Burgard, Luc De Raedt, Bernhard Nebel, Lars Schmidt-Thieme Most.
1 CSC 594 Topics in AI – Applied Natural Language Processing Fall 2009/ Part-Of-Speech (POS) Tagging.
 Christel Kemke 2007/08 COMP 4060 Natural Language Processing Word Classes and English Grammar.
CS 4705 Lecture 8 Word Classes and Part-of- Speech (POS) Tagging.
Learning Bit by Bit Hidden Markov Models. Weighted FSA weather The is outside
POS based on Jurafsky and Martin Ch. 8 Miriam Butt October 2003.
LING 388: Language and Computers Sandiway Fong Lecture 23: 11/15.
NLP and Speech 2004 English Grammar
POS Tagging and Context-Free Grammars
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Fall 2005-Lecture 2.
Part of speech (POS) tagging
CMSC 723 / LING 645: Intro to Computational Linguistics November 3, 2004 Lecture 9 (Dorr): Word Classes, POS Tagging (Chapter 8) Intro to Syntax (Start.
Word classes and part of speech tagging Chapter 5.
Albert Gatt Corpora and Statistical Methods Lecture 9.
8. Word Classes and Part-of-Speech Tagging 2007 년 5 월 26 일 인공지능 연구실 이경택 Text: Speech and Language Processing Page.287 ~ 303.
1 POS Tagging: Introduction Heng Ji Feb 2, 2008 Acknowledgement: some slides from Ralph Grishman, Nicolas Nicolov, J&M.
Part II. Statistical NLP Advanced Artificial Intelligence Applications of HMMs and PCFGs in NLP Wolfram Burgard, Luc De Raedt, Bernhard Nebel, Lars Schmidt-Thieme.
Parts of Speech Sudeshna Sarkar 7 Aug 2008.
Lecture 6 POS Tagging Methods Topics Taggers Rule Based Taggers Probabilistic Taggers Transformation Based Taggers - Brill Supervised learning Readings:
CSA2050: Introduction to Computational Linguistics Part of Speech (POS) Tagging II Transformation Based Tagging Brill (1995)
10/24/2015CPSC503 Winter CPSC 503 Computational Linguistics Lecture 6 Giuseppe Carenini.
10/30/2015CPSC503 Winter CPSC 503 Computational Linguistics Lecture 7 Giuseppe Carenini.
Parts of Speech (Lexical Categories). Parts of Speech n Nouns, Verbs, Adjectives, Prepositions, Adverbs (etc.) n The building blocks of sentences n The.
Word classes and part of speech tagging Chapter 5.
CPE 480 Natural Language Processing Lecture 4: Syntax Adapted from Owen Rambow’s slides for CSc Fall 2006.
Speech and Language Processing Ch8. WORD CLASSES AND PART-OF- SPEECH TAGGING.
CSA2050: Introduction to Computational Linguistics Part of Speech (POS) Tagging I Introduction Tagsets Approaches.
Word classes and part of speech tagging 09/28/2004 Reading: Chap 8, Jurafsky & Martin Instructor: Rada Mihalcea Note: Some of the material in this slide.
Natural Language Processing
CSA3202 Human Language Technology HMMs for POS Tagging.
Part-of-speech tagging
Human Language Technology Part of Speech (POS) Tagging II Rule-based Tagging.
1 Computational Lexicology, Morphology and Syntax Course 6 Diana Trandab ă ț Academic year:
Word classes and part of speech tagging. Slide 1 Outline Why part of speech tagging? Word classes Tag sets and problem definition Automatic approaches.
Basic Syntactic Structures of English CSCI-GA.2590 – Lecture 2B Ralph Grishman NYU.
Word classes and part of speech tagging Chapter 5.
Part-of-Speech Tagging CSCI-GA.2590 – Lecture 4 Ralph Grishman NYU.
SI485i : NLP Set 7 Syntax and Parsing. 2 Syntax Grammar, or syntax: The kind of implicit knowledge of your native language that you had mastered by the.
POS TAGGING AND HMM Tim Teks Mining Adapted from Heng Ji.
6/18/2016CPSC503 Winter CPSC 503 Computational Linguistics Lecture 6 Giuseppe Carenini.
Speech and Language Processing SLP Chapter 5. 10/31/1 2 Speech and Language Processing - Jurafsky and Martin 2 Today  Parts of speech (POS)  Tagsets.
1 Natural Language Processing Vasile Rus
Lecture 5 POS Tagging Methods
Lecture 9: Part of Speech
English Basics Mrs.Azzah.
CSCI 5832 Natural Language Processing
CS4705 Part of Speech tagging
CSC 594 Topics in AI – Natural Language Processing
Evaluation Which of the three taggers did best?
Natural Language Processing
PART OF SPEECH TAGGING (POS)
Lecture 6: Part of Speech Tagging (II): October 14, 2004 Neal Snider
Natural Language Processing
Part-of-Speech Tagging Using Hidden Markov Models
Natural Language Processing (NLP)
Presentation transcript:

1 Part of Speech tagging Lecture 9 Slides adapted from: Dan Jurafsky, Julia Hirschberg, Jim Martin

2 Garden path sentences The old dog the footsteps of the young. The cotton clothing is made of grows in Mississippi. The horse raced past the barn fell.

3 What is a word class? Words that somehow ‘behave’ alike: – Appear in similar contexts – Perform similar functions in sentences – Undergo similar transformations

4 Parts of Speech 8 (ish) traditional parts of speech – Noun, verb, adjective, preposition, adverb, article, interjection, pronoun, conjunction, etc – This idea has been around for over 2000 years (Dionysius Thrax of Alexandria, c. 100 B.C.) – Called: parts-of-speech, lexical category, word classes, morphological classes, lexical tags, POS

5 POS examples Nnounchair, bandwidth, pacing Vverbstudy, debate, munch ADJadjectivepurple, tall, ridiculous ADVadverbunfortunately, slowly, Pprepositionof, by, to PROpronounI, me, mine DETdeterminerthe, a, that, those

6 POS Tagging: Definition The process of assigning a part-of-speech or lexical class marker to each word in a corpus: the koala put the keys on the table WORDS TAGS N V P DET

7 POS Tagging example WORDtag theDET koalaN put V the DET keysN onP theDET tableN

8 What is POS tagging good for? Speech synthesis: – How to pronounce “ lead ” ? – INsult inSULT – OBject obJECT – OVERflow overFLOW – DIScountdisCOUNT – CONtent conTENT Parsing – Need to know if a word is an N or V before you can parse Word prediction in speech recognition – Possessive pronouns (my, your, her) followed by nouns – Personal pronouns (I, you, he) likely to be followed by verbs ………

9 Open and closed class words Closed class: a relatively fixed membership – Prepositions: of, in, by, … – Auxiliaries: may, can, will had, been, … – Pronouns: I, you, she, mine, his, them, … – Usually function words (short common words which play a role in grammar) Open class: new ones can be created all the time – English has 4: Nouns, Verbs, Adjectives, Adverbs – Many languages have all 4, but not all! – In Lakhota and possibly Chinese, what English treats as adjectives act more like verbs.

10 Open class words Nouns – Proper nouns (Columbia University, New York City, Sharon Gorman, Metropolitan Transit Center). English capitalizes these. – Common nouns (the rest). German capitalizes these. – Count nouns and mass nouns Count: have plurals, get counted: goat/goats, one goat, two goats Mass: don’t get counted (fish, salt, communism) (*two fishes) Adverbs: tend to modify things – Unfortunately, John walked home extremely slowly yesterday – Directional/locative adverbs (here, home, downhill) – Degree adverbs (extremely, very, somewhat) – Manner adverbs (slowly, slinkily, delicately) Verbs: – In English, have morphological affixes (eat/eats/eaten) – Actions (walk, ate) and states (be, exude)

11 Many subclasses, e.g. – eats/V  eat/VB, eat/VBP, eats/VBZ, ate/VBD, eaten/VBN, eating/VBG,... – Reflect morphological form & syntactic function

12 How do we decide which words go in which classes? Nouns denote people, places and things and can be preceded by articles? But… My typing is very bad. *The Mary loves John. Verbs are used to refer to actions, processes, states – But some are closed class and some are open I will have ed everyone by noon. Adverbs modify actions – Is Monday a temporal adverb or a noun?

13 Closed Class Words Closed class words (Prep, Det, Pron, Conj, Aux, Part, Num) are easier, since we can enumerate them….but – Part vs. Prep George eats up his dinner/George eats his dinner up. George eats up the street/*George eats the street up. – Articles come in 2 flavors: definite (the) and indefinite (a, an)

14 – Conjunctions also have 2 varieties, coordinate (and, but) and subordinate/complementizers (that, because, unless,…) – Pronouns may be personal (I, he,...), possessive (my, his), or wh (who, whom,...) – Auxiliary verbs include the copula (be), do, have and their variants plus the modals (can, will, shall,…)

15 Prepositions from CELEX

16 English particles

17 Conjunctions

18 POS tagging: Choosing a tagset There are so many parts of speech, potential distinctions we can draw To do POS tagging, need to choose a standard set of tags to work with Could pick very coarse tagets – N, V, Adj, Adv. Brown Corpus (Francis & Kucera ‘82), 1M words, 87 tags Penn Treebank: hand-annotated corpus of Wall Street Journal, 1M words, tags Penn Treebank – Commonly used – set is finer grained, Even more fine-grained tagsets exist

19 Penn TreeBank POS Tag set

20 Using the UPenn tagset The/DT grand/JJ jury/NN commented/VBD on/IN a/DT number/NN of/IN other/JJ topics/NNS./. Prepositions and subordinating conjunctions marked IN (“although/IN I/PRP..”) Except the preposition/complementizer “to” is just marked “to”.

21 POS Tagging Words often have more than one POS: back – The back door = JJ – On my back = NN – Win the voters back = RB – Promised to back the bill = VB The POS tagging problem is to determine the POS tag for a particular instance of a word. These examples from Dekang Lin

22 How do we assign POS tags to words in a sentence? – Time flies like an arrow. – Time/[V,N] flies/[V,N] like/[V,Prep] an/Det arrow/N – Time/N flies/V like/Prep an/Det arrow/N – Fruit/N flies/N like/V a/DET banana/N – Fruit/N flies/V like/Prep a/DET banana/N – The/Det flies/N like/V a/DET banana/N

23 How hard is POS tagging? Measuring ambiguity

24 Potential Sources of Disambiguation Many words have only one POS tag (e.g. is, Mary, very, smallest) Others have a single most likely tag (e.g. a, dog) But tags also tend to co-occur regularly with other tags (e.g. Det, N) We can look at POS likelihoods P(t 1 |t n-1 ) to disambiguate sentences and to assess sentence likelihoods

25 Rule-based tagging Start with a dictionary Assign all possible tags to words from the dictionary Write rules by hand to selectively remove tags Leaving the correct tag for each word

26 Start with a dictionary she:PRP promised:VBN,VBD toTO back:VB, JJ, RB, NN the:DT bill:NN, VB Etc… for the ~100,000 words of English

27 Use the dictionary to assign every possible tag NN RB VBNJJVB PRPVBDTOVBDTNN Shepromisedtoback thebill

28 Write rules to eliminate tags Eliminate VBN if VBD is an option when VBN|VBD follows “ PRP” NN RB JJVB PRPVBDTOVBDTNN Shepromisedtoback thebill VBN

29 Sample ENGTWOL Lexicon

30 Stage 1 of ENGTWOL Tagging First Stage: Run words through FST morphological analyzer Example: Pavlov had shown that salivation … PavlovPAVLOV N NOM SG PROPER hadHAVE V PAST VFIN SVO HAVE PCP2 SVO shownSHOW PCP2 SVOO SVO SV thatADV PRON DEM SG DET CENTRAL DEM SG CS salivationN NOM SG

31 Stage 2 of ENGTWOL Tagging Second Stage: Apply NEGATIVE constraints. Example: Adverbial “that” rule – Eliminates all readings of “that” except the one in “It isn’t that odd” Given input: “that” If (+1 A/ADV/QUANT) ;if next word is adj/adv/quantifier (+2 SENT-LIM) ;following which is E-O-S (NOT -1 SVOC/A) ; and the previous word is not a ; verb like “consider” which ; allows adjective complements ; in “I consider that odd” Then eliminate non-ADV tags Else eliminate ADV

32 Statistical Tagging Based on probability theory First we’ll introduce the simple “most- frequent-tag” algorithm: baseline algorithm – Meaning that no one would use it if they really wanted some data tagged – But it’s useful as a comparison

33 Conditional Probability and Tags P(Verb) is probability of randomly selected word being a verb. P(Verb|race) is “what’s the probability of a word being a verb given that it’s the word “race”? Race can be a noun or a verb It’s more likely to be a noun P(Verb|race) == “out of all the times we saw ‘race’, how many were verbs? In Brown corpus, P(Verb|race) = 96/98 =.98

34 Most frequent tag Some ambiguous words have a more frequent tag and a less frequent tag: Consider the word “a” in these 2 sentences: – would/MD prohibit/VB a/DT suit/NN for/IN refund/NN – of/IN section/NN 381/CD (/( a/NN )/)./. Which do you think is more frequent?

35 Counting in a corpus We could count in a corpus The Brown Corpus part of speech tagged at U Penn Counts in this corpus: 21830DT 6NN 3FW

36 The Most Frequent Tag algorithm For each word – Create dictionary with each possible tag for a word – Take a tagged corpus – Count the number of times each tag occurs for that word Given a new sentence – For each word, pick the most frequent tag for that word from the corpus.

37 The Most Frequent Tag algorithm: the dictionary For each word, we said: – Create a dictionary with each possible tag for a word… Q: Where does the dictionary come from? A: One option is to use the same corpus that we use for computing the tags

38 Using a corpus to build a dictionary The/DT City/NNP Purchasing/NNP Department/NNP,/, the/DT jury/NN said/VBD,/, is/VBZ lacking/VBG in/IN experienced/VBN clerical/JJ personnel/NNS … From this sentence, dictionary is: clerical department experienced in is jury …

39 Evaluating performance How do we know how well a tagger does? Say we had a test sentence, or a set of test sentences, that were already tagged by a human (a “Gold Standard”) We could run a tagger on this set of test sentences And see how many of the tags we got right. This is called “Tag accuracy” or “Tag percent correct”

40 Test set We take a set of test sentences Hand-label them for part of speech The result is a “Gold Standard” test set Who does this? – Brown corpus: done by U Penn – Grad students in linguistics Don’t they disagree? – Yes! But on about 97% of tags no disagreements – And if you let the taggers discuss the remaining 3%, they often reach agreement

41 Training and test sets But we can’t train our frequencies on the test set sentences (Why not?) So for testing the Most-Frequent-Tag algorithm (or any other probabilistic algorithm), we need 2 things: – A hand-labeled training set: the data that we compute frequencies from, etc – A hand-labeled test set: The data that we use to compute our % correct.

42 Computing % correct Of all the words in the test set For what percent of them did the tag chosen by the tagger equal the human-selected tag. Human tag set: (“Gold Standard” set)

43 Training and Test sets Often they come from the same labeled corpus! We just use 90% of the corpus for training and save out 10% for testing! Even better: cross-validation – Take 90% training, 10% test, get a % correct – Now take a different 10% test, 90% training, get % correct – Do this 10 times and average

44 Evaluation and rule-based taggers Does the same evaluation metric work for rule-based taggers? Yes! – Rule-based taggers don’t need the training set – But they still need a test set to see how well the rules are working

45 Summary Parts of speech – Tag sets – Rule-based tagging – Statistical tagging – Simple most-frequent-tag baseline – Important Ideas Evaluation: % correct, training sets and test sets Unknown words