formale semantik in prolog -...
TRANSCRIPT
![Page 1: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/1.jpg)
Formale Semantik in PrologZürich 2010 edition
Thomas Hanneforth
![Page 2: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/2.jpg)
Themenübersicht
Wiederholung: Grundprinzipien der formalen Semantik
Semantikkonstruktion: Frage- und Relativsätze
Quantorenskopus: Cooper-Storage
Modelltheorie in Prolog
![Page 3: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/3.jpg)
Ablaufplan für diese Woche
Tag
Mo Kurze Einführung in Prolog:Termunifikation und DCGsGrundprinzipien der formalen SemantikSemantikkonstruktion in Prolog I
Di Semantikkonstruktion in Prolog II
Mi Semantikkonstruktion in Prolog III
Do Quantorenskopus: Cooper Storage
Fr Modelltheorie in Prolog
![Page 4: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/4.jpg)
Semantikkonstruktion
Eine kompositionale Semantik für eine natürliche wie formale Sprache erfordert, dass jeder syntaktischen Konstituente ein semantischer Wert zugewiesen wird.
Da die Prädikatenlogik nur ganzen Sätzen eine Bedeutung zuweisen kann, braucht man den Begriff der Funktion, um festzuhalten, dass einigen Konstituenten noch Informationen fehlen.
Eine Funktion ist eine mathematische Entität, die Argumente nimmt und ein Resultat liefert.
Das -Kalkül ist nun eine Methode, um Funktionen samt ihren fehlenden Argumenten syntaktisch zu notieren.
![Page 5: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/5.jpg)
Semantikkonstruktion
Beispiele:
x x2 ist eine Funktion von reellen Zahlen in die reellen Zahlen, technisch R R.
x Studentin(x) ist eine Funktion von Individuen nach Wahrheitswerten, technisch e t.
xy kennt(x,y) ist eine zweistellige Funktion von Individuen nach Wahrheitswerten ( e e t ), oder anders ausgedrückt e (e t).
![Page 6: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/6.jpg)
Semantikkonstruktion: Übersetzung syntaktischer Ausdrücke
Syntaktische Kategorie Ausdruck der PL1
Nomen (Gattungsnamen)Haus
1-stellige Prädikatex Haus(x)
Relationale NomenSohn
2-stellige Prädikatexy Sohn(x,y)
Verben mit n Argumentenschlafenkennengeben
n-stellige Prädikatex schlafen(x)xy kennen(x,y)xyz geben(x,y,z)
Präpositionenaufzwischen
2- oder 3-stellige Prädikatexy auf(x,y)xyz zwischen(x,y,z)
Schnittmengenbildende Adjektive rot
1-stellige Prädikatex rot(x)
![Page 7: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/7.jpg)
Semantikkonstruktion: Übersetzung syntaktischer Ausdrücke
Aus dem Rahmen der Prädikatenlogik 1. Stufe fallen:
Klasse sprachlicher Ausdrücke Beispiel
Prädikatmodifikatoren angeblich
Verben mit propositionalen Argumenten
glauben
Verben mit intensionalenArgumenten
suchen
Quantifikation über Prädikate die Eigenschaften von Napoleon
![Page 8: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/8.jpg)
Semantikkonstruktion: Übersetzung
Die Konstruktion einer semantischen Repräsentation für eine syntaktische Struktur kann als Übersetzungsvorgangaufgefasst werden.
Die einfachste Technik der Semantikkonstruktion besteht darin, mit jeden syntaktischen Regel eine semantische Regel zu verknüpfen.
Diese Technik nennt man auch syntaxgerichtete Übersetzung (engl. rule-by-rule-semantics).
Jede syntaktische Teilstruktur besitzt dabei ein semantisches Denotat.
Die Übersetzungsfunktion ist ein Homomorphismus.
![Page 9: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/9.jpg)
Semantikkonstruktion: Homomorphismus
Gegeben zwei algebraische Strukturen (A,{fi}) und (B, {gi}) [A und B sind Mengen, {fi} und {gi} denotierenMengen von i-stelligen Funktionen]. Ein Homomorphismus h: A B ist eine Funktion:
h(fk(x1 … xk)) = gk(h(x1) … h(xk))
Für i = 2 kann das vereinfacht dargestellt werden als:h(x y) = h(x) h(y)
Homomorphismen formalisieren das Kompositionalitätsprinzip.
![Page 10: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/10.jpg)
Semantikkonstruktion:Syntaxgerichtete Übersetzung
Syntaxregel Übersetzungsfunktion T
S NP VP T(S) = T(VP) (T(NP))
VP V NP T(VP) = T(V) (T(NP))
V liebt T(liebt) = xy liebt(y,x)
NP Hans T(Hans) = Hans’
NP Maria T(Maria) = Maria’
Beispiel:
Die Bedeutung von S und VP werden durch Funktionalapplikation bestimmt.
![Page 11: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/11.jpg)
Semantikkonstruktion:Syntaxgerichtete Übersetzung
Eine semantische Repräsentation für einen Satz kann dann bottom-up konstruiert werden.
Beispiel: Semantische Repräsentation von „Hans liebt Maria“
S
NP VP
V NP
y liebt(y,Maria')
Maria' yx liebt(y,x)
Hans'
liebt(Hans',Maria')
![Page 12: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/12.jpg)
Semantikkonstruktion:Syntaxgerichtete Übersetzung
Nicht immer korrespondieren syntaktische und semantische Strukturen auf so direkte Weise:
Beispiel:Übersetzung von „Jede Studentin kennt einen Dozenten“
" Studentin kenntx $y (Dozent (x) (y) ( x , y ))
jede
einen
![Page 13: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/13.jpg)
Semantikkonstruktion:Syntaxgerichtete Übersetzung
Um die Semantik von Quantoren wie jede oder einekompositionell angeben zu können, ist es nötig, Elemente von höherwertigen Logiken in den Repräsentationsformalismus einzuführen.
Natürlichsprachliche Quantoren wie jede(r), alle oder ein(e)werden im Rahmen der Montague-Grammatik folgendermaßen übersetzt:
Die natürlichsprachlichen Quantoren werden dabei auf die beiden Standardquantoren der Prädikatenlogik, $ und "abgebildet.
jede/r PQ ["x P(x) Q(x)]
ein/e PQ [$x P(x) Q(x)]
![Page 14: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/14.jpg)
Semantikkonstruktion: Nominalphrasen
Die bisherige Annahme, Nominalphrasen seien vom Typ e, denotierten also Individuen, kann nun nicht mehr aufrechterhalten werden.
Vielmehr haben Nominalphrasen nun den semantischen (Funktions-) Typ (e → t) → t.
Beispiel: NP „Jede Studentin“
T(Jede)(T(Studentin)) =FA
PQ ["x (P(x) Q(x))](y studentin(y)) =-Konv
Q ["x (y studentin(y)(x) Q(x))] =-Konv
Q ["x (studentin(x) Q(x))]
![Page 15: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/15.jpg)
Semantikkonstruktion: Determinantien
Determinantien (jede, ein, die meisten, …) sind also Funktionen, die nominale und verbale Denonate miteinander in Beziehung setzen.
Ihr semantischer Funktionstyp ist demnach(e → t) → ((e → t) → t)
Beispiel:
P Q ["x P(x) Q(x)]
Beitrag der nominalen Komponente (vom Typ e → t),
z.B. y studentin(y)
Beitrag der verbalen Komponente (vom Typ e → t),
z.B. z kennt(z,hans)
Funktionaler Beitrag von „jede“
![Page 16: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/16.jpg)
Semantikkonstruktion in Prolog
In Prolog können komplexe Terme zur Repräsentation von Ausdrücken des –Kalküls verwendet werden.
Logische Variablen können mit Prolog-Variablen übersetzt werden (dies hat jedoch Vor- und Nachteile).
BeispielDer Ausdruck xy liebt(x,y) kann wie folgt übersetzt werden:
lambda(X,lambda(Y,liebt(X,Y)))
![Page 17: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/17.jpg)
Semantikkonstruktion in Prolog
Zur besseren Lesbarkeit verwendet man für lambda/2 den in Prolog bereits definierten Infix-Funktor ^.
BeispielDer Ausdruck xy liebt(x,y) in Prolog-Infix-Notation:
X^Y^liebt(X,Y)
^ ist rechtsassoziativ, d.h. der obige Ausdruck ist implizit als
X^(Y^liebt(X,Y))
geklammert.
![Page 18: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/18.jpg)
Semantikkonstruktion in Prolog
Für die Funktionalapplikation (Anwendung einer Funktion auf ein Argument) definiert man ein dreistelliges Prädikat
fa(Funktion,Argument,Resultat)
Beispiel:Anwendung der Funktion X^Y^liebt(Y,X) auf das Argument maria:
?- fa(X^Y^liebt(X,Y),maria,R).
R = Y^liebt(maria,Y)
fa/3 ist dabei wie folgt definiert:
fa(Arg^Func,Arg,Func).
![Page 19: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/19.jpg)
Semantikkonstruktion in Prolog
Das in Prolog implementierte -Kalkül kann nun mit Phrasenstrukturregeln verknüpft werden, um die logische Form einer syntaktischen Struktur zu konstruieren.
Mit den Nichtterminalsymbolen einer syntaktischen Regel werden semantische Repräsentationen verknüpft, die mittels Funktionalapplikation aufeinander bezogen werden.
![Page 20: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/20.jpg)
Semantikkonstruktion in Prolog
Beispiel: Grammatikfragment
Phrasenstrukturregeln
s(SSem) --> np(NPSem), vp(VPSem), {fa(VPSem,NPSem,SSem)}.vp(VPSem) --> v(VSem), np(NPSem), {fa(VSem,NPSem,VPSem)}.vp(VPSem) --> iv(VPSem).np(NPSem) --> eigenname(NPSem).
Lexikon
tv(X^Y^kennt(Y,X)) --> [kennt]. iv(X^raucht(X)) --> [raucht]. eigenname(maria) --> [maria].eigenname(hans) --> [hans].
Funktionalapplikation
fa(A^F,A,F).
![Page 21: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/21.jpg)
Semantikkonstruktion in Prolog
Da fa/3 deterministisch ist, kann seine Wirkung im Voraus berechnet werden (sog. partial execution, unfolding) :
Beispiel: Grammatikfragment
Phrasenstrukturregeln
s(SSem) --> np(NPSem), vp(NPSem^SSem).vp(VPSem) --> v(NPSem^VPSem), np(NPSem).vp(VPSem) --> iv(VPSem).np(NPSem) --> eigenname(NPSem).
Lexikon
tv(X^Y^kennt(Y,X)) --> [kennt]. iv(X^raucht(X)) --> [raucht]. eigenname(maria) --> [maria].eigenname(hans) --> [hans].
![Page 22: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/22.jpg)
Semantikkonstruktion in Prolog
Repräsentation weiterer semantischer Kategorien
Ausdruck PL1-Repräsentation Prolog-Repräsentation
Jede/r PQ["x P(x) Q(x)]
(X^P)^(X^Q)^every(X,P=>Q)P^Q^every(X,P(X) => Q(X))
Ein/e PQ [$x P(x) Q(x)]
(X^P)^(X^Q)^some(X,P & Q)
Maria P P(maria) (maria^P)^P
![Page 23: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/23.jpg)
Semantikkonstruktion in Prolog
Beispiel:np(NP) --> det(N^NP), n(N).
Beispiel: Konstruktion der SF für „jede Studentin“:
det((X^P)^(X^Q)^every(X,P => Q)) --> [jede].n(Z^studentin(Z)) --> [studentin].
?- phrase(np(Sem),[jede,studentin]). Sem = (X^Q)^every(X,studentin(X) => Q)
![Page 24: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/24.jpg)
Semantikkonstruktion in Prolog
Beispiel: DCG mit Semantikkomponente
Phrasenstruktur
s(S) --> np(VP^S), vp(VP).np(NP) --> det(N^NP), n(N). np(NP) --> det(R^NP), n(N), rel(N^R).np((N^P)^P) --> eigenname(N).vp(X^P) --> tv(X^IV), np(IV^P). % V2vp(X^P) --> np(IV^P), tv(X^IV). % V-finvp(IV) --> iv(IV).rel((X^S1)^(X^(S1 & S2))) --> relpron, vp(X^S2).
![Page 25: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/25.jpg)
Semantikkonstruktion in Prolog
Beispiel: DCG mit Semantikkomponente
Lexikalische Einsetzungsregeln
det(LF) --> [D], {det(D,LF)}.n(LF) --> [N], {n(N,LF)}.eigenname(LF) --> [N], {eigenname(N,LF)}.iv(LF) --> [V], {iv(V,LF)}.tv(LF) --> [V], {tv(V,LF)}.relpron --> [R], {relpro(R)}.
![Page 26: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/26.jpg)
Semantikkonstruktion in Prolog
Beispiel: DCG mit Semantikkomponente
Lexikon
det(jede, (X^P)^(X^Q)^every(X,P => Q)).det(einen, (X^P)^(X^Q)^some(X,P & Q)).n(studentin, X^studentin(X)).n(dozenten, X^dozent(X)).eigenname(maria, maria).iv(schläft, X^schläft(X)).tv(kennt, X^Y^kennt(X,Y)).relpro(der).relpro(die).relpro(das).
![Page 27: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/27.jpg)
Semantikkonstruktion in Prolog
Beispiel: Maria schläft
S
NP VP
Eigenname
Maria
IV
schläftmaria
(maria^P)^P
X^schläft(X)
X^schläft(X)
schläft(maria)
![Page 28: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/28.jpg)
Semantikkonstruktion in Prolog
Beispiel: Jede Studentin kennt einen Dozenten:
S
NP
VP
Art N
NP
Art NV
X^Y^kennt(X,Y)(X^P)^(X^Q)^every(X,P=>Q) (X^P)^(X^Q)^some(X,P&Q) Y^doz(Y)X^stud(X)
jede Studentin kennt einen Dozenten
(Y^Q)^some(Y,dozent(Y) & Q)(X^Q)^every(X,studentin(X) => Q)
X^some(Y,dozent(Y) & kennt(X,Y))
every(X,studentin(X) => some(Y,dozent(Y) & kennt(X,Y)))
![Page 29: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/29.jpg)
Semantikkonstruktion in Prolog
Beispiel: Logische Form von NPen mit restriktiven Relativsätzen„jeder Dozent, der eine Studentin kennt“:
Phrase Übersetzung
jeder (X^P)^(X^Q)^every(X,P=>Q)
Dozent X^dozent(X)
eine Studentin (X^Q)^some(X,studentin(X) & Q)
kennt X^Y^kennt(X,Y)
eine Studentin kennt X^some(Y,studentin(Y) & kennt(X,Y))
der eine Studentin kennt
(X^S1)^(X^(S1 & some(Y,studentin(Y) & kennt(X,Y))))
jeder Dozent, der eine Studentin kennt
(X^Q)^every(X,(dozent(X) & some(Y,studentin(Y) & kennt(X,Y))) => Q)
![Page 30: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/30.jpg)
Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen
Viele Grammatikformalismen verwenden spezielle Merkmale (SLASH, NONLOC), um Informationen über bewegte Elemente im Strukturbaum zu verteilen.
In den Definite-Clause-Grammatiken von Prolog kann das beispielsweise durch eine weitere Argumentstelle erreicht werden.
Beispiel: Grammatik für Fragesätzes(nogap) --> w_pron, s(gap).s(nogap) --> np(nogap), vp(nogap).s(gap) --> np(gap), vp(nogap).s(gap) --> vp(gap), np(nogap).vp(GapInfo) --> tv, np(GapInfo).vp(nogap) --> iv.
np(gap) --> []. % Einführung von Spuren
![Page 31: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/31.jpg)
Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen
Beispiel: Strukturbaum für „Wen liebt Maria?“
s(nogap)
s(gap)
np(nogap)
np(gap)
Weni liebt Maria
tv
ti
w_pron
vp(gap)
![Page 32: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/32.jpg)
Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen
Diese Technik führt jedoch zur unerwünschten Multiplikation der Phrasenstruktur-Regeln.
Eine Alternative stellt das sog. Gap-Threading dar. Dabei erhält jede Konstituente zwei Listen: In und Out, die die zu findenden Lücken enthalten.
![Page 33: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/33.jpg)
Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen
Beispiel: Grammatik für Fragesätze mit Gap-Threading
s(In-Out --> w_pron(Case), s([gap(Case)|In]-Out).s(In-Out) --> np(nom,In-IO), vp(IO-Out).s(In-Out) --> vp(In-IO), np(nom,IO-Out).vp(In-Out) --> tv, np(acc,In-Out).vp(In-In) --> iv.np(C,In-In) --> eigenname(C,N).np(C,[gap(C)|R]-R) --> []. % Einf. von Spuren
Lexikon
eigenname(C) --> [daisy], { member(C,[nom,acc,dat]) }.eigenname(C) --> [donald], { member(C,[nom,acc,dat]) }.w_pron(nom) --> [wer].w_pron(acc) --> [wen].tv --> [kennt].iv --> [rennt].
![Page 34: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/34.jpg)
Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen
Beispiel: Strukturbaum für „Wen liebt Maria?“
s([]-[])
s([gap(acc)]-[])
np(nom,[]-[])
np(acc, [gap(acc)]-[])
Weni liebt Maria
tv
ti
w_pron(acc)
vp([gap(acc)]-[])
eigenname(nom)
Instantiierung
Realisation
Perkolation
![Page 35: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/35.jpg)
Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen
Bei bewegten Konstituenten ist die Konstruktion der logischen Form etwas komplexer, da das bewegte Element und die Spur auch semantisch koindiziert sein müssen.
Beispiel:
Die Nominalphrase
[ein Dozent]i, den jede Studentin ti kennt
wird übersetzt in
(X^Q)^some(X,(dozent(X) & every(Y,studentin(Y),kennt(Y,X))),Q)
semantische Koindizierung
![Page 36: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/36.jpg)
Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen
Die semantische Identität der bewegten Konstituente muss daher an die Spur weitergereicht werden.
Beispiel:
DCG-Regeln für Nominalphrasen mit Objektsrelativsätzen
np(NP) --> det(N^R), n(N), rel(N^R).rel((X^S1)^(X^(S1&S2))) --> relpron, s(S2,gap(np,X)).
Weiterreichen der semantischen Identität
Spuren werden durch folgende DCG-Regel erzeugt:
np((X^P)^P, gap(np,X)) --> [].
Die „heruntergereichte“ Variable wird zur -Abstraktion verwendet, d.h. die Spur verhält sich wie ein Pronomen.
![Page 37: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/37.jpg)
Semantikkonstruktion in Prolog: Fragesätze
Für die Konstruktion einer semantischen Form für Fragesätze müssen verschiedene Fragetypen unterschieden werden:
Entscheidungsfragen
Satzgliedfragen
Mehrfachfragen
![Page 38: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/38.jpg)
Semantikkonstruktion in Prolog: Fragesätze
Satzgliedfragen, d.h. Fragen mit einem bewegten Element können als einstellige Prädikate aufgefasst werden:
Frage Übersetzung
Wer kennt Donald?(Subjektsfrage)
X^(person(X) & kennt(X,donald))
Wen kennt Donald?(Objektsfrage)
X^(person(X) & kennt(donald,X))
Welcher Dozent kennt Daisy?
X^(dozent(X) & kennt(X,daisy))
Mit was sieht Donald Daisy?
X^(ding(X) & sieht(donald,daisy,X))
![Page 39: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/39.jpg)
Semantikkonstruktion in Prolog: Fragesätze
Fragepronomen und W-Determinantien haben dann in etwa folgende semantische Repräsentationen:
W-Wort -PL1 Prolog
Wer P x [person(x) P(x)] (X^P)^(X^(person(X) & P))
Was P x [ding(x) P(x)] (X^P)^(X^(ding(X) & P))
Welche P Q x [P(x) Q(x)] (X^P)^(X^Q)^(X^(P & Q))
![Page 40: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/40.jpg)
Semantikkonstruktion in Prolog: Fragesätze
Beispiel:
„Welche Studentin“ wird übersetzt zu:
(X^Q)^(X^(studentin(X) & Q))
„Welche Studentin raucht“ wird somit zu:
X^(studentin(X) & raucht(X))
Dies notiert die Schnittmenge der Studentinnen mit den Rauchenden.
![Page 41: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/41.jpg)
Semantikkonstruktion in Prolog: Fragesätze
Hieraus ergibt sich eine DCG-Regel für einfache Satzgliedfragen:
question(QSem) -->
wh_phrase(WFeat,(X^S)^QSem),
s([gap(np,WFeat,X)]-[],S).
w_phrase(Feat,Sem) -->
np(Feat,G-G,Sem).
![Page 42: Formale Semantik in Prolog - TAGHtagh.de/tom/wp-content/uploads/Formale_Semantik_in_Prolog_Zh1.pdf · Semantikkonstruktion in Prolog: Konstituenten mit bewegten Elementen Viele Grammatikformalismen](https://reader030.vdocuments.pub/reader030/viewer/2022040219/5e14d0fdbd7a59612d52b6f5/html5/thumbnails/42.jpg)
Semantikkonstruktion in Prolog: Fragesätze
Dieses Verfahren, das nur eine „bewegte“ W-Phrase zulässt, kann auch bei Mehrfachfragen wie „Wer kennt wen?“ angewendet werden, da eine W-Phrase „in situ“ verbleibt.
Beispiel:
?- phrase(question(Sem),[wer,kennt,donald]).Sem = X^(person(X) & kennt(X,donald))
?- phrase(question(Sem),[wen,kennt,donald]).Sem = X^(person(X) & kennt(donald,X))
?- phrase(question(Sem),[wer,kennt,wen]).Sem = X^(person(X) & (Y^(person(Y) & kennt(X,Y)))