1 / 31

עיבוד שפות טבעיות - שיעור רביעי Part of Speech Tagging

עיבוד שפות טבעיות - שיעור רביעי Part of Speech Tagging. אורן גליקמן המחלקה למדעי המחשב אוניברסיטת בר אילן. חלקי-הדיבור. מקובל למנות 9~ קבוצות מילים המכונות "חלקי- דיבור":

Download Presentation

עיבוד שפות טבעיות - שיעור רביעי Part of Speech Tagging

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. עיבוד שפות טבעיות - שיעור רביעיPart of Speech Tagging אורן גליקמן המחלקה למדעי המחשב אוניברסיטת בר אילן 89-680

  2. חלקי-הדיבור • מקובל למנות 9~ קבוצות מילים המכונות "חלקי- דיבור": • שם עצם (noun),שם תואר (adjective),כינוי (pronoun),שם מספר (numeral),פועל (verb),תואר הפועל (adverb),מלת יחס (preposition),מלת חיבור (conjunction),מלת קריאה (interjection). • אך זו רק חלוקה אחת 89-680

  3. למה זה טוב? • בסיס לניתוח parsing • יצירת קול (TTS) – אופן הביטוי של המילה: • רכבת/רכבת • CONtent/conTENT, OBJect/objECT, DIScount/disCOUNT • Chunking/partial parsing/identifing terms – זיהוי תחבירי לא מלא • N-gram models for speech • IR,MT – Information Retrieval , Machine Translation 89-680

  4. איך מגדירים חלקי דיבר? • באופן מסורתי, ההגדרה של חלקי הדיבר מבוססת על תכונות מורפולוגיות של המילה או על המילים שמופיעות לידן בסמיכות distributional properties. • באופן עקרוני, יש למילים מאותו חלק דיבר דמיון סמנטי, כלומר, הן מתארות איברים מאותן קבוצות למשל • שמות עצם –nouns אנשים, מקומות, דברים– thought, table, sister • שמות תואר – adjectivesתכונות, כמויות big, lazy • לואי פעולה – adverbs – מתארים אופן, מקום, זמן, איכות quickly • פעלים – אירועים, התרחשויות או מצבי קיום – eat, is, write • ויש גם מילות יחס, מילות איחוי ועוד... 89-680

  5. דוגמא 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. 89-680

  6. Open class vs. Closed class types • Closed class – הקבוצה שחבריה קבועים בדרך כלל, כמו מילות יחס. • Open class – למשל, שמות עצם ופעלים: מילים חדשות מתווספות לקבוצה to fax, לפקסס • בקורפוסים שונים ייצפו מילים שונות מהקבוצה הפתוחה, אבל אם הקורפוס גדול מספיק, סביר להניח שימצאו בהם אותם מילים השייכות לקבוצה הסגורה. • מילים מהקבוצה הסגורה הן בדרך כלל function words – מילים השייכות לדקדוק כמוof, את – מילים קצרות בדרך כלל המופיעות בתדירות גבוהה, ולהן תפקיד תחבירי חשוב. 89-680

  7. שמות עצם • 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 89-680

  8. 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, … 89-680

  9. Verbs • מילים המתייחסות לפעולות או תהליכים • Main verbs – draw, provide, differ • Auxiliaries (referred to as closed-class) • מערכת הטיה מורפולוגית • eat, eats, eating, eaten 89-680

  10. Adjectives • מבחינה סמנטית, קבוצה הכוללת ביטויים המתארים תכונות או איכויות, משהו כמו פרדיקט חד-מקומי. • שפות רבות כוללות: • צבעים (yellow, green) • גילאים (young, old) • וערכים. (good, bad) • יש שפות בלי שמות תואר. שפות המבוססות על פעלים. כל מיני שפות אינדיאניות. 89-680

  11. Adverbs • קבוצה מעורבת למדי... • Unfortunately, John walked homeextremelyslowlyyesterday • Directional: sideways, downhill • Locative: home, here • Degree: extremely, somewhat • Manner: slowly, delicately • Temporal: yesterday, Monday 89-680

  12. 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, on, off, in , at, by • Numerals – one, two , second, third 89-680

  13. Prepositions and particles. • Prepositions • on top, by then, with him... • מילות יחס המופיעות לפני שם עצם • מצינות יחסי זמן/מקום, אבל לא רק. • Particles • go on, look up, turn down • מופיעים אחרי פועל, ובפעלים טרנזיטיביים, גם אחרי המושא • The horse went off its truck/throw off sleep • *The horse went its track off/throw sleep off 89-680

  14. Articles • a, an, the • מופיעים בתחילה צירוף שמני noun phrase • גם: this chapter, that page • שכיחים מאוד בטקסטים 89-680

  15. Conjunctions • מאחים שני phrases , צירופים , משפטים, וכו. • Or, and, but מאחים צירופים מאותו סטטוס (סוג) • Subordinating conjunctionsמשמשים לאיחוי צירופים מקוננים • I thought that you might like some milk. • I thought – main clause • That you might… - subordinating clause 89-680

  16. ויש עוד... 89-680

  17. 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 C7 tagset of used to tag the British National Corpus BNC. 89-680

  18. Part-Of-Speech Tagging • תיוג הוא התהליך של השמת חלקי דיבר או סימון לקסיקלי אחר לכל מילה בקורפוס. (tokenization) • תיוג מתבצע בדרך כלל גם על סימני פיסוק • הקלט הוא רצף מילים ו-tagsetמהסוג שראינו. • הפלט הוא התיוג הטוב ביותר עבור כל אחת מן המילים. • והבעייה המרכזית, היא – ambiguity: • Time flies like an arrow/ fruit flies like a banana • I can can my can/אישה נעלה נעלה נעלה נעלה את הדלת... 89-680

  19. 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. 89-680

  20. Word Types in the Brown Corpus 89-680

  21. 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. 89-680

  22. מתייגים • - מבוססי חוקים • קידוד ידני • Transformation-based tagging • Stochastic Tagging - הסתברותיים • HMM • Bayesian networks • Maximum entropy 89-680

  23. מתייגים מבוססי חוקים • בשלב הראשון, מתחוך הלקסיקון כל אחת מהמילים מתויגת ברשימת תגים אפשריים. • בשלב השני התג הסופי מוכרע על פי חוקים לפתירת רב משמעות, כך שהתוצר הסופי הוא תג בודד 89-680

  24. Transformation based tagging • Brill tagging – 1995 • שילוב של rule-basedושיטות הסתברותיות. • לכל מילה, ניתנת הסתברות לתגים האפשריים. • המתייג הוא אוסף חוקים, שנלמדו בצורה אוטומטית מתוך אוסף של נתונים. • הלימוד הוא supervised, ומניח קיום קורפוס מתויג. 89-680

  25. איך זה עובד? 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 • החוק הזה יחליף את race/NN to/TOב- to/TO race/VB 89-680

  26. אלגוריתם הלימוד • תיוג עם התג הכי סביר • חזור עד תנאי העצירה: Greedy Search • בדיקת כל טרנספורמציה אפשרית • בחירת הטרנספורמציה שנותנת את התוצאות הטובות ביותר (על ידי מדידת המרחק מהאמת) • תיוג מחדש על פי החוק הנבחר • דורש ידיעת ה"תג הנכון" כלומר – למידה מכוונת-מומחה • תוצאת הלמידה היא רשימה מסודרת של טרנספורמציות המהוות "פרוצדורת תיוג" 89-680

  27. 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 89-680

  28. הטרנספורמציות • T1 T2 if Condition • Possible Conditions: • 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'. • The preceding (following) word is tagged `u' and the word two before (after) is tagged `z'. • -- Similar rules as above but on words rather then on tags or on both! 89-680

  29. Rule Examples • NN  VB if ti-1=TO • VBP  VB if (ti-1 = MD || ti-2 = MD || ti-3 = MD) 89-680

  30. Issues • מה עושים עם מילים חדשות? • איך מנצלים ידע מורפולוגי? • מה אם אין לנו קורפוס מתויג? 89-680

  31. Next Week … HMMs • לא לשכוח שעורי בית... 89-680

More Related