NLP — semantics Points Semantic analysis • Semantic markers Case analysis • Syntactic patterns • Case lists • An algorithm Quantifier scope A taste of discourse analysis A look at pragmatics Semantic analysis Semantic analysis may follow parsing: map a parse tree (a syntactic structure) into a representation of meaning (a knowledge structure). Semantics resides at both sides of parsing, and elements of meaning come from words. Lexical knowledge lives in dictionaries. It has two forms. • Morphological and syntactic information about the word: part-of-speech (class), number, case, gender, tense, requirements (for verbs), and so on. • Semantic information about the word, for example, a semantic marker that locates — in a hierarchy of concepts — the concept that the word denotes. Semantic markers Semantic markers (2) Case analysis Case analysis (2) Case analysis (3) Case analysis (4) Case analysis (5) Case analysis (6) Case analysis (7) Case analysis (8) Quantifier scoping Every author wrote a book. a b author(a) book(b) wrote(a, b) skolemize: a author(a) book(s(a)) wrote(a, s(a)) b a author(a) book(b) wrote(a, b) skolemize: a author(a) book(B0) wrote(a, B0) Only one scoping is correct: which one? The man picked up all papers. THE m p man(m) paper(p) pickedUp(m, p) p THE m man(m) paper(p) pickedUp(m, p) A simple algorithm: fixed precedence, for example, the > each > what, who, whom > every, all, some, a But: there is no universally approved, objective ordering. A taste of discourse analysis Text units beyond sentences — examples • A story (such as a fairy tale, a drama, ...). • A news item. • Dialogue. • Technical text (manual, textbook, documentation). • A document in a document base (abstract, patent description, ...). Links between sentences/phrases in a larger text • Textual ordering. • Temporal link (for example, an event precedes another event). Jim saw the bus. He ran to catch it. “saw” precedes “ran” ... discourse analysis (2) • Causal link (for example, reason, effect, prerequisite). Jim saw the bus pull away. He waved to the driver. “waved” could be an effect of “saw” • Coreference: linking references to the same entity. Jim bought a book. He liked it a lot. “he” = Jim, 'it' = book (and “bought” precedes “liked”) Jim bought a book. The price was good. price is a property of books (and it enables buying) Jim bought a book. He paid $10. paying is an element of (is included in) buying Jim bought a book. The dust-jacket was red. dust-jackets are parts of books A look at pragmatics Focus Here is one tiny example from a hypothetical NLP interface to an airline reservation system: I want to fly to Vancouver tomorrow night. There is a flight at 6. When does it arrive? At 8 local time. Is it WestJet? No, Air Canada. Show me others. ← shift of focus Modelling beliefs: who knows what, who believes what. This can be done formally, in advanced forms of logic, for example in autoepistemic logic (check it out). ... pragmatics (2) Plan-based understanding We can use scripts (see textbook, section 7.1.4). Jim was hungry. He stopped at Nate’s deli. A possible line of reasoning: ... pragmatics (3) Speech acts assert—inform—explain; ask if—ask what; order—request. Indirect speech acts The form disagrees with the intention: a question (interrogative) or a statement (declarative) really means something different. Could you pass the salt? a request Do you know that it’s raining? information Honey, Fido needs a shower. a command