עיבוד שפות טבעיות מבוא

Post on 20-Mar-2016

65 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

עיבוד שפות טבעיות מבוא. פרופ' עידו דגן (קרדיט לחלק מהשקפים : אורן גליקמן) המחלקה למדעי המחשב אוניברסיטת בר אילן שינויים מאת אבי רוזנפלד. מה זה בכלל עיבוד שפות טבעיות. נקרא גם "בלשנות חישובית“ Natural Language Processing/ Computational Linguistics - PowerPoint PPT Presentation

TRANSCRIPT

1

טבעיות שפות עיבודמבוא

דגן פרופ' עידו( :לחלק מהשקפיםקרדיט) גליקמן אורן

המחשב למדעי המחלקהאילן בר אוניברסיטת

רוזנפלד אבי מאת שינויים

2

טבעיות שפות עיבוד בכלל זה מה•“ חישובית " בלשנות גם נקרא

• Natural Language Processing/Computational Linguistics

• , , של ועיבוד יצירה ניתוח בהבנה שקשור מה כל) , למשל ) מחשב משפות להבדיל טבעיות שפות

מתיימרים – • איננו משמעות של ייצוג מהווה שפה , " לבצע " אלא משמעות של אמיתית להבנה להגיע

בהבנה החוסר למרות מועילות , או להגיע פעולותלמודלים מקורבים

3

לאפליקציות יישומים/דוגמאותממוחשב • תרגוםמידע • ואחזור חיפושלשאלות – • Question Answeringמענהמידע – • Information Extractionשליפת•: במונחים , טיפול , שמות סיווג דמיון שליפהאוטומטי • תמצות•: הדיבור בתחום אפליקציות

דיאלוג – מערכותשגיאות • ( eg. Microsoft Word)תחביר כתיב ותיקון•) ' , ט ) צ קול חדשים ממשקים

4

5

6

Towards text understanding: Question Answering

7

8

Search may benefit understanding • Query: AIDS treatment

• Irrelevant document:

Hemophiliacs lack a protein, called factor VIII, that is essential for making blood clots. As a result, they frequently suffer internal bleeding and must receive infusions of clotting protein derived from human blood.During the early 1980s, these treatments were often tainted withthe AIDS virus. In 1984, after that was discovered, manufacturersbegan heating factor VIII to kill the virus. The strategy greatlyreduced the problem but was not foolproof. However, many expertsbelieve that adding detergents and other refinements to thepurification process has made natural factor VIII virtually free ofAIDS.

(AP890118-0146, TIPSTER Vol. 1)

• Many irrelevant documents mention AIDS and treatments for other diseases

9

Relevant Document

• Query: AIDS treatment

Federal health officials are recommending aggressive use of a newly approved drug that protects people infected with the AIDS virus against a form of pneumonia that is the No.1 killer of AIDS victims.The Food and Drug Administration approved the drug, aerosol pentamidine, on Thursday. The announcement came as the Centers for Disease Control issued greatly expanded treatment guidelines recommending wider use of the drug in people infected with the AIDS virus but who may show no symptoms.

(AP890616-0048, TIPSTER VOL. 1)

• Relevant documents may mention specific types of treatments for AIDS

10

קשורים מדעיםבלשנות•למידת מכונה והסקה סטטיסטית•פסיכולינגויסטיקה•המחשב )• ( AIמדעי

חיפוש )– ( למשלאלגוריתמיםהמוח )• Cognitive Science)מדעי

11

מחשב שפת לעומת טבעית שפה•) כללי ) באופן מחשב - שפות משמעיות חד הנן

. יכול קומפילר היטב י" )ומוגדרות לתרגם (Parserע: . לדוגמא מכונה שפת לפקודות קוד

שווה – בין הבחנה של יש )=( assignmentבמשמעות. )==(equalityלעומת

פרדיקטים –– על מוגדר סדר יש• a מ dאו cולא bגדול• a > b && !c || d•a > b && )!c || d(•a > b && !)c || d(

12

או ו ו(:orאו )• ואנגלית( ) בעברית משמעי דו היינו

– . תה או קפה לקבל יכול (Exclusive )אתהעוגה – או קפה רוצה (Inclusive )?אתה

• – ( : כמתים טווח דוגמא (quantifier scopeעוד–)" בתחרות" המתחרים שאר כל את ניצחתי כמעט–"? באמת"– , : את" ניצחתי כמעט ירון את ניצחתי כמעט כן

"..., אלון, את ניצחתי כמעט איריס

13

שפה קשה עבריתעברית !• רק לאמלאת • הטבעית משמעויות השפה , רב

: שונות ברמות: כותרת• השבוע בעיתון תמונה

בבאלי" – חולים בית ליד בפיגוע הרוגים גופותהיום."

חולים ?– בית ליד היה הפיגוע האם–? הפיגוע ארע מתי

14

242• "Withdrawal of Israel armed forces

from territories occupied in the recent conflict"

•. הפרוש על מתווכים היום עד

15

משמעות תחביריתרב

הבא • ולפחות 15במשפט )!( 455מיליםאפשריים: תחביריים ניתוחים

List the sales of the products produced in 1973 with the products produced in 1972.

16

Variability of Semantic Expression

Dow ends up

Dow climbs 255

The Dow Jones Industrial Average closed up 255

Stock market hits a record high

Dow gains 255 pointsAll major stock markets surged

17

AI & Turing Test

•NLP- כ ’ AI complete’נחשב

• Turing Test: is a computer program intelligent? )1954(Would a human find out that he speaks with a computer?

18

לשוניידע רמות

ופונולוגיה • פונטיקהמורפולוגיה•(Syntaxתחביר )•סמנטיקה•(Discourseשיח ), פרגמטיקה•כללי )• (World Knowledgeידע

19

ומשפטים למילים הפרדהTokenization & Sentence splitting

20

Tokenization

• ' הקלט ' שבירת היא הראשונית הבעיה. ולמילים למשפטים

•' וכד למספרים גם הכוונה במילים•: הנאיבית הגישה

–‘!','?','.'- ב מסתיים משפט– - ב מופרדת whitespaceמילה

•...: המציאות אך

21

Tokenization Issues

• East Asian Languages• Some punctuation marks are part of

words: .-” etc.

22

Sentence breaks vs. words

גם'.','?','!' ':',';','-','• 'n\ולפעמים• ~ 90% of periods are sentence breaks• State of the art: 99% accuracy )learning

methods( • English capitalization can help• The Problem: period .

– can denote a decimal point )5.6(, an abbreviation )Mr.(, the end of a sentence, thousand segment separator: 3.200 )three-thousand-two-hundred, in Europe(, initials: A. B. Smith, ellipsis …

23

?" מילה " זה מהמילוני )• העצמאית(: למהערך המידע יחידת

בשפה ביותר הקטנהשולחן, למשל: ספר

: לא ed-(walk)(, ספר)האבלShe'dמילה? •• " " " " , יחידה או מחרוזת כל לא כתובה בשפה

: למשל - למה היא ברווחים המוקפתאותו ואכלתיהו - אכלתי ואני

הלקסיקאלית • ליחידה להתייחס מקובל- כ בטקסט tokenהמינימאלית

24

מורפולוגיהמ • מורכבות שהן morphemes - מורפמותמילים

" משמעות" הנושאות ביותר הקטנות המידע יחידותמילים • :הבנויות ממורפמה אחתיש•car, fish•: מורפימות מכמה מורכבת להיות יכולה מילה• + ) ( הם - + ם י סוס סוסיהםמעוניינים במודל למורפולוגיה של השפה•

ניתוח–יצירה–חשיבות: איות, אחזור מידע, תנאי מקדים לניתוח תחבירי –

)ליישומים דקדוקיים וסמנטיים(

25

הרכבת

עצם שםהידיעה . והא . ב כ ר פועל

הפעיל בנייןיחיד זכר עבר

. . ב כ ר פועלהפעיל בניין

יחיד נקבה עבר

השאלה הא. . ב כ ר פועל

פעל בנייןיחיד זכר עבר

עצם שםנסמך

– רב משמעותמורפולוגיה

26

מנגנונים מורפולוגיים - :( affixes)מוספיות

, , וסופית תוכית תחילית•- ל מחולקות affixesול-)אינו בהכרח מילה( stemמיליםהמילה - prefixesתחיליות - • בתחילת המוספות הן•Un-believable, re-directionהמילה - suffixesסופיות - • בסוף מוספות

ing : having, eatingלמשל: שורש- - - infixes תוכיות • או לגזע המוכנסת מורפמה

בעברית בניין הקובעות אותיות למשלעלתרחץ, השהתהתפעל - –

•Circumfix)שילוב של תחילית וסופית )למשל בגרמנית – ( למנגנון concatenativeמבחינים בין מנגנון שרשורי )•

מבוסס תבניות )כגון שורש-בנין בשפות שמיות(

27

inflectionהטיה צרכים שיכול לחול תמידשינוי• מתוך המילה בצורת

.(חלק הדיבר )ואת הלמה את שאינו משנה, תחביריים:למשל

–- ) / רבים ) יחיד number מספרנערות - • נערה

genderמין –נערה - • נער

person גוף–רצנו - • אנחנו רצתי אני

tenseזמן –מערכת ההטיה תלויה בחלק הדיבר )ש"ע, פועל, שם תואר, ...(•מורכבת • ההטיות מערכת בעברית

28

באנגלית הטיות• . יחסית פשוטה ההטיות מערכת באנגלית

משורשרת - מבוססת על מורפולוגיהconcatenative morphology

• : ריבוי עצם שמות עבורכתיב • חוקי מלים orthographic rulesיש למשל

- ב יהיה xשמסתיימות לרבים .s-ולא es-סימון• : יותר מגוונות ההטיות פעלים :עבור

stem, 3rd person, -ing participle, past, past participle 11בטורקית למשל – מערכת שרשורים ענפה )דוגמא עם •

מרכיבים(

29

Morphologi-cal Form Classes

Stem" שורש"

walkmergetrymap

-s formwalksmergestriesmaps

-ingwalkingmergingtryingmapping

Regulary Inflected verbs )by rules(

30

ה )הטיות(מורפולוגיל מידול חישוביניתוח ויצירה

•Morphological analysisמבנה: • ויצירת כלשהו קלט קבלת ניתוח

ממנו.•- כ מילה כקלט יקבל מורפולוגי goingניתוח

הניתוח את כפלט ויחזירהלמה והמאפיינים המורפולוגיים של המילה–

VERB-GO + PARTICIPLE-ing

31

דוגמאות • : ניתוח פשוטה ו נטיות דוגמא עצם פעליםשמותהמטרה: •

: cat + N + PLפלט: catsקלט : goose + N+ PLפלט: geeseקלט : merge + V + PRES-PARTפלט: mergingקלט : catch + V + PAST-PARTפלט: caughtקלט

32

מורפולוגי מטרות מודלניתוח:•

–Recognizer :לא או תקנית היא מילה האם–Stemmer:ה מזהה את צורת( בסיסstem )מילה של–Analyzer :למלים מורפולוגי ניתוח נותן

•Generator :מורפולוגי מניתוח מילים מייצרמסוים

33

Porter Stemmer• Example Rules:• Step 1a

– SSES -> SS (passes pass)– IES -> I (ponies poni, ties ti)– SS -> SS (caress caress)– S (cats cat)

• Step 1b (m – counts “syllables”)– (m>0) EED EE (feed feed, agreed agree)– (*v*) ED (plastered plaster, bled

bled) (*v*) ING (motoring motor, sing sing)

34

Porter Algorithm• Step 2

– (m>0) ATIONAL -> ATE relational -> relate – (m>0) TIONAL -> TION conditional -> condition – (m>0) ENCI -> ENCE valenci -> valence – (m>0) ANCI -> ANCE hesitanci -> hesitance – (m>0) IZER -> IZE digitizer -> digitize – (m>0) ABLI -> ABLE conformabli -> conformable

(m>0) ALLI -> AL radicalli -> radical – (m>0) ENTLI -> ENT differentli -> different

• Etc…

35

הדיבר- חלקי- ניתן• חלקי " המכונות מילים קבוצות למנות

דיבור":עצם )• תואר(, )nounשם (,adjectiveשם

מספר(, )pronounכינוי ) (,verbפועל(, )numeralשםהפועל ) יחס(, )adverbתואר (,prepositionמלת

חיבור ) ...(, conjunctionמלתאחת • חלוקה רק )הקטגוריות העיקריות זו

סטנדרטיות(

36

דוגמאThe yinkish dripner blorked

quastofically into the nindin with the pidibs.

• yinkish -adj quastofically -adverb• dripner -noun pidibs -noun• blorked -verb nindin -noun

• 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.

37

עצם שמות• Nouns

– Affixes: -s, 's, -ness, -ment, -er, …– Occur with determiners (a,the,this,some…)– can be a subject of a sentence.

• Semantically: can be concrete – chair, train, or abstract – relationship.

: גם• , למשל פעולה לאכול, שמות eating, אכילה

38

Types of Nouns• Important to distinguish noun types – have

different morphological and syntactic properties• 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, … )no plural(

39

Verbs

תהליכים • או לפעולות המתייחסות מילים–Main verbs – draw, provide, differ–Auxiliaries )closed-class( – have )also main(,

been… ,מורפולוגית • הטיה של פעלים: זמן, מערכת

גוף, מין )לא באנגלית(, מספר–eat, eats, eating, eaten

40

Adjectives

עצם • בשם משהו מתארכוללות • רבות :שפות

(yellow, greenצבעים )–(young, oldגילאים )––. (good, bad ) וערכים

41

Adverbs

פועל • על משהו מתאר• Unfortunately, John walked home extremely slowly yesterday

• Directional: sideways, downhill• Locative: home, here• Degree: extremely, somewhat• Manner: slowly, delicately• Temporal: yesterday, Monday

42

Part-Of-Speech Taggingדיבר • חלקי השמת של התהליך הוא סימון )תיוג או

אחר בקורפוס. ( token)מילה מופע לכל (לקסיקליפיסוק • סימני על גם כלל בדרך מתבצע תיוג•- ו מילים רצף הוא .tagsetהקלט•. המילים מן אחת כל עבור ביותר הטוב התיוג הוא הפלט• – , היא המרכזית :ambiguityוהבעייה

–Time flies like an arrow/ Fruit flies like an apple –I can can my can /נעלה נעלה נעלה ...ואישה הדלת את נעלה

תואר פועל ש"ע פועל

43

State of the Art

• A dumb English 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• Tagging 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.

44

מתייגיםחוקים- • מבוססי

ידני – של חוקיםקידוד ביטויים רגולריים, מערכת לבדיקת התאמת חוקים - בדר"כ מבוסס•

והפעלה שלהם

–Transformation-based tagging )learning( • Stochastic Tagging - הסתברותיים

–HMM–Maximum entropy–Classifier based )e.g. SVM(

45

Supervised Learning Scheme

ClassificationModel

“Labeled”Examples

NewExamples Classifications

Training Algorithm

ClassificationAlgorithm

top related