190 likes | 221 Views
Natural Language Processing. What’s the problem? Input? Output?. Example Applications. Enables great user interfaces! Spelling and grammar checkers. Http://www.askjeeves.com/ Document understanding on the WWW. Spoken language control systems: banking, shopping
E N D
Natural Language Processing • What’s the problem? • Input? • Output?
Example Applications • Enables great user interfaces! • Spelling and grammar checkers. • Http://www.askjeeves.com/ • Document understanding on the WWW. • Spoken language control systems: banking, shopping • Classification systems for messages, articles. • Machine translation tools.
NLP Problem Areas • Phonology and phonetics: structure of sounds. • Morphology: structure of words • Syntactic interpretation (parsing): create a parse tree of a sentence. • Semantic interpretation: translate a sentence into the representation language. • Pragmatic interpretation: incorporate current situation into account. • Disambiguation: there may be several interpretations. Choose the most probable
Some Difficult Examples • From the newspapers: • Squad helps dog bite victim. • Helicopter powered by human flies. • Levy won’t hurt the poor. • Once-sagging cloth diaper industry saved by full dumps. • Ambiguities: • Lexical: meanings of ‘hot’, ‘back’. • Syntactic: I heard the music in my room. • Referential: The cat ate the mouse. It was ugly.
Parsing • Context-free grammars: • EXPR -> NUMBER • EXPR -> VARIABLE • EXPR -> (EXPR + EXPR) • EXPR -> (EXPR * EXPR) • (2 + X) * (17 + Y) is in the grammar. • (2 + (X)) is not. • Why do we call them context-free?
Using CFG’s for Parsing • Can natural language syntax be captured using a context-free grammar? • Yes, no, sort of, for the most part, maybe. • Words: • nouns, adjectives, verbs, adverbs. • Determiners: the, a, this, that • Quantifiers: all, some, none • Prepositions: in, onto, by, through • Connectives: and, or, but, while. • Words combine together into phrases: NP, VP
An Example Grammar • S -> NP VP • VP -> V NP • NP -> NAME • NP -> ART N • ART -> a | the • V -> ate | saw • N -> cat | mouse • NAME -> Sue | Tom
Example Parse • The mouse saw Sue.
Try at Home • The Sue saw.
Also works... • The student like exam • I is a man • A girls like pizza • Sue sighed the pizza. • The basic word categories are not capturing everything…
Grammars with Features • We add features to constituents: • AGR: number-person combination, (3s, 1p) • VFORM: verb form (go, goes, gone, going) • SUBCAT: restrictions on complements • None (sleep) • NP (find) • NP-NP (give) • Now every constituent has a set of features: • (NP (AGR 1p) (ROOT cat))
Grammar rules with Features • (S (AGR (? a)) -> (NP (AGR (? a))) (VP (AGR (? a))) • (VP (AGR (? a)) (VFORM (? vf))) --> (V (AGR (? a)) (VFORM (? vf)) (SUBCAT non)) • dog: (N (AGR 3s) (ROOT dog)) • dogs: (N (AGR 3p) (ROOT dog)) • barks: (V (AGR 3s) (VFORM pres) (SUBCAT none) (ROOT bark))
Semantic Interpretation • Our goal: to translate sentences into a logical form. • But: sentences convey more than true/false: • It will rain in Seattle tomorrow. • Will it rain in Seattle tomorrow? • A sentence can be analyzed by: • propositional content, and • speech act: tell, ask, request, deny, suggest
Propositional Content • We develop a logic-like language for representing propositional content: • Word-sense ambiguity • Scope ambiguity • Proper names --> objects (John, Alon) • Nouns --> unary predicates (woman, house) • Verbs --> • transitive: binary predicates (find, go) • intransitive: unary predicates (laugh, cry) • Quantifiers: most, some
Examples • (MOST x1: (laugh x1) (happy x1)) • (Believe john (kill June Mary)) • (Every b1: (boy b1) (A d1 : (dog d1) (loves b1 d1))) • Semantic interpretation can be done with feature grammars (see book).
Disambiguating Word Senses • Use type hierarchies: • The ruler likes the house. • Only allow patterns: (Likes Animate object) Object Inanimate Animate Tool Dwelling Person Cat Ruling person Ruler tool hammer house
Speech Acts • What do you mean when you say: • Do you know the time? Context Speaker knows time Speaker doesn’t know Speaker believes request request hearer knows time Speaker believes offer wasting time hearer doesn’t know Speaker doesn’t know yes-no question Y/N question or if hearer knows time or cond offer request
Natural Language Summary • Parsing: • context free grammars with features. • Semantic interpretation: • Translate sentences into logic-like language • Use additional domain knowledge for word-sense disambiguation. • Use context to disambiguate references. • Use context to analyze which speech act is meant.