1 / 32

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

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

dai-herring
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 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 home extremely slowly yesterday • 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 • 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 word types, it isn't necessarily 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 (learning) • Stochastic Tagging - הסתברותיים • HMM • Bayesian networks • Maximum entropy 89-680

  23. Supervised Learning Scheme “Labeled” Examples Training Algorithm Classification Model New Examples Classification Algorithm Classifications 89-680

  24. איך זה עובד? 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

  25. Transformational Based Learning (TBL) for Tagging • Introduced by Brill (1995) • Can exploit a wider range of lexical and syntactic regularities via transformation rules – triggering environment and rewrite rule • Tagger: • Construct initial tag sequence for input – most frequent tag for each word • Iteratively refine tag sequence by applying “transformation rules” in rank order • Learner: • Construct initial tag sequence for the training corpus • Loop until done: • Try all possible rules and compare to known tags, apply the best rule r* to the sequence and add it to the rule ranking 89-680

  26. Some examples 1. Change NN to VB if previous is TO • to/TO conflict/NN with  VB 2. Change VBP to VB if MD in previous three • might/MD vanish/VBP VB 3. Change NN to VB if MD in previous two • might/MD reply/NN VB 4. Change VB to NN if DT in previous two • the/DT reply/VB  NN 89-680

  27. Transformation Templates • Specify which transformations are possible For example: change tag A to tag B when: • The preceding (following) tag is Z • The tag two before (after) is Z • One of the two previous (following) tags is Z • One of the three previous (following) tags is Z • The preceding tag is Z and the following is W • The preceding (following) tag is Z and the tag two before (after) is W 89-680

  28. Lexicalization New templates to include dependency on surrounding words (not just tags): Change tag A to tag B when: • The preceding (following) word is w • The word two before (after) is w • One of the two preceding (following) words is w • The current word is w • The current word is w and the preceding (following) word is v • The current word is w and the preceding (following) tag is X (Notice: word-tag combination) • etc… 89-680

  29. Initializing Unseen Words • How to choose most likely tag for unseen words? Transformation based approach: • Start with NP for capitalized words, NN for others • Learn “morphological” transformations from: Change tag from X to Y if: • Deleting prefix (suffix) x results in a known word • The first (last) characters of the word are x • Adding x as a prefix (suffix) results in a known word • Word W ever appears immediately before (after) the word • Character Z appears in the word 89-680

  30. TBL Learning Scheme Unannotated Input Text Setting Initial State Ground Truth for Input Text Annotated Text Learning Algorithm Rules 89-680

  31. Greedy Learning Algorithm • Initial tagging of training corpus – most frequent tag per word • At each iteration: • Identify rules that fix errors and compute “error reduction” for each transformation rule: • #errors fixed - #errors introduced • Find best rule; If error reduction greater than a threshold (to avoid overfitting): • Apply best rule to training corpus • Append best rule to ordered list of transformations 89-680

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

More Related