657cb36139380736abfa2b458164a311.ppt
- Количество слайдов: 31
עיבוד שפות טבעיות - שיעור רביעי Part of Speech Tagging אורן גליקמן המחלקה למדעי המחשב אוניברסיטת בר אילן 086 -98 1
חלקי-הדיבור • מקובל למנות 9~ קבוצות מילים המכונות "חלקי - דיבור: " • שם עצם, ) (noun שם תואר, ) (adjective כינוי, ) (pronoun שם מספר, ) (numeral פועל, ) (verb תואר הפועל, ) (adverb מלת יחס, ) (preposition מלת חיבור, ) (conjunction מלת קריאה. ) (interjection • אך זו רק חלוקה אחת 086 -98 2
? למה זה טוב parsing • בסיס לניתוח : ( אופן הביטוי של המילה TTS) – • יצירת קול – רכבת/רכבת CONtent/con. TENT, OBJect/obj. ECT, DIScount/dis. COUNT – – זיהוי Chunking/partial parsing/identifing terms • תחבירי לא מלא N-gram models for speech • Information Retrieval , Machine Translation – IR, MT • 3 89 -680
איך מגדירים חלקי דיבר? • באופן מסורתי , ההגדרה של חלקי הדיבר מבוססת על תכונות מורפולוגיות של המילה או על המילים שמופיעות לידן בסמיכות. distributional properties • באופן עקרוני , יש למילים מאותו חלק דיבר דמיון סמנטי , כלומר , הן מתארות איברים מאותן קבוצות למשל – – – שמות עצם –nouns אנשים , מקומות , דברים , – thought, table sister שמות תואר – adjectives תכונות , כמויות big, lazy לואי פעולה – – adverbs מתארים אופן , מקום , זמן , איכות quickly פעלים – אירועים , התרחשויות או מצבי קיום – eat, is, write 4 ויש גם מילות יחס , מילות 086 -98ועוד. . . איחוי
דוגמא 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. 5 89 -680
Open class vs. Closed class types • • – Closed class הקבוצה שחבריה קבועים בדרך כלל , כמו מילות יחס. – Open class למשל , שמות עצם ופעלים : מילים חדשות מתווספות לקבוצה , to fax לפקסס בקורפוסים שונים ייצפו מילים שונות מהקבוצה הפתוחה , אבל אם הקורפוס גדול מספיק , סביר להניח שימצאו בהם אותם מילים השייכות לקבוצה הסגורה. מילים מהקבוצה הסגורה הן בדרך כלל function – words מילים השייכות לדקדוק כמו , of את – מילים קצרות בדרך כלל המופיעות בתדירות גבוהה , ולהן תפקיד תחבירי חשוב. 6 086 -98
• Nouns שמות עצם – take -s, 's, -ness, -ment, -er, affixes – Occur with determiners (a, the, this, some…) – can be a subject of a sentence. • Semantically: can be concrete – chair, train, or abstract – relationship. , eating • או שמות פעולה , למשל : אכילה , לאכול 7 89 -680
Types of Nouns • Proper Nouns: – David, Israel, Microsoft – Aren’t preceded by articles – Capitalized (In English) • Common Nouns: – Count Nouns: • allow grammatical enumeration (book, books) • can be counted (one apple, 50 thoughts) – Mass Nouns: snow, salt, communism, … 8 89 -680
Verbs • מילים המתייחסות לפעולות או תהליכים Main verbs – draw, provide, differ – Auxiliaries (referred to as closed-class) – • מערכת הטיה מורפולוגית eat, eats, eating, eaten – 9 89 -680
Adjectives • מבחינה סמנטית , קבוצה הכוללת ביטויים המתארים תכונות או איכויות , משהו כמו פרדיקט חד-מקומי. • שפות רבות כוללות: – צבעים) (yellow, green – גילאים) (young, old – וערכים). (good, bad • יש שפות בלי שמות תואר. שפות המבוססות על פעלים. כל מיני שפות אינדיאניות. 086 -98 01
Adverbs. . . • קבוצה מעורבת למדי • Unfortunately, John walked home extremely slowly yesterday • • • 11 Directional: sideways, downhill Locative: home, here Degree: extremely, somewhat Manner: slowly, delicately Temporal: yesterday, Monday 89 -680
Closed class • Prepositions – on, under, over, near, by, at, from, to, with • Determiners – a, an, the • Pronouns – it, she I • Conjunctions – and, but, or, as, if, when • Auxiliary verbs – can, may, should, are • Particles – up, down, off, in , at, by • Numerals – one, two , second, third 12 89 -680
. Prepositions and particles • Prepositions on top, by then, with him. . . • • מילות יחס המופיעות לפני שם עצם . • מצינות יחסי זמן/מקום , אבל לא רק • Particles go on, look up, turn down • • מופיעים אחרי פועל , ובפעלים טרנזיטיביים , גם אחרי המושא 13 The horse went off its truck/throw off sleep – *The horse went 89 -680 its track off/throw sleep off –
Articles a, an, the noun phrase מופיעים בתחילה צירוף שמני : this chapter, that page גם שכיחים מאוד בטקסטים 14 89 -680 • •
Conjunctions. צירופים , משפטים , וכו phrases , • מאחים שני מאחים צירופים מאותו סטטוס Or, and, but • ) )סוג משמשים לאיחוי Subordinating conjunctions • צירופים מקוננים • I thought that you might like some milk. – I thought – main clause – That you might… - subordinating clause 15 89 -680
ויש עוד. . . 086 -98 61
Tagsets 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: 146 -tag C 7 tagset of used to tag the British National Corpus BNC. 17 89 -680
Part-Of-Speech Tagging • • • תיוג הוא התהליך של השמת חלקי דיבר או סימון לקסיקלי אחר לכל מילה בקורפוס). (tokenization תיוג מתבצע בדרך כלל גם על סימני פיסוק הקלט הוא רצף מילים ו -tagset מהסוג שראינו. הפלט הוא התיוג הטוב ביותר עבור כל אחת מן המילים. והבעייה המרכזית , היא: – ambiguity – Time flies like an arrow/ fruit flies like a banana – / I can my can אישה נעלה את הדלת. . . 086 -98 81
The Distribution of Tags • Tags follow all the usual frequency-based distributional behavior. • Most word types have only one part of speech. • Of the rest, most have two. Things go pretty much as we'd expect from there on. • Of course, as usual, the most frequently occurring word types tend to have multiple tags. • (As we'll see later in the semester, they also tend to have more meanings). • Therefore while its easy to determine the correct tag for most wordtypes, it isn't neccesarily so easy to tag most texts. 19 89 -680
Word Types in the Brown Corpus Unambiguous (1 tag) Ambiguous (2 -7 tags) 2 tags 3 tags 4 tags 5 tags 6 tags 7 tags 20 35340 4100 3760 264 61 12 2 1 (“still”) 89 -680
State of the Art • A dumb tagger that simply assigns the most common tag to each word achieves ~90% • Best approaches give ~96/97% • This still means that there will be on average one tagging error per sentence • Life is much more difficult if we do not have a lexicon and/or training corpus or if we use a tagger across domains and genres. 21 89 -680
מתייגים • -מבוססי חוקים – קידוד ידני Transformation-based tagging – הסתברותיים Stochastic Tagging - • HMM – Bayesian networks – Maximum entropy – 22 89 -680
מתייגים מבוססי חוקים • בשלב הראשון, מתחוך הלקסיקון כל אחת מהמילים מתויגת ברשימת תגים אפשריים. • בשלב השני התג הסופי מוכרע על פי חוקים לפתירת רב משמעות, כך שהתוצר הסופי הוא תג בודד 086 -98 32
Transformation based tagging • • • 5991 – Brill tagging שילוב של rule-based ושיטות הסתברותיות. לכל מילה , ניתנת הסתברות לתגים האפשריים. המתייג הוא אוסף חוקים , שנלמדו בצורה אוטומטית מתוך אוסף של נתונים. הלימוד הוא , supervised ומניח קיום קורפוס מתויג. 086 -98 42
? איך זה עובד P(NN|race) = 0. 98 P(VB|race)=0. 02 : בצעד הראשון , יתוייג המשפט לפי התג הסביר יותר is/VBZ expected/VBN to/TO race/NN tomorrow the/DT race/NN for/IN outer/JJ space/NN • אחרי הבחירה הראשונית של התג , המתייג מבצעה את : הטרנפורמציות שלמד מהקורפוס – לדוגמא Change NN to VN when the previous tag is TO • - to/TO ב race/NN to/TO • החוק הזה יחליף את race/VB 25 89 -680
אלגוריתם הלימוד – תיוג עם התג הכי סביר – חזור עד תנאי העצירה : Greedy Search • בדיקת כל טרנספורמציה אפשרית • בחירת הטרנספורמציה שנותנת את התוצאות הטובות ביותר )על ידי מדידת המרחק מהאמת) • תיוג מחדש על פי החוק הנבחר – דורש ידיעת ה"תג הנכון" כלומר – למידה מכוונת-מומחה – תוצאת הלמידה היא רשימה מסודרת של טרנספורמציות המהוות "פרוצדורת תיוג" 086 -98 62
The algorithm • Step 1: Label every word with most likely tag (from dictionary) • Step 2: Check every possible transformation & select one which most improves tagging (with respect to hand tagged corpus) • Step 3: Re-tag corpus applying the rules • Repeat 2 -3 until some stopping criterion is reached e. g. x % correct with respect to training corpus • RESULT: a sequence of transformation rules 27 89 -680
הטרנספורמציות • • T 1 T 2 if Condition Possible Conditions: 1. 2. 3. 4. 5. The preceding (following) word is tagged `z'. The word two before (after) is tagged `z'. One of the two preceding (following) words is tagged `z'. One of the three preceding (following) words is tagged `z'. The preceding word is tagged `u' and the following word is tagged `z'. 6. The preceding (following) word is tagged `u' and the word two before (after) is tagged `z'. 7. -- Similar rules as above but on words rather then on tags or on both! 28 89 -680
Rule Examples • NN VB if ti-1=TO • VBP VB if (ti-1 = MD || ti-2 = MD || ti-3 = MD) 29 89 -680
Issues • מה עושים עם מילים חדשות? • איך מנצלים ידע מורפולוגי? • מה אם אין לנו קורפוס מתויג? 086 -98 03
Next Week … HMMs • לא לשכוח שעורי בית. . . 086 -98 13


