Скачать презентацию CS 546 Spring 2009 Machine Learning in Natural Скачать презентацию CS 546 Spring 2009 Machine Learning in Natural

39072b57a9335dc161da7fdc9c8baed9.ppt

  • Количество слайдов: 37

CS 546 Spring 2009 Machine Learning in Natural Language Introduction: Part 2 Linguistics Essentials CS 546 Spring 2009 Machine Learning in Natural Language Introduction: Part 2 Linguistics Essentials (The role of Linguistics in NLP) 1

Introduction n This is not a class in NLP – but we want to Introduction n This is not a class in NLP – but we want to discuss how to make progress in natural language understanding n Introduce basic linguistics concepts. n Basic terminology n Discuss the levels of analysis used in NLP n Problems associated with each level. 2

Comprehension (ENGLAND, June, 1989) - Christopher Robin is alive and well. He lives in Comprehension (ENGLAND, June, 1989) - Christopher Robin is alive and well. He lives in England. He is the same person that you read about in the book, Winnie the Pooh. As a boy, Chris lived in a pretty home called Cotchfield Farm. When Chris was three years old, his father wrote a poem about him. The poem was printed in a magazine for others to read. Mr. Robin then wrote a book. He made up a fairy tale land where Chris lived. His friends were animals. There was a bear called Winnie the Pooh. There was also an owl and a young pig, called a piglet. All the animals were stuffed toys that Chris owned. Mr. Robin made them come to life with his words. The places in the story were all near Cotchfield Farm. Winnie the Pooh was written in 1925. Children still love to read about Christopher Robin and his animal friends. Most people don't know he is a real person who is grown now. He has written two books of his own. They tell what it is like to be famous. 1. Who is Christopher Robin? 2. When was Winnie the Pooh written? 3. What did Mr. Robin do when Chris was three years old? 4. Where did young Chris live? 5. Why did Chris write two books of his own? Other motivating problems: Entailment, Translation, Generation… 3

Introduction n Discuss the levels of analysis used in NLP n Problems associated with Introduction n Discuss the levels of analysis used in NLP n Problems associated with each level. n For each level of Linguistics Analysis we will ask: n n What are the problems here? What would we consider as a solution? 4

Levels of Analysis n n In traditional linguistics people talk about several levels of Levels of Analysis n n In traditional linguistics people talk about several levels of analysis, or types of linguistics knowledge. Morphology n n Syntax n n The meaning of words and of combinations fo words Pragmatics. n n Structural relation between words Semantics n n How words are constructed How a sentence is used? What’s its purpose Discourse (sometimes distinguished as a subfield of Pragmatics) n Relationships between sentences; global context. 5

Morphology n n n Morphology: How words are constructed; prefixes & Suffixes The simple Morphology n n n Morphology: How words are constructed; prefixes & Suffixes The simple cases are: kick, kicks, kicked, kicking But other cases may be sit, sits, sat, sitting Not just as simple as adding and deleting certain endings, as in: gorge, gorgeous good, goods arm, army This might be very different in other languages. . . (Problems; solutions) 6

Syntax n n Syntax: Structural relationship between words. The main issues here are structural Syntax n n Syntax: Structural relationship between words. The main issues here are structural ambiguities, as in: I saw the Grand Canyon flying to New York. or Time flies like an arrow. The sentence can be interpreted as a n n Metaphor: time passes quickly, but also Declaratively: Insects have an affinity for arrows Imperative: measure the time of the insects. Key issue: Often syntax doesn't tell us much about meaning. Plastic cat food can cover 7

Semantics n n Semantics: The meaning of words and of combinations of words. Some Semantics n n Semantics: The meaning of words and of combinations of words. Some key issue here: Lexical ambiguities: I walked to the bank n n {of the river / to get money}. The bug in the room {was probably planted by spies / flew out the window}. Compositionality: The meaning of phrases/sentences as a function of the meaning of words in them. (Problems; Solutions) 8

Pragmatics/Discourse n n Pragmatics: How a sentence is used; its purpose. E. g. : Pragmatics/Discourse n n Pragmatics: How a sentence is used; its purpose. E. g. : Rules of conversation: n n n Can you tell me what time it is Could I have the salt Discourse: Relations between sentences; global context. An important example here is the problem of co-reference: When Chris was three years old, his father wrote a poem about him. “Chicago? ” n (Running towards an agent in an airport; Ticket Agency) 9

Morphology and Part-of-Speech n Words are related by morphological processes such as n n Morphology and Part-of-Speech n Words are related by morphological processes such as n n n dog. . . dogs conceive. . . inconceivable Importance? n n forming plural forms from singular forms: adding prefixes and suffixes: It makes language more predictable. It allows us to handle new words which are outside our vocabulary. Understanding morphology may support generalization to unknown words. However, Morphology may be tricky. Not always as simple as stripping common prefixes and suffixes. n n n preempt. . . . empt ? gorgeous. . like a gorge? apply. . . like an apple? old. . . oldly? Mrs. . . plural of Mr. atomic. . not Tom-like 10

Morphological Processes n Inflectional forms: n n Words generated share the same basic meaning Morphological Processes n Inflectional forms: n n Words generated share the same basic meaning and part of speech. Words are generated by systematic modifications of the root forms. kick, kicks, kicked, kicking n Derivational forms: n Words generated may have different meaning and part of speech. friend. . . friendly; wide. . . widely; hard. . . hardly n Is there a problem to solve here? What would you consider a solution? 11

Part of Speech n n n n The part-of-speech of words in a sentence Part of Speech n n n n The part-of-speech of words in a sentence has an important role in all recent works in natural language; Necessary to read the literature and the corpora. Part of speech (POS) is a way to categorize words based on a particular syntactic (and often semantic) function they take in the sentence. Sometimes called syntactic or grammatical categories. Important POS: Nouns: typically refer to people, animals and “things”. Verbs: express the action in the sentence. Adjectives: describe properties of nouns. Children eat sweet candy n n n Data / Demo Children: Noun - group of people. eat: Verb - describes what people do with candy. sweet: Adj. - a property of candy: Noun - a particular type of food Other basic Parts of Speech: adjective, adverb, article, pronoun, conjunction … 12

Part of Speech (cont. ) n n Useful sub-categorization of POS into two types: Part of Speech (cont. ) n n Useful sub-categorization of POS into two types: Open class words: n n n Closed class words: n n n n n A constantly changing set; new words are often introduced into the language. nouns, verbs, adjectives and adverbs A relatively stable set; new words are rarely introduced into the language. articles, pronouns, prepositions, conjunctions. It is therefore easier to deal with closed class words. Articles: Pronouns: Prepositions: Demonstratives: Quantifiers: Conjunctions: a, an, the I, you, me, we, he, she, him, her, it, them, they to, for, with, between, at, of this, that, these, those some, every, most, any, both and, or, but 13

Closed class words (not so easy) n n Articles pose a lot of difficulty Closed class words (not so easy) n n Articles pose a lot of difficulty for language generation. Most noun phrases start with an article: n n But, there are many exceptions, n n n a newspaper, an apple, the movie The bowl was full of rice. I go to college. She went on vacation. He fell asleep in class. *The bowl was full of apple. *I go to university. *She went on trip. *He fell asleep in room. Foreign speakers? 14

Closed class words (not so easy-II) n n Other closed class words that are Closed class words (not so easy-II) n n Other closed class words that are hard to deal with: prepositions & particles. Prepositions represent relations: time, location, modification, complements. n n Particles are prepositions that follow verbs to create new verb forms. n n n He threw the cookies up the chimney vs. He threw up the cookies And sometimes, it can be ambiguous: n n He passed out But also n n He put the book on the table He gave the book to Mary He walked up the stairs He looked over the paper. Other problems with prepositions include attachments, which will be discussed later when we discuss semantics. Problems? Solutions? POS? Disambiguation? Text Correction? 15

Nouns n Nouns refer to entities in the world, which represent objects, places, concepts, Nouns n Nouns refer to entities in the world, which represent objects, places, concepts, people, events n n n Count nouns: describe specific objects or sets of objects (above) Mass nouns: describe composites or substances, n n dirt, water, garbage. Pronouns are special class of nouns that refer to a person or a “thing'' that is salient in the context of use. n n dog, city, idea, marathon After Mary had arrived in the village, she looked for a hotel. Relative Pronouns are pronouns like: n n n who, which, that The man who saw Elvis. . The UFO that landed in Toledo. . . The Rolling Stones concert, which I attended, . . . 16

Nouns (cont. ) n Nouns can be objects of verbs or subjects of verbs: Nouns (cont. ) n Nouns can be objects of verbs or subjects of verbs: n n Proper nouns are names like n n Children eat sweet candy Subject Object Mary, Smith, United stated, IBM, Little Rock. Nouns have Modifiers. They can be modified by: n adjectives: words that attribute qualities to objects. n n noun modifiers: n n n or by dog food, tin can, song book. In this case we can talk about the head noun which represents the main concept, e. g. , dog food. A noun is usually embedded in a noun phrase. n n wet, loud, happy, funny A syntactic unit of the sentence in which information about the noun is gathered. The noun is the head of the noun phrase. In addition to the noun we may find in a noun phrase an article: The tree, and an adjective: “The tall tree''. Problems, Solutions? Identification? Why do we need to solve it? How to evaluate it? 17

Verbs n Verbs: Words that represent actions, commands or assertions. n Main verbs: walk, Verbs n Verbs: Words that represent actions, commands or assertions. n Main verbs: walk, eat, believe, claim, ask Auxiliary verbs: be, do, have Modal verbs: will, can, could n Verbs can be n n transitive: they take a complement, as in: eat an apple; read a book; sing a song intransitive: verbs that do not take complements, as in: she laughed; he slept; I lied 18

Verbs (cont. ) n n n Verbs: have morphological forms: Base: walk be go Verbs (cont. ) n n n Verbs: have morphological forms: Base: walk be go Present: walks is goes Past: walked was went Present Participle: walking being going Past Participle: walked been going 19

Verbs (cont. ) n n Verbs can be Active or Passive. The passive voice Verbs (cont. ) n n Verbs can be Active or Passive. The passive voice form consists of a form of “to be” followed by the past participle. Active I saw Elvis I will find him. I have found him. n The roles are reversed in actives and passives. n n n Passive Elvis was seen by me. He will be found by me. He has been found by me. John killed Sam: Sam was killed by John subject is killer, direct object is victim subject is victim, object of “by'' is killer Some verbs take indirect objects, e. g. n n I gave Mary the book Mary: indirect object; vs. I gave the book to Mary. book: direct object Demo 20

Verbs (cont. ) n n n Prepositions and Particles are important in the context Verbs (cont. ) n n n Prepositions and Particles are important in the context of verbs. When they appear as Particles they create new verb forms. Sometimes, we need to know the meaning of the sentence to decide if a word is a preposition or a particle. n She ran up the hill She ran up the bill 21

Verb Phrases n The verb phrase is the syntactic unit that organizes all elements Verb Phrases n The verb phrase is the syntactic unit that organizes all elements of the sentence that depend syntactically on the verb. n The Verb is the head of the verb phrase. n An Adverb is an element of the verb phrase which specify n n place, time, manner, degree She often travels to Las Vegas. She allegedly committed perjury. She started her career off impressively. 22

Verb Sub-categorization n This is a categorization of verbs according to the types of Verb Sub-categorization n This is a categorization of verbs according to the types of complements they take. Complements of a verb are different syntactic means that verbs can exploit to express related entities. The set of complements that a verb can appear with is called its subcategorization frame. 23

Sub-categorization Frames n Intransitive: NP(subject) n n Transitive: n n n She put the Sub-categorization Frames n Intransitive: NP(subject) n n Transitive: n n n She put the book on the table NP (subject) NP (object) that clause She told me that Gary is coming. Complements of verbs can be either Obligatory arguments (subject, object, direct object) n n NP (subject) Reflexive Pronoun(object) She introduced herself Clause complement n n Mary gave John flowers NP (subject) NP (object) PP(location) n n John loves Mary Reflexive Verbs n n NP (subject) NP(object) Dbl obj Construction: NP (subject) NP (direct object) NP (object) n n The woman walked She put the book on the table or Optional (like pp phrase or a subordinate clause (e. g. , "that“ clause). n She gave her presentation on the stage. 24

Syntactic and Semantic Regularities n n Subcategorization frames capture syntactic regularities. There also semantic Syntactic and Semantic Regularities n n Subcategorization frames capture syntactic regularities. There also semantic regularities, usually called selectional restrictions or preferences. E. g. , "bark" prefers dogs as subjects "eat" prefers edible things as objects. Sentences that violate selectional preferences sound odd. n n The cat barked all night. I eat philosophy every day. Last word about verbs: n Gerunds are present particles that function as nouns. n sleeping bags; drinking fountain; moving sale; 25

Syntax n n Words in a sentence are not randomly strung together in a Syntax n n Words in a sentence are not randomly strung together in a sequences. Words are organized in phrases and arranged in particular word order. Syntax is the study of regularities and laws of word order and phrase structure. In English, we cannot determine the meaning of the sentence from the meaning of the words. n n n Peter gave Mary a book. The basic word order in English is: Subject-Verb-Object This holds for declarative sentences, n n Mary gave Peter a book. The children should eat spinach but the order changes to express a particular "mood": n n Interrogative (question): Should the children eat spinach? [Try on demos] Imperative (command, request): Eat spinach! 26

Rewrite Rules n n n n n The regularities of word order are captured Rewrite Rules n n n n n The regularities of word order are captured using rewrite rules. The symbol on the left of the rule can be re-written as the set of symbols on the right. S NP VP NP John, garbage VP laughed, smells This set of rewrite rules can produce the following sentences: John laughed Garbage laughed John smelled Garbage smelled. Symbols that cannot be decomposed are called terminal symbols. Symbols that can be decomposed are called nonterminals. An intuitive way to represent a sentence structure is as a tree, in which each nonterminal represents the application of the rewrite tree. T The following example present a tree representation of the sentence n John walked the dog with fleas. 27

Rewrite Rules n n n This is produced using a set of rewrite rules Rewrite Rules n n n This is produced using a set of rewrite rules that we call the Grammar: A formal specification of the structures allowable in a language. A grammar that can produce this tree is: S S NP VP NP Det noun PP NP NP NP ADJ NP V N NP noun NP NP Det NP noun PP NP noun N PP VP V NP PP NP VP V PP John walked the dog with the fleas VP V PP Prep NP PP P But, the same grammar can also produce other trees. E. g. , the one that means that the fleas helped John walk the dog. P Prep NP That is, the grammar is not enough. Demo 28

Parsing n A parsing technique is a method for determining the structure of a Parsing n A parsing technique is a method for determining the structure of a sentence with respect to (given) a grammar. n n n A parser is a computer program that determines the structure of the sentence. Not to confuse with a program that induces the grammar. Lexical vs. non-lexical grammar: many grammars today are lexicalized in that the re-write rules include specific words. Notice that rewrite rules can be applied recursively. This is important, since it allows for simple nonterminals to expand to a large number of words. This allows for the generation for many long term dependencies, e. g. , between subjects and verbs, and is a source of difficulties in NLP. Shallow parse is a parse of the sentence at a shallow level – only one or two levels above the non-terminals. This is considered an easier task that, quite often can be more robust. There are multiple grammar formalisms. What we showed here is a constituent-based formalisms; but there exist others. 29

Semantics n Semantics: the study of the meaning of language. Can be decomposed into: Semantics n Semantics: the study of the meaning of language. Can be decomposed into: n n Lexical semantics: the study of meaning of individual words Global semantics: how the meaning of individual words are combined into meaning of sentences (or more). One approach to lexical semantics is to study how word meanings are related to each other. To study this, words can be organized into lexical hierarchies (as done in Word. Net). 30

Lexical Semantics n Hypernym: a word with a more general sense. n n n Lexical Semantics n Hypernym: a word with a more general sense. n n n Hyponnym: a word with a more specific sense. Antonym: a word having opposite meaning. n n n meronym(tree)=leaf. Synonym: same meaning Homonyms: words that are written the same way but represent different words. n n antonym(hot)=cold. Meronym: part-of. n n hypernym(cat)= animal Bank (river, finance); suit (law, set of garment) Polysemy: word with two senses that are related n n Branch: natural subdivision of a plant; separate but dependent part of an organization. 31

Lexical Semantics n When we move to global semantics, the natural problem is: n Lexical Semantics n When we move to global semantics, the natural problem is: n n n This is a hard problem, since natural language does not obey the principle of compositionality. E. g. , the word white refers to different colors in the following expressions: n n n How to use the meaning of single words to produce a meaning of a sentence? white paper; white hair; white skin; white wine There are problems of idioms and the scope of words in the sentence that makes this even harder. Logical structure of the sentence (focus of formal semantics) Mutli-word expressions (wordnet) 32

Pragmatics n n n One of the important issues studied here is that of Pragmatics n n n One of the important issues studied here is that of discourse analysis. A central problem there is that resolution of anaphoric relations. An example: n n Mary helped the other passenger out of the cab. The man had asked her to help him because of his foot injury. Anaphoric relations hold between Noun Phrases that refer to the same thing in the world. In the above example, there are quite a few ways to resolve the identify of "the man", "him" and "his foot". This issue is important in many applications, in particular in information extraction – where there is a need to keep track of participants. 33

The Reference Problem The same problem exists with other types of entities Kennedy Document The Reference Problem The same problem exists with other types of entities Kennedy Document 1: The Justice Department has officially ended its inquiry into the assassinations of John F. Kennedy and Martin Luther King Jr. , finding ``no persuasive evidence'' to support conspiracy theories, according to department documents. The House Assassinations Committee concluded in 1978 that Kennedy was ``probably'' assassinated as the result of a conspiracy involving a second gunman, a finding that broke from the Warren Commission 's belief that Lee Harvey Oswald acted alone in Dallas on Nov. 22, 1963. Document 2: In 1953, Massachusetts Sen. John F. Kennedy married Jacqueline Lee Bouvier in Newport, R. I. In 1960, Democratic presidential candidate John F. Kennedy confronted the issue of his Roman Catholic faith by telling a Protestant group in Houston, ``I do not speak for my church on public matters, and the church does not speak for me. '‘ Document 3: David Kennedy was born in Leicester, England in 1959. …Kennedy coedited The New Poetry (Bloodaxe Books 1993), and is the author of New Relations: The Refashioning Of British Poetry 1980 -1994 (Seren 1996). 34

Summary (1) Linguistics is subdivided traditionally into n Phonetics (physical sounds of the language; Summary (1) Linguistics is subdivided traditionally into n Phonetics (physical sounds of the language; consonants, vowels, intonation) n Phonology (how sounds are mentally represented), n Morphology, n Syntax, n Semantics and n Pragmatics. n Most of the work within the statistics and learning-based approaches to natural language is done in the areas of Syntax, Semantics, and some Pragmatics and Discourse. n This will be our main concern in this course. n Phonetics is also studied using related methods, within the Speech community, and the techniques we will present in this course could be used there, as well as in Morphology. 35

Summary (2) Many aspects we have not touched: n Applications n n Other Languages Summary (2) Many aspects we have not touched: n Applications n n Other Languages n n Translation, Generation, Information Extraction, … Annotation; understanding; using as a resource, … Other forms of English (? ) n Spoken language; emails; blogs; code comments, … 36

Info: : n Office Hours n n 11: 00 – 12: 00 Wednesday, office Info: : n Office Hours n n 11: 00 – 12: 00 Wednesday, office 3328 Preliminary Course Schedule on the web n n Lecture notes are preliminary (mostly from previous year) Set of papers will be expanded 37