PA153 Natural Language Processing 05 - Semantics II (logical representation, from sentence to discourse) Karel Pala, Zuzana Nevěřilová NLP Centre, Fl MU, Brno 23th October 2019 Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 1/29 Q Lexical Meaning and Context Q Context Q Sentential Semantics Q Logical Semantics ^ Verbs as Predicates O Discourse Semantics Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing Lexical Meaning and Context lexical meaning: isolated word meaning (as presented in the lecture Semantics I) autosemantic (plnovýznamové, autosémantické) lexical units (LU): • nouns • adjectives 9 verbs • adverbs free, to can, to leave, so, in fact synsemantic (pomocné, synsémantické) LUs: from, why, how, this, umm Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 3/29 00 CM PA153 Natural Language Processing '—Lexical Meaning and Context Lexical Meaning and Context I lexical meaning: isolated word meaning (as presented in the lecture Semantics I) autosemantic (plnovýznamové, autosémantické) lexical units (LU): O • adjectives t—I O CM Lexical Meaning and Context synsemantic (pomocné, synsémantické) LUs: from, why, how, this, umm Některé LU mají izolovaný význam, uvedené LU jsou do jisté míry protipříklady. Např. černý" znamená „neplatící", ale jen v kolokaci ,,černý pasažér", v anglickém příkladu je to "free" ve v kontextu "freerider". Pomocná a způsobová (modálni) slovesa mají význam oslabený. U některých LU má smysl mluvit o významu skutečně jen v kontextu. Lexical Meaning and Context Krakutel z jejich mrusy se blutkal, načež potom tračil všechny své stěvače. Vyšetřovatel jopuz hrych vlády tre naštval, bruvěž slekym rozzuřil kruky more posluchače. Vyšetřovatel z jejich vlády se naštval, načež potom rozzuřil všechny své posluchače. Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 4/29 I o PA153 Natural Language Processing '—Lexical Meaning and Context Lexical Meaning and Context Krakutel z jejich mrusy se blutkal, načež potom tračil všechny své stěvače. Vyšetřovatel jopuz hrych vlády tre naštval, bruvěž slekym rozzuřil kruky more posluchače. i—I O CM Lexical Meaning and Context Vyšetřovatel z jejich vlády se naštval, načež potom rozzuřil všechny své posluchače. U těchto vět zkusíme určit slovní druhy a větné členy. U té první věty by to mělo být snazší než u té druhé. V první větě jsou plnovýznamová slova nahrazena nesmyslnými slovy, ale koncovka je zachována. V druhé větě jsou nahrazena všechna neplnovýznamová slova, konec slova je opět zachován. Jde o ukázku důležitosti funkčních slov pro pochopení významu věty. Význam těchto slov si uvědomíme právě jen v kontextu věty. When we replace autosemantic words in the sentence by pseudowords with the same endings, we are still able to guess POS or even syntactic function of the pseudoword. However, when we do the same with the synsemantic word, the task becomes more difficult. This toy example demonstrates what are synsemantic words good for. Context 9 verbal context (verbální kontext): what was said, what will follow the surrounding of a word/sentence, not citing entities out of context • situational context (situační kontext): place, time, number and nature of communication partners, their mutual relations) indexicals (deixis) pragmatic presupposition of speaker (presupozice mluvčího) o social context (sociální kontext): education, social group, experience, Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 5/29 Context How to explore the verbal context: • in prehistoric pre-corpus times: introspection • in case of small/medium size corpora: concordance • in case of large corpora: word sketch (slovní profily) kandidát czTenTen12 [Majka] frekvence = 213578 (39.3 v milionu) a_imodifier prezidentský žhavý závislý vhodný republikánský navržený horký opoziční 90268 -1.4 5105 10.02 9.23 2404 4647 9792 1055 1516 2315 745 8.74 8.43 8.34 8.28 8.19 7.42 pc>5t_na post primátor prezident senátor eurokomisara pozice dekan rektor 45490 -7.3 2878 8.8 1617 8.14 3946 7.52 701 7.35 216 7.27 4181 7.2 382 7.15 321 7.03 22232 -0.9 258 7.01 161 6.62 139 6.49 272 6.31 109 6.28 1822 6.11 62 6.1 1 91 6.08 Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 6/29 Context in the Word Sketch How the word sketch is determined it is calculated word sketch grammar there are also multi word sketches □ Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 7/29 Sentential Semantics (větná sémantika) sentence meaning: sentence of individual words + meaning of the syntactic structure Compositionality Principle (princip kompozicionality): • The meaning of the whole is a function of the meaning of the parts and the mode of combining them. • The meaning of a complex expression is uniquely determined by the meaning of its constituents and the syntactic construction used to combine them. Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 8/29 Logical Semantics (logická sémantika) here, logic is the instrument 9 lexical meanings are omitted o predicate structure of verbs or deverbatives is transformed to predicate structure in the logic • sentences are transformed into propositions (having a truth value) Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 9/29 Logical Semantics and Predicate Logic Propositional Logic (výroková logika), usually not strong enough First Order Predicate Logic [Mendelson, 1997] (predikátová logika 1. řádu, FOPL) o terms (termy): variables x, functions f(x) 9 predicate symbols P(x) o logical connectives (logické spojky) V, A, -i, =4>, ^ • quantifiers (kvantifikátory) V, 3 • equality/identity symbol (symbol rovnosti) = • non-logical symbols (mimologické symboly): constants Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 10/29 Logical Semantics and Predicate Logic All students who obtain less than 10 points get the F grade. Vx : Obtain(x, y) A (y < 10) Grade(x, " F") (Obtain(x,y) - x obtained y points, Grade(x, y) - x got the y grade) John obtained 3 points. Obtain? John1,3) Conclusion Obtain? John1, 3) A (3 < 10) Grade? John1," F") is true Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 11/29 Logical Semantics and Predicate Logic: Try it yourself Komu se nelení, tomu se zelení. Every student who takes Analysis also takes Geometry. Vx : Nelenit(x) =4> Zelenit(x) Vx : (Student(x) A 7a/ces(x, Analysis) => 7a/ces(x, Geometry)) Honza se odrazil od podlahy a vyskočil do dvou metrů. John bounced off the floor and jumped up to 2 meters. Odrazit(" Honza1," podlaha1) Vyskočit(" Honza11," 2 metry11) Bounce(" John11," floor11) Jump(" John11, " 2meters11) 05 - Semantics II FOPL Limitations 9 not all NL constructions are propositions, e.g. ► Hello. Nice to meet you. ► If I ever saw one. ► May the force be with you. o not all propositions are distinguishable in FOPL I was there vs. I am there vs. I will be there • not all propositions are 1st order All people have common properties. 3Property\/x : Property (x) 9 not all NL quantifiers exist in FOPL ► vast majority the majority ► many ► a few ► few Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 13/29 Translation from NL to FOPL is by Conventions L/Ve(x,y) - x lives y Neil lives in Brno. L/Ve(" A/e/7"," Brno1) Neil lived on Saturday. L/Ve(" A/e/7" ," Saturday") L/Ve(x,y) - x lives y and y is a place typed logics 05 - Semantics II Verbs as Predicates verbs (and deverbatives) can be considered as predicates, other parts of sentence can be considered as arguments of the predicate valency Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 15 Verbs as Predicates The boy broke the window. A stone flew into the window and broke it. The window broke. to break: AG(person) ART(artifact) INS(instrument) boy person stone instrument window artifact Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 16/29 Valency Lexicons Czech • Vallex: In VALLEX 2.x, there are roughly 2,730 lexeme entries containing together around 6,460 lexical units ("senses"). 1 9 Verba Lex: 2 ► 21,032 literals (verb + sense) ► 10,469 verb lemmata English 9 VerbNet: 8537 total verbs represented 3 1http://ufal.mff.cuni.cz/vallex/2.6/doc/home.html http://nlp.fi.muni.cz/cs/VerbaLex http://verbs.Colorado.edu/verb-index/index.php Karel Pala. Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II Valency Lexicons: Vallex VALLEX 2.6 class functors forms aspect control reflex. recipr. complexity VALEVAL ■ F (10) • zlobit, zlobívat • zlobit se, zlobívat se • zlomit se, zlámat se • zmáčknout, zmačkat • zmáčknout se, zmačkat se • zmáhat, zmoci/zmoct • zmáhat se, zmoci se/zmoct se • zmapovat zmařiť* |~3~| ~ zkazit; zničit frame: ACTf' PAT*1 BEN*P MEANS?P -example: zmaňl celé jednáni' svou nezodpovědností; zmařil mu život -rfl: pass: jeho podvratné plány se naštěstí dopředu zmaňly • H (51) • CH (22) • I [17) • J [13) • K (73) • L (37) • M (53) • N (133) Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 18/29 Valency Lexicons: Verba Lex Verb classes • admit-64 (65) • adopt-91 (4) • allow-63 (69) • animal_sounds-38 (60) • approve-75 (91) assessment-34 (50) ■ void-52 (51) banish-10.2 (55) battle-36.3 (8) bodyinternalmotion-49 (131) build-26.1-4 (7) Verb class "destroy-44~ • babra^ • bořit * bořit2 * bourat^ * bourat, • brakovat^ # brát27 • břřditi * demolovat. zmařitpf zničitpf rozbítpf mařit;' f ničit™pf rozbíjet | 1 | zmařít3, mařily as | 2 | rozbity rozbijet3, zničit^, ničit5 m impf -frame: GROUP institution:1> obl VERB 0DI GROUP il i4 -example: policie rozbila zločinecký gang (pf) obl obl Karel Pala, Zuzana Nevěřilová 'A153 Natural Language Processing Valency Lexicons: VerbNet Roles • Agent [+int_control] • Patient [+concrete] • Instrument [+concrete] Frames NPVNP EXAMPLE "The Romans destroyed the city." syntax Agent V Patient semantics cause(Agent, E) destroyed(result(E), Patient) NPVNP PP.INSTRUMENT EXAMPLE MThe builders destroyed the warehouse with explosives." SYNTAX AGENT V PATIENT {WITH} INSTRUMENT SEMANTICS CAUSE(AGENT, E) USE(DURTNGCE), AGENT, INSTRUMENT) DESTROYED(RESULTCE), PATIENT) NP. INSTRUMENT V NP EXAMPLE MThe explosives destroyed the warehouse/' SYNTAX INSTRUMENT V PATIENT SEMANTICS CAUSE(?AGENT, E) USE(DURTNG(E), ?AGENT, INSTRUMENT) DESTROYED(RESULT(E), PATIENT) Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing Valency Frame and the Meaning zmařitf zničitpf rozbítpf 3 5 3 mařitimpf ničitimpf rozbíjet Verb classes Verb class • admit-64 (65) "destroy 44 ~ • adopt-91 (4) • babrat1 • allow-63 (69) • animal sounds-38 (60) • bořit1 * bořit2 • approve-75 (91) • bourat • assessment-34 (50) ■ m—m • banish-10.2 (55) 1 • bourat, * brakovat3 • battle-36.3 (8) * bnÉt27 * bffdit * demolovat1 • bodyinternal motion-49 (131) • build-26.1^(7) impf -frame: GROUP obl VERB 0D GROUP il i4 -example: policie rozbila zločinecký gang (pf) verb synset (see Word Net synset) translation verb class (verbs of communication, abolition ... [Wu and Palmer, 1994]) verb frames (slovesné rámce) - usage number of slots syntactic information (generic order, grammatical case, preposition) semantic roles selectional restrictions (výběrová omezení) - typical representatives obl obl Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 21/29 Connecting Verb Frames: Building a Network description of stereotypical situations: scripts (scénáře): to buy, to mine, to die • 1970's proposals: Schank, Abelson, Minsky • applications: from 1990's FrameNet 4 4https://framenet.icsi.berkeley.edu/fndrupal/ gljgg US 33 l^íUš&liS 05 - Semantics II 22/29 Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing FrameNet Definition: This transparent noun frame is concerned with ^^s for measuring the \ of regions. Hillary lives in the middle of ^ Paul owns ^ IIiaifelMlrf BTiHBBl. ldACRESlofwhea ■ Semantic Type: Transparent Noun FEs: Core: II Excludes: Occupant The region whose surface is being measured. Klaas has a 10 ^^^^ peach orch Count [; The number of ^^s. Smiley owns [JJJJj fifleenlHECTARESlof prime real estate Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing Discourse Semantics (sémantika diskurzu, utterance meaning) • subword • word • word expression (slovní spojení) • clause (holá věta) • coherent (souvislý) text Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II Discourse Semantics (sémantika diskurzu, utterance meaning) Two coffees and an apple pie. • Would you like to order something? 9 What would you like to pay for? • What did you have for breakfast? 9 What were your dreams about? o What did the guy ask for? • What did the guy attack you with? o What is the presentation about? • ... Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II Discourse Semantics: Anaphora Resolution exophora (extralinguistic, often deictic) What is this! endophora (intralinguistic) 9 anaphora (zpětný odkaz) - Susan dropped the plate. It shattered loudly. • cataphora (dopředný odkaz) - When he arrived home, John went to sleep. • self-reference (koreference): I Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 26/29 Anaphora Types English • pronominal: John found the love of his life • definite nominal phrase: The relationship did not last long. • quantifier/ordinal: He started a new one. • adverb: Fred was angry, and so was I. 9 verb phrase: If Fred buys a new bike, I will do it as well. Czech • pronominal: Petr si ukrojil chleba a snědl ho. o synonym: Petr si ukrojil chleba a pak krajíc snědl. • hyperonym: Petr si ukrojil chleba a pak jídlo snědl. • ellipsis: [Petr] Snědl chleba. Marie taky. Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 27/29 Functional Sentence Perspective aktuální členění větné, funkční větná perspektiva, topic-focus articulation, functional sentence perspective, FSP distinguishes known and new parts of the sentence work of Brno linguist J. Firbas considerable work by Prague Linguistic Circle (V. Mathesius, currently E. Hajicova) topic, theme (téma) - comment, rheme, focus (réma) The dog bit the little girl. The little girl was bitten by the dog. Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 28/29 References Mendelson, E. (1997). Introduction to Mathematical Logic. Discrete Mathematics and Its Applications Series. Chapman & Hall. Wu, Z. and Palmer, M. (1994). Verbs semantics and lexical selection. In Proceedings of the 32nd annual meeting on Association for Computational Linguistics, ACL '94, pages 133-138, Stroudsburg, PA, USA. Association for Computational Linguistics. Karel Pala, Zuzana Nevěřilová PA153 Natural Language Processing 05 - Semantics II 29/29