310 likes | 472 Views
עיבוד שפות טבעיות – שיעור שישי Part of Speech taggers . מדעי המחשב יעל נצר אוניברסיטת בן גוריון. First step for understanding …. תיוג של טקסט הוא צעד ראשון לקראת הבנה של הטקסט. חלק הדיבר של המילה נותן לנו מידע על המילה ועל שכניה – וזה למשל ל: מודלים של שפה, n-grams , זיהוי קול למשל.
E N D
עיבוד שפות טבעיות – שיעור שישיPart of Speech taggers מדעי המחשב יעל נצר אוניברסיטת בן גוריון
First step for understanding… • תיוג של טקסט הוא צעד ראשון לקראת הבנה של הטקסט. • חלק הדיבר של המילה נותן לנו מידע על המילה ועל שכניה – וזה למשל ל: • מודלים של שפה, n-grams , זיהוי קול למשל. • יצירת קול – אופן הביטוי של המילה: • רכבת • רכבת • בסיס לניתוח parsing • שנאמר: identify phrases, identify structure.
זה כבר ראינו: Time flies like an arrow; Fruit flies like a banana. (first flies is a verb, second one is a noun. First like is a comparative conjunction, second like is a verb. )
איך מגדירים חלקי דיבר? • באופן מסורתי, ההגדרה של חלקי הדיבר מבוססת על תכונות מורפולוגיות של המילה או על המילים שמופיעות לידן בסמיכות distributional properties. • באופן עקרוני, יש למילים מאותו חלק דיבר דמיון סמנטי, כלומר, הן מתארות איברים מאותן קבוצות למשל • שמות עצם –nouns אנשים, מקומות, דברים– thought, table, sister • שמות תואר – adjectives תכונות, כמויות big, lazy • לואי פעולה – adverbs – מתארים אופן, מקום, זמן, איכות quickly • פעלים – אירועים, התרחשויות או מצבי קיום – eat, is, write • ויש גם מילות יחס, מילות איחוי ועוד...
חלקי דיבר The yinkish dripner blorked quastofically into the nindin with the pidibs. • yinkish -adj nindin -noun • dripner -noun pidibs -noun • blorked -verb quastofically -adverb • We determine the P.O.S of a word by the affixes that are attached to it and by the syntactic context (where in the sentence) it appears in.
Open class vs. Closed class types • Closed class – הקבוצה שחבריה קבועים בדרך כלל, כמו מילות יחס. • Open class – למשל, שמות עצם ופעלים: מילים חדשות מתווספות לקבוצה to fax, לפקסס • בקורפוסים שונים ייצפו מילים שונות מהקבוצה הפתוחה, אבל אם הקורפוס גדול מספיק, סביר להניח שימצאו בהם אותם מילים השייכות לקבוצה הסגורה. • מילים מהקבוצה הסגורה הן בדרך כלל function words – מילים השייכות לדקדוק כמוof, את – מילים קצרות בדרך כלל המופיעות בתדירות גבוהה, ולהן תפקיד תחבירי חשוב.
Open-class types • שמות עצם – nouns • פעלים – verbs • שמות תואר – adjectives • לואי פעולה – adverbs יש שפות בהן אין שמות תואר, Lakhota :)למשל, ומה שבדרך כלל שם תואר שם הוא פועל.
שמות עצם • Nouns • take -s, 's, -ness, -ment, -er, affixes • Occur with determiners (a the this some..) • can be subject of a sentence. • Semantically: can be concrete –chair, train, or abstract –relationship. • או שמות פעולה, למשל: אכילה, לאכול, pacing
שמות עצם proper, common pronoun • שמות פרטיים Proper nouns • Robert, Jerusalem, • באנגלית, בדרך כלל Capitalized • בדרך כלל אין להם determiners (the jerusalem?) ובדרך כלל מיודעים.
Common nouns • Count nouns – allow grammatical enumeration – plural and singular (book – books), can be counted (one can of beer, 99 cans of beer). • Mass (uncountable) nouns – a conceptualized as a homogeneous group - (milk and honey). Can appear without an article (*two communisms)
Verbs • מילים המתייחסות לפעולות או תהליכים • Main verbs –draw, provide, differ • Auxiliaries (referred to as closed-class) • סיומות אפשריות: • Non-3rd-person-sg eat • 3rd-person-sg eats • progressive eating • past-participleeaten
Adjectives • מבחינה סמנטית, קבוצה הכוללת ביטויים המתארים תכונות או איכויות, משהו כמו פרדיקט חד-מקומי. • שפות רבות כוללות צבעים, גילאים, וערכים. • יש שפות בלי שמות תואר.
Adverbs • קבוצה מעורבת למדי... • Unfortunately, John walked home extremely slowly yesterday • Directional, loative, degree, manner, temporal….
Closed class • Prepositions – on, under, over, near, by, at, from, to, with • Determiners – a, an, the • Pronouns – it, she I, others.. (aren’t these nouns? I think so.) • Conjunctions – and, but, or, as, if, when • Auxiliary verbs – can, may, should, are • Particles – up, down, on, off, in , at, by • Numerals – one, two , second, third
Prepositions and particles. • Prepositions • מופיעים לפני שם עצם • מילים יחסיות – כלומר, לא מופיעות לבד. • יחסי זמן/מקום, אבל לא רק. • Particles • Moral reform is the effort to throw off sleep • מופיעים אחרי פועל, ובפעלים טרנזיטיביים, גם אחרי המושא • The horse went off its truck/The horse went its track off
Articles • a, an, the • מופיעים בתחילה צירוף שמני noun phrase • נפוצים מאוד: מתוך קופרפוס COBUILD המכיל 16M מילים, • The 1,071,676 • a 413,887 • an 59,359
Conjunctions • מאחים שני phrases , צירופים , משפטים, וכו. • Or, and, but מאחים צירופים מאותו סטטוס • Subordinating conjunctions משמשים לאיחוי צירופים מקוננים • I thought that you might like some milk. • I thought – main clause • That you might… - subordinating clause.
Conjunctions • מאחים שני phrases , צירופים , משפטים, וכו. • Or, and, but מאחים צירופים מאותו סטטוס • Subordinating conjunctions משמשים לאיחוי צירופים מקוננים • I thought that you might like some milk. • I thought – main clause • That you might… - subordinating clause.
Preliminaries Tagset The set of possible tags for parts of speech. (size is changing in applications, languages...) A tagset should include the information that is needed for the next steps in the process, and that people can annotate well Brown corpus – 87 tags Penn Treebank – 45 Large: C7 tagset of used to tag the British National Corpus BNC.
Penn Treebank tagset . Tagset of Nouns: • Common nouns: • singular NN child, book • plural NNS children, books • Proper nouns: NNP • Pronoun (closed class) • Personal pronoun: PRP i him me we • Possessive pronoun: PRP$ my his our
Tagset of Verbs • Infinitive: untensed verb usually preceded by "to" or a modal.: VB (to go, to help) • Tensed: • MD modals (closed class): will, can, may.. • VBZ (3rd present singular, ends in -s): she goes, runs, walks.. • VBP (present non-3rd persong we are, they have, you do, i feel • VBD (past tense, ends with -ed or d) we were, they had, wanted, ... • VGB (present participle ends in "ing") going, being, running notecould be adjectives: interesting or nouns: building. • VBN: past participle sent, written, been.
Tagset of adjectives and adverbs Adjectives (modify nouns) • JJ - interesting, yellow, difficult • JJR - comparative form ending in -er (bigger) • JJS - superlatives (most, earliest) • Adverbs (modify others: adjectivs, verbs and adverbs): • RB: quickly, fast, perhaps... • RBR - comparative - faster, later • RBS - superlative - fastest
Tagset of Prepositions and conjunctions: • Prepositions • TO the word to • IN all others that are associated with noun, and subordinating conjunctions (because, like, so...) • Particle: RP - associated with verb covered it up. • Conjunction: CC - coordinating conjunction and, but, or, not..
More tagsets: • Possessive endings: POS 's (John's, students’) • Number - CD two, 152 • Determiner • DT a, every, ... • PDT -PDT pre-determiner (preceding 'the') • Wh-words • WDT - which, that • WP - who, whom, what • WP$ - whose • WRB - when, why , where, who, how
Miscellaneous tagset • Existential "There": there is no way. • Expletive or excmlanation UH hey, oh, mmm • foreign word - FW perestroika • symbols: SYM 2*x=y • list LS
HOW to tag? • ensure people can reproduce tagging • check data • We know that tags will be given in context -- needs some context - simple rules.
Part of speech tagging • תיוג הוא התהליך של השמת חלקי דיבר או סימון לקסיקלי אחר לכל מילה בקורפוס. • תיוג מתבצע בדרך כלל גם על סימני פיסוק • הקלט הוא רצף מילים ו-tagset מהסוג שראינו. • הפלט הוא התיוג הטוב ביותר עבור כל אחת מן המילים. • והבעייה המרכזית, היא – ambiguity
Example VB DT NN Book that flight. VBZ DT NN VB NN Does this flight serve dinner? POS tagger will have to resolve this ambiguity (and hence a kind of a disambiguation task)
אנגלית שפה קלה • באנגלית לרוב המילים יש רק תג בודד • (אבל בעברית כלל וכלל לא) • אולם – גם באנגלית – לחלק גדול מהמילים הנפוצות ביותר יותר מקריאה אחת. • I can can my can • 11.5% מ-Brown Corpus המילים types רב-משמעיות, וכ-40% מה-tokens.
Types in brown corpus Unambiguous (1 tag) 35,340 Ambiguous (2-7) 4,100 2 3,760 3 264 4 61 5 12 6 2 7 1 (still)
ובפעם הבאה: • אבל – 40% מה-tokens רבי המשמעות, קל לבחור את המשמעות האמיתית, בגלל שהאפשרויות של תווים מסוימים הן הרבה יותר סבירות מאשר אחרים. • סוגי מתייגים: • Rule-based • Stochastic