introduction to parts of speech tagging

27
INTRODUCTION TO PARTS INTRODUCTION TO PARTS OF SPEECH TAGGING OF SPEECH TAGGING

Upload: azra01

Post on 27-Jun-2015

102 views

Category:

Education


0 download

DESCRIPTION

parts of speech tagging,

TRANSCRIPT

Page 1: Introduction to parts of speech tagging

INTRODUCTION TO INTRODUCTION TO PARTS OF SPEECH PARTS OF SPEECH

TAGGINGTAGGING

Page 2: Introduction to parts of speech tagging

DEFINITIONDEFINITIONParts of Speech Tagging is defined Parts of Speech Tagging is defined

as the task of labeling each word in a as the task of labeling each word in a sentence with its appropriate parts of sentence with its appropriate parts of speech. speech. Parts of speech include Parts of speech include nouns, verbs, adverbs, adjectives, nouns, verbs, adverbs, adjectives, pronouns, conjunction and their sub-pronouns, conjunction and their sub-categories.categories.

Page 3: Introduction to parts of speech tagging

Parts of Speech Tagging (POS Tagging or Parts of Speech Tagging (POS Tagging or POST), also called grammatical tagging or POST), also called grammatical tagging or word disambiguation, is the process of word disambiguation, is the process of marking up a word in a text as marking up a word in a text as corresponding to a particular part of speech, corresponding to a particular part of speech, based on both its definition, as well its based on both its definition, as well its context- i.e. relationship with adjacent and context- i.e. relationship with adjacent and related words in a phrase, sentence or related words in a phrase, sentence or paragraph.paragraph.

Page 4: Introduction to parts of speech tagging

• Example:Example:

• Word: Paper, Tag: NounWord: Paper, Tag: Noun

• Word: Go, Tag: VerbWord: Go, Tag: Verb

• Word: Famous, Tag: AdjectiveWord: Famous, Tag: Adjective

etc.etc.

Page 5: Introduction to parts of speech tagging

Example :Example :

The mother kissed the baby The mother kissed the baby on the cheek.on the cheek.

The [AT] mother [NN] kissed [VBD] The [AT] mother [NN] kissed [VBD] the [AT] baby [NN] on [PRP] the the [AT] baby [NN] on [PRP] the [AT] cheek [NN][AT] cheek [NN]

Page 6: Introduction to parts of speech tagging

Example Example • TheThe article article

• MotherMother noun noun

• KissedKissed verb (past tense)verb (past tense)

• TheThe article article

• BabyBaby nounnoun

• OnOn prepositionpreposition

• TheThe articlearticle

• CheekCheek noun.noun.

Page 7: Introduction to parts of speech tagging

• Example (kashmiri)Example (kashmiri)

““kita:b chi table’as peth”kita:b chi table’as peth”

kita:b/ NN chi/ VB table’as/ NN kita:b/ NN chi/ VB table’as/ NN

peth/ PREPpeth/ PREP

Page 8: Introduction to parts of speech tagging

POS Tagging can be done by a human POS Tagging can be done by a human manually or can also be performed by a manually or can also be performed by a computer program which is given the computer program which is given the name of POS Tagger. A simplified form of name of POS Tagger. A simplified form of POS Tagging can be observed in school POS Tagging can be observed in school children, when they are asked to identify children, when they are asked to identify words as nouns, verbs, adjectives etc.words as nouns, verbs, adjectives etc.

Page 9: Introduction to parts of speech tagging

Principle Principle

POS Tagging is harder than just having POS Tagging is harder than just having a list of words and their parts of a list of words and their parts of speech, because some words can speech, because some words can represent more than one parts of speech represent more than one parts of speech at different times. A large percentage at different times. A large percentage of word-forms are ambiguous.of word-forms are ambiguous.

Page 10: Introduction to parts of speech tagging

For example,For example,

“ “The sailor dogs the barmaid”The sailor dogs the barmaid”

Even “dogs”, which is usually Even “dogs”, which is usually thought of as just a plural noun, can thought of as just a plural noun, can also be a verbalso be a verb

Page 11: Introduction to parts of speech tagging

• There are 8 parts of speech viz, noun, verb, article, There are 8 parts of speech viz, noun, verb, article, adverb, conjunction, preposition, interjection, adjective. adverb, conjunction, preposition, interjection, adjective. However there are clearly many more categories and sub-However there are clearly many more categories and sub-categories. For nouns, plural, possessive, and singular categories. For nouns, plural, possessive, and singular forms can be distinguished. In many languages words are forms can be distinguished. In many languages words are also marked for their “case”, grammatical gender, and so also marked for their “case”, grammatical gender, and so on, while verbs are marked for tense, aspect and other on, while verbs are marked for tense, aspect and other things. Linguists distinguish parts of speech to various things. Linguists distinguish parts of speech to various fine degrees, reflecting a chosen tagging system. fine degrees, reflecting a chosen tagging system.

• Eg. NN for singular common nouns,Eg. NN for singular common nouns,• NNS for plural common nouns,NNS for plural common nouns,• NP for singular proper nouns.NP for singular proper nouns.

Page 12: Introduction to parts of speech tagging

POS classesPOS classes• There are two classes for POS :There are two classes for POS : 1. Open classes :- nouns, verbs, adjectives, adverbs, 1. Open classes :- nouns, verbs, adjectives, adverbs,

etc.etc. 2. Closed classes :-2. Closed classes :- a) conjunctions :- and, or, but, etca) conjunctions :- and, or, but, etc b) pronouns:- I, she, him, etcb) pronouns:- I, she, him, etc c) prepositions :- with, on, under, etcc) prepositions :- with, on, under, etc d) determiners :- the, a, an, etcd) determiners :- the, a, an, etc e) auxiliary verbs :- can, could, may etce) auxiliary verbs :- can, could, may etcAnd there are many others.And there are many others.

Page 13: Introduction to parts of speech tagging

TagsetTagsetTagset is the set of tags from which the Tagger is supposed to choose to Tagset is the set of tags from which the Tagger is supposed to choose to

attach to the relevant word.attach to the relevant word.• Every Tagger will be given a standard Tagset. The Tagset may be Every Tagger will be given a standard Tagset. The Tagset may be

coarse such as N (Noun), V (Verb), ADJ (Adjective), ADV (Adverb), coarse such as N (Noun), V (Verb), ADJ (Adjective), ADV (Adverb), PREP (Preposition), CONJ (Conjunction) or fine-grained such as PREP (Preposition), CONJ (Conjunction) or fine-grained such as NNOM (Noun-Nominative), VFIN (Verb Finite), VNFIN (Verb Non-NNOM (Noun-Nominative), VFIN (Verb Finite), VNFIN (Verb Non-finite) and so on. finite) and so on.

• For POS Tagging, there is a need of tag sets so that one may not have For POS Tagging, there is a need of tag sets so that one may not have any problem for assigning one tag for each parts of speech. Some any problem for assigning one tag for each parts of speech. Some examples of Tagset are:examples of Tagset are:

1)1) Brown Corpus Tagset- 87 tagsBrown Corpus Tagset- 87 tags2)2) Penn Treebank Tagset- 45 tagsPenn Treebank Tagset- 45 tags3)3) British National Corpus Tagset- 61 tagsBritish National Corpus Tagset- 61 tags4)4) C7 Tagset- 164 tagsC7 Tagset- 164 tags There are tag sets available which have tags for phrases also.There are tag sets available which have tags for phrases also.

Page 14: Introduction to parts of speech tagging

Tag set exampleTag set examplePenn Treebank Part of Speech Tags (Excluding Punctuation)

1 CC Coordinating conjunction2 CD Cardinal number3 DT Determiner4 EX Existential "there"5 FW Foreign word6 IN Prepostion or subordination conjunction7 JJ Ajective8 JJR Ajective, comparative9 JJS Ajective, superlative10 LS List item marker11 MD Modal12 NN Noun, singular or mass13 NNS Noun, plural14 NP Proper noun, singular15 NPS Proper noun, plural16 PDT Predeterminer17 POS Possessive ending18 PP Personal pronoun19 PPS Possessive pronoun20 RB Adverb21 RBR Adverb, comparative22 RBS Adverb, superlative23 RP Particle24 SYM Symbol25 TO "to"26 UH Interjection27 VB Verb, base form28 VBD Verb, past tense29 VBG Verb, gerun or present participle30 VBN Verb, past particle31 VBP Verb, non-3rd person singular present32 VBZ Verb, 3rd person singular present33 WDT Wh-determiner34 WP Wh-pronoun35 WP$ Possessive Wh-pronoun36 WRB Wh-adverb

Page 15: Introduction to parts of speech tagging

Why is POS Tagging hard?Why is POS Tagging hard?

• POS Tagging , most of the times is POS Tagging , most of the times is ambiguous that’s why one cannot easily find ambiguous that’s why one cannot easily find the right tag for each word. For example, we the right tag for each word. For example, we want to translate the ambiguous sentence.want to translate the ambiguous sentence.

Example :Example :

“ “ Time flies like an arrow ” Time flies like an arrow ”

Page 16: Introduction to parts of speech tagging

• Possibilities :-Possibilities :-

1)1) Time/NN flies/NN like/VB an/AT arrow/NNTime/NN flies/NN like/VB an/AT arrow/NN

2)2) Time/VB flies/NN like/IN an/AT arrow/NNTime/VB flies/NN like/IN an/AT arrow/NN

3)3) Time/NN flies/VBZ like/IN an/AT arrow/NNTime/NN flies/VBZ like/IN an/AT arrow/NN

Here the 3) is most acceptable but see how many Here the 3) is most acceptable but see how many possibilities are there and we don’t know exactly possibilities are there and we don’t know exactly which one to choose. So one who has a good hand in which one to choose. So one who has a good hand in grammar and vocabulary can only make the grammar and vocabulary can only make the difference.difference.

Page 17: Introduction to parts of speech tagging

Methods of POS Tagging Methods of POS Tagging • PARTS OF SPEECH TAGGERPARTS OF SPEECH TAGGER• Parts Of Speech Tagger or POS Tagger is a program that Parts Of Speech Tagger or POS Tagger is a program that

does this job. Taggers use several kinds of information: does this job. Taggers use several kinds of information: dictionaries, lexicons, rules, and so on. Dictionaries have dictionaries, lexicons, rules, and so on. Dictionaries have category or categories of a particular word. That is a word category or categories of a particular word. That is a word may belong to more than one category.may belong to more than one category.

• For example, run is both noun and verb. Taggers use For example, run is both noun and verb. Taggers use probabilistic information to solve this ambiguity.probabilistic information to solve this ambiguity.

• There are mainly two type of Taggers:There are mainly two type of Taggers:• Rule-based and StochasticRule-based and Stochastic• Transformation based tagging (combination of rule- based Transformation based tagging (combination of rule- based

and stochastic methodologies, also called as hybrid tagging).and stochastic methodologies, also called as hybrid tagging).

Page 18: Introduction to parts of speech tagging

Rule-based POS TaggingRule-based POS Tagging• Typical rule based approaches use contextual information Typical rule based approaches use contextual information

to assign tags to unknown or ambiguous words. These to assign tags to unknown or ambiguous words. These rules are often known as context frame rules. As an rules are often known as context frame rules. As an example, a context frame rule might say something like: example, a context frame rule might say something like:

• If an ambiguous/unknown word X is preceded by a If an ambiguous/unknown word X is preceded by a determiner and followed by a noun, tag it as an adjective. determiner and followed by a noun, tag it as an adjective.

det – X- n =X/ adjdet – X- n =X/ adjEg, “the Eg, “the beautifulbeautiful lady” lady”

• In addition to contextual information, many taggers use In addition to contextual information, many taggers use morphological information to aid in the disambiguation morphological information to aid in the disambiguation process. One such rule might be :process. One such rule might be :

If an ambiguous / unknown word ends in an –ing and If an ambiguous / unknown word ends in an –ing and is preceded by an auxiliary verb, label it a verb.is preceded by an auxiliary verb, label it a verb.

eg.” Haneef is eg.” Haneef is doingdoing some work” some work”

Page 19: Introduction to parts of speech tagging

In kashmiri,In kashmiri, “ “if an ambiguous/unknown word X is if an ambiguous/unknown word X is

followed by “un” ,“as” or “an” ,tag it as a followed by “un” ,“as” or “an” ,tag it as a noun.noun.

X’un= X/nounX’un= X/nouneg. eg. JohnJohn’un ghar’e’un ghar’e MahrukhMahrukh’as a:v phone’as a:v phone FarooqFarooq’an kor exam pass.’an kor exam pass.

Page 20: Introduction to parts of speech tagging

• Rule based Taggers assign tags to words in two steps:Rule based Taggers assign tags to words in two steps:1)1) Running the words through a lexicon complete with POS tags Running the words through a lexicon complete with POS tags

and additional morphological and syntactic features attached and additional morphological and syntactic features attached to each entry (word stem or affix) returning a list of tags for to each entry (word stem or affix) returning a list of tags for each word.each word.

2)2) Applying a set of constraints to eliminate all the wrong tags.Applying a set of constraints to eliminate all the wrong tags.• Examples include the TAGGIT program (the first large rule Examples include the TAGGIT program (the first large rule

based Tagger, used context-pattern rules) used to tag the one based Tagger, used context-pattern rules) used to tag the one million word Brown Corpus in 1970’s and the more recent million word Brown Corpus in 1970’s and the more recent Brill Tagger. Brill Tagger.

• TAGGIT used a set of 71 tags and 3300 disambiguation rules. TAGGIT used a set of 71 tags and 3300 disambiguation rules. These rules disambiguated 77% of words in the million-word These rules disambiguated 77% of words in the million-word Brown University corpus.Brown University corpus.

Page 21: Introduction to parts of speech tagging

Stochastic POS Tagging Stochastic POS Tagging

• In stochastic tagging, tags are assigned by a In stochastic tagging, tags are assigned by a computer program (Tagger) on the basis of the computer program (Tagger) on the basis of the probability of a given word having a given tag in a probability of a given word having a given tag in a given context. This probability is calculated from a given context. This probability is calculated from a corpus of word which has already been manually corpus of word which has already been manually tagged (a training corpus). tagged (a training corpus).

• Examples include the Taggers based on the Hidden Examples include the Taggers based on the Hidden Markov Model (HMM), such as the one proposed Markov Model (HMM), such as the one proposed for kashmiri by Mehdi, 2009.for kashmiri by Mehdi, 2009.

Page 22: Introduction to parts of speech tagging

Stochastic POS TaggingStochastic POS Tagging

• 1) Input:- a string of words. 1) Input:- a string of words. • Eg.( Book that flight)Eg.( Book that flight)• 2) Output:- a singe best tag for each word2) Output:- a singe best tag for each word• Eg. ( book/VB that/DT flight/NN )Eg. ( book/VB that/DT flight/NN )• 3) Problem :- resolve ambiguity > disambiguation.3) Problem :- resolve ambiguity > disambiguation.• Eg. Book ( hand me that bookEg. Book ( hand me that book book that flight)book that flight)

Page 23: Introduction to parts of speech tagging

What is POS Tagging What is POS Tagging good for?good for?

OrOrApplications and uses of Applications and uses of

TaggingTaggingPOS Tagging is very important from a computational perspective because it POS Tagging is very important from a computational perspective because it can be considered as a basic step in providing the organized input for any can be considered as a basic step in providing the organized input for any other higher level computational process. However, its uses can be put in other higher level computational process. However, its uses can be put in a more organized way in the following manner;a more organized way in the following manner;

1)POS Tagging is important for language processing because it gives us a 1)POS Tagging is important for language processing because it gives us a significant amount of information about the word and its neighbours.significant amount of information about the word and its neighbours.

Eg. Tagsets distinguish between possessive pronouns (my, your, his, her, Eg. Tagsets distinguish between possessive pronouns (my, your, his, her, its) and personal pronouns ( I, you, he, me) and this distinction can tell a its) and personal pronouns ( I, you, he, me) and this distinction can tell a system, what words are likely to occur in its vicinity. Possessive system, what words are likely to occur in its vicinity. Possessive pronouns are likely to be followed by a noun and personal pronouns by a pronouns are likely to be followed by a noun and personal pronouns by a verb. This can be very useful in most of the language processing models.verb. This can be very useful in most of the language processing models.

Page 24: Introduction to parts of speech tagging

2) The part of speech of a word can also give 2) The part of speech of a word can also give information about the pronunciation of a information about the pronunciation of a particular word.particular word.

eg. the word content (noun) vs contenteg. the word content (noun) vs content

( adjective) are pronounced differently.( adjective) are pronounced differently.

(The noun is pronounced CONtent (The noun is pronounced CONtent

/KON-tent/ and the adjective conTENT /KON-tent/ and the adjective conTENT

/kuhn-TENT/with the capitals indicating /kuhn-TENT/with the capitals indicating stress)stress)

Page 25: Introduction to parts of speech tagging

3) POS Tagging is useful for informational 3) POS Tagging is useful for informational retrieval. Since knowing a word’s part of retrieval. Since knowing a word’s part of speech can help to tell us which speech can help to tell us which morphological affixes it can take.morphological affixes it can take.

4) POS Tagging is also useful in other 4) POS Tagging is also useful in other information retrieval applications because it information retrieval applications because it helps in selection of nouns or other important helps in selection of nouns or other important words from a document.words from a document.

Page 26: Introduction to parts of speech tagging

5) Automatic POS Taggers can also help in building automatic 5) Automatic POS Taggers can also help in building automatic word sense disambiguating algorithms.word sense disambiguating algorithms.

6) Automatic POS Taggers are also used in developing advanced 6) Automatic POS Taggers are also used in developing advanced Automatic Speech Recognition (ASR) language models.Automatic Speech Recognition (ASR) language models.

7) POS are very often used for “partial parsing” eg. For quickly 7) POS are very often used for “partial parsing” eg. For quickly finding names or other phrases for information extraction finding names or other phrases for information extraction applications.applications.

8) In addition to the above uses POS Taggers are very important 8) In addition to the above uses POS Taggers are very important for linguistic research. eg, in finding instances or frequencies for linguistic research. eg, in finding instances or frequencies of a particular construction in a large linguistic of a particular construction in a large linguistic corpus/corpora.corpus/corpora.

Page 27: Introduction to parts of speech tagging

THANK YOUTHANK YOU