Chart-Parsing Prolog Aufbaukurs SS 2000 Heinrich-Heine-Universität Düsseldorf Christof Rumpf.

Slides:



Advertisements
Ähnliche Präsentationen
Weihnachten (Christmas)
Advertisements

Kapitel 1 test review. A. Complete the sentence with a word from the box. zB. Glück Haltestellte 1.Wir haben _______, weil die Prüfung leicht ist. 2.
Steinbeis Forschungsinstitut für solare und zukunftsfähige thermische Energiesysteme Nobelstr. 15 D Stuttgart WP 4 Developing SEC.
Peter Marwedel TU Dortmund, Informatik 12
Subjects and Direct Objects When to use der vs. den.
Wenn…… the conditional. Using the conditional tense The conditional tense is used to talk about something that happens only after something else happened.
Welcome DTD. Document Type Definition Graphic Services/Everything you already know about presentations Was ist eine DTD? DTD ist eine Schemasprache.
Vorschau Prolog Aufbaukurs SS 2003 Heinrich-Heine-Universität Düsseldorf Christof Rumpf.
PATR II Compiler Prolog Aufbaukurs SS 2000 Heinrich-Heine-Universität Düsseldorf Christof Rumpf.
Parsing Prolog Aufbaukurs SS 2000 Heinrich-Heine-Universität Düsseldorf Christof Rumpf.
Los! Find vocab for the following categories
Das Perfekt Wiederholen (hoffentlich!). Think of 5 things you did in your holidays but think of sentences in the PRESENT TENSE. 1.Am Montag schlafe ich.
Die Hausaufgaben: Machen Sie Ü. 7 auf S. 29
Abkürzungen mit Präpositionen German Prepositional Contractions
Tag um Tag, Jahr um Jahr, Tag um Tag, Jahr um Jahr, Day by day, year by year, Wenn ich durch diese Straßen geh', When I go through these streets, Seh ich.
Question words and word order By the end of this lesson you will have revised question words By the end of this lesson you will be able to use question.
Laurie Clarcq The purpose of language, used in communication, is to create a picture in the mind and/or the heart of another.
Write the answers to these questions down on a piece of paper from your notebook. Was bedeutet Alles kann besser werden auf Engisch? What are some social.
Institut AIFB, Universität Karlsruhe (TH) Forschungsuniversität gegründet 1825 Towards Automatic Composition of Processes based on Semantic.
| DC-IAP/SVC3 | © Bosch Rexroth Pneumatics GmbH This document, as well as the data, specifications and other information set forth in.
Das Perfekt (Present Perfect Tense). Think of 5 things you did in your holidays but think of sentences in the PRESENT TENSE. 1.Am Montag schlafe ich viel.
VOCABULARY SOCCER QUESTIONS PRESENT CONTINOUS WORDLIST – CELL PHONE Unit 2 - Trainer.
BAS5SE | Fachhochschule Hagenberg | Daniel Khan | S SPR5 MVC Plugin Development SPR6P.
Christoph Durt: Wittgenstein on the possibility of philosophy: The importance of an intercultural approach
Deutsch 1 G Stunde. Montag, der 10. September 2012 Deutsch 1 (G Stunde)Heute ist ein D - Tag Unit: Introduction to German & Germany Objectives: Introducing.
Die Zukunft The future I will.
You need to use your mouse to see this presentation
You need to use your mouse to see this presentation © Heidi Behrens.
You need to use your mouse to see this presentation © Heidi Behrens.
You need to use your mouse to see this presentation © Heidi Behrens.
You need to use your mouse to see this presentation © Heidi Behrens.
You need to use your mouse to see this presentation © Heidi Behrens.
Wortschatz der Schulhof the playground die Aula the hall
From “Deutsch: Na Klar! 5th Edition”
DEUTSCHLAND UND DIE MEDIEN
DEUTSCHLAND UND DIE MEDIEN
Guten Morgen!.
Verben Wiederholung Deutsch III Notizen.
Deutsch für Anfänger Beginning German
The most obvious or direct use of auch is to mean also. Ich möchte auch Gitarre lernen. Auch ich möchte Gitarre lernen. I would like to learn Guitar. Someone.
Design Patterns Ein Muster (pattern) ist eine Idee, die sich in einem praktischen Kontext als nützlich erwiesen hat und dies auch in anderen sein wird.
External Labels – The rules For all external labels the following rules apply (external labels are all labels which are not inside of a shape) - all labels.
© Boardworks Ltd of 8 Time Manner Place © Boardworks Ltd of 8 This icon indicates that the slide contains activities created in Flash. These.
Negation is when you dont have or dont do something.
Adjectiv Endungen Lite: Adjective following articles and pre-ceeding nouns. Colors and Clothes.
8.1 Lektion 8 Recht und Umwelt STRUKTUREN © and ® 2012 Vista Higher Learning, Inc Der Konjunktiv II and würde with infinitive Ja, aber ich würde.
Deutsch I für Anfänger SMA NEGERI MOJOAGUNG Introduction to German Verb Conjugation.
To school => zu der Schule With friends => mit den Freunden On top of the desk => auf dem Schreibtisch Through the wall => durch die Wand.
Separable Verbs Turn to page R22 in your German One Book R22 is in the back of the book There are examples at the top of the page.
1 Intern | ST-IN/PRM-EU | | © Robert Bosch GmbH Alle Rechte vorbehalten, auch bzgl. jeder Verfügung, Verwertung, Reproduktion, Bearbeitung,
Passiv What are these sentences expressing?
Launch ON Global.vi System ID object name classname Services to suscribe Observer Control Ref vi-path Service name Step 1 : Objects register to the Global.vi´s,
Adjective Endings Nominative & Accusative Cases describing auf deutsch The information contained in this document may not be duplicated or distributed.
Wie sammeln wir Wortschatz? How do we collect vocabulary?
You need to use your mouse to see this presentation
By Martin L. Loeffler.  The basic sentence has a subject and a verb.  The subject and verb need to be together.  The subject and verb need to agree.
Page 1 XXX21/08/2014 Implemented by Benutzen Sie diese Titelfolie für Programme und Projekte im Ausland. Setzen Sie das „einheitliche Logo der Zusammenarbeit“
Warm-up: Kickers ‘ob’, ‘dass’, ‘weil’
Data Mining Spectral Clustering Junli Zhu SS 2005.
Adjective Declension in German
Der formelle Imperativ – the Imperative
You need to use your mouse to see this presentation © Heidi Behrens.
You need to use your mouse to see this presentation © Heidi Behrens.
Memorisation techniques
ENVIRONMENT PROBLEMS What can I do? Pineapples Traffic  Use public vehicles  Use more bike and go by walking  There should be a filter in every car.
How to play: Students are broken up into 2-3 teams (depending on class size). Students can see the game board and the categories, but not point values.
DAS VIERTE DEUTSCHE KASUS Genitiv. Kasus ● What is a case? A case shows the grammatical function of a word. ● There are four cases in German. Up to now.
Volume 1, Chapter 8.
I use this as a starter, often at the start of a revision lesson at the end of a topic . Students work in pairs. Give each pair a copy of the blank grid.
Students have revised SEIN and HABEN for homework
 Präsentation transkript:

Chart-Parsing Prolog Aufbaukurs SS 2000 Heinrich-Heine-Universität Düsseldorf Christof Rumpf

Chart-Parsing2 Chart-Parser Ein Chart-Parser speichert Information über bereits geparste Teilstrukturen in einer Tabelle (Chart). Bereits geleistete Arbeit kann beim Backtracking aus der Tabelle gelesen werden.

Chart-Parsing3 Motivation: trashing VP V NP PP D N P NP D N chased the cat into the garden VP V NP VP V NP PP

Chart-Parsing4 Chart In der Tabelle wird für jede Konstituente ein Eintrag gespeichert: –Name der Konstituente –wo sie beginnt –wo sie endet Beispiel chart(np,[the,cat,into,the,garden],[into,the,garden]).

Chart-Parsing5 Top-Down-Chart-Parser parse(C,S1,S) :- chart(C,S1,S). parse(C,[Word|S],S) :- word(C,Word). parse(C,S1,S) :- rule(C,Cs), parse_list(Cs,S1,S), asserta(chart(C,S1,S)). parse_list([C|Cs],S1,S) :- parse(C,S1,S2), parse_list(Cs,S2,S). parse_list([],S,S). clear_chart :- abolish(chart/3).

Chart-Parsing6 Numerische Repräsentation der Positionen chart(np,[the,cat,into,the,garden],[into,the,garden]). chart(np,0,2). ?.- parse(s,0,8). yes [the,dog,sees,the,cat,near,the,elephant] c(the,0,1). c(dog,1,2). c(sees,2,3). c(the,3,4). c(cat,4,5). c(near,5,6). c(the,6,7). c(elephant,7,8). Chart StringAnfrage kompaktere Repräsentation!

Chart-Parsing7 Numerischer Chart-Parser parse(C,S1,S) :- chart(C,S1,S). parse(C,S1,S) :- c(Word,S1,S), word(C,Word). parse(C,S1,S) :- rule(C,Cs), parse_list(Cs,S1,S), asserta(chart(C,S1,S)). parse_list([C|Cs],S1,S) :- parse(C,S1,S2), parse_list(Cs,S2,S). parse_list([],S,S). clear_chart :- abolish(chart/3).

Chart-Parsing8 Vollständigkeit Der bisherige Chart-Parser verschwendet mehr Ressourcen, als er einspart, weil Chart und Regeln konkurrieren. Lösung: Chart muss vollständig sein. Positive wie negative Information über Konstituenten muss vollständig gespeichert sein.

Chart-Parsing9 Chart-Parser mit Completeness-Check parse(C,[Word|S],S) :- word(C,Word). parse(C,S1,S) :- complete(C,S1), !, chart(C,S1,S). parse(C,S1,S) :- rule(C,Cs), parse_list(Cs,S1,S2), asserta(chart(C,S1,S2)), S2 = S. parse(C,S1,_) :- asserta(complete(C,S1)), fail. parse_list([C|Cs],S1,S) :- parse(C,S1,S2), parse_list(Cs,S2,S). parse_list([],S,S). clear_chart :- abolish(chart/3), abolish(complete/2).

Chart-Parsing10 Subkategorisierung rule(vp,[verbal(0)]). rule(vp,[verbal(X),rest_of_vp(X)]). rule(rest_of_vp(1),[np]). rule(rest_of_vp(2),[np,np]). rule(verbal(X),[v(X)]). rule(np,[d,n]). word(n,dog). word(n,dogs). word(n,cat). word(n,cats). word(n,elephant). word(n,elephants). word(v(0),sleep). word(d,the). word(v(1),see). word(v(2),give). ?- parse(vp,[see,the,dog],[]). no Problem: Komplexe Konstituenten mit Argumenten stehen in einer Subsumptionshierarchie.

Chart-Parsing11 Subsumption Ein Term A subsumiert einen Term B gdw. –A und B sind unifizierbar. –B ist nach der Unifikation nicht spezifischer als vorher. Beispiel: f(X, b) f(a, b) f(a, b) f(X, b)

Chart-Parsing12 Subsumptions-Check parse(C,S1,S) :- complete(C0,S1), subsumes_chk(C0,C), !, C0 = C, chart(C,S1,S). subsumes_chk(T1,T2) :- \+ ( varnames(T2), \+ (T1 = T2) ). C muss spezifischer sein als C0 bzw. C0 muss genereller sein als C. (O´Keefe)

Chart-Parsing13 Earley´s Algorithmus Komplexität n 3 (optimal). Behandelt leere Konstituenten. Loopt nicht bei Linksrekursion. Kombiniert top-down und bottom-up. Kein Backtracking: Nach dem Parse befinden sich alle Alternativen im Chart. Ist ein active chart parser.

Chart-Parsing14 Earley: Active Chart Parsing S NP VP 0 0 S NP VP 0 2 S NP VP 0 3 chart(s,[the,dog,barked],[np,vp],[the,dog,barked]). chart(s,[the,dog,barked],[vp],[barked]). chart(s,[the,dog,barked],[],[]). parse(s,[the,dog,barked],[]). Aktive Konstituenten sind solche, die an der aktuellen Position der Eingabekette als nächste geparst werden sollen.

Chart-Parsing15 Earley: Chart-Einträge Die gesuchte Konstituente. Die Position, an der die gesuchte Konstituente beginnt. Die Subkonstituenten, die noch geparst werden müssen. Die erste davon ist die aktive. Die aktuelle Position im Input-String. chart(s,[the,dog,barked],[np,vp],[the,dog,barked]). chart(s,[the,dog,barked],[vp],[barked]). chart(s,[the,dog,barked],[],[]).

Chart-Parsing16 Earley-Chart: the dog chases the cat chart(start,[the,dog,chases,the,cat],[s], [the,dog,chases,the,cat]). chart(s, [the,dog,chases,the,cat],[np,vp],[the,dog,chases,the,cat]). chart(np, [the,dog,chases,the,cat],[d,n], [the,dog,chases,the,cat]). chart(np, [the,dog,chases,the,cat],[n], [dog,chases,the,cat]). chart(np, [the,dog,chases,the,cat],[], [chases,the,cat]). chart(s, [the,dog,chases,the,cat],[vp], [chases,the,cat]). chart(vp, [chases,the,cat],[v,np], [chases,the,cat]). chart(vp, [chases,the,cat],[v,np,pp], [chases,the,cat]). chart(vp, [chases,the,cat],[np], [the,cat]). chart(vp, [chases,the,cat],[np,pp], [the,cat]). chart(np, [the,cat],[d,n], [the,cat]). chart(np, [the,cat],[n], [cat]). chart(np, [the,cat],[], []). chart(vp, [chases,the,cat],[], []). chart(s, [the,dog,chases,the,cat],[], []). chart(start,[the,dog,chases,the,cat],[], []). chart(vp, [chases,the,cat],[pp], []).

Chart-Parsing17 Earley´s 3 Komponenten Predictor –Sucht nach Regeln, die die aktiven Konstituenten expandieren. Scanner –Akzeptiert Wörter der Eingabekette. Completer –Verwendet den Output des Scanners um übergeordnete Konstituenten zu vervollständigen.

Chart-Parsing18 Earley-Parser: Das Gerüst % parse(+C,+S1,-S) % Parse a constituent of type C from input string S1, % leaving remainder of input in S. parse(C,S1,S) :- clear_chart, store(chart(start,S1,[C],S1)), process(S1), chart(C,S1,[],S). % process(+Position) % Starting with input string Position, work through % the Earley parsing process. process([]) :- !. process(Position) :- predictor(Position), scanner(Position,NewPosition), completer(NewPosition), process(NewPosition).

Chart-Parsing19 Predictor: Beschreibung Für alle aktiven Konstituenten (1. Element in Chart-Spalte 3): –finde alle Syntaxregeln, die diese Konstituenten expandieren und generiere entsprechende Chart-Einträge. –Expandiere auch die so neu hinzugekommenen Konstituenten.

Chart-Parsing20 Predictor: Code % predictor(+Position) % Creates new goals using syntax rules. predictor(Position) :- chart(C,PC,[Goal|Goals],Position), % For every chart entry of this kind predict(Goal,Position), % do all possible predictions fail. predictor(_). % then succeed with no further action. predict(Goal,Position) :- rule(Goal,[H|T]), % For every rule expanding Goal store(chart(Goal,Position, [H|T],Position)), % make a new chart entry predict(H,Position), % and make predictions from it too fail. predict(_,_). % then succeed with no further action.

Chart-Parsing21 Scanner: Beschreibung Akzeptiere das nächste Wort aus der Eingabekette und bestimme seine Kategorie. Für alle Chart-Einträge für die aktuelle Position: Wenn die aktive Kategorie der Wort-Kategorie entspricht, generiere neue Chart-Einträge: –entferne die aktive Kategorie –entferne das aktuelle Wort

Chart-Parsing22 Scanner: Code % scanner(+Position,-NewPosition) % Accept a word and use it to satisfy goals. scanner([W|Words],Words) :- chart(C,PC,[G|Goals],[W|Words]), % for each current goal at current pos. word(G,W), % if category of W matches it store(chart(C,PC,Goals,Words)), % make a new chart entry fail. scanner([_|Words],Words). % then succeed with no further action.

Chart-Parsing23 Completer Für alle vollständigen Konstituenten: –Kombiniere sie zu übergeordneten Konstituenten und generiere entsprechende Chart-Einträge. –Berücksichtige ebenso die auf diese Weise neu hinzugekommenen Konstituenten.

Chart-Parsing24 Completer: Code % completer(+Position) % Process all consituents that are ready to be completed. See text. completer(Position) :- chart(C,PC,[],Position), % For every chart entry with no goals complete(C,PC,Position), % complete all possible higher constituents fail. completer(_). % then succeed with no further action. complete(C,PC,Position) :- chart(C0,PC0,[C|Goals],PC), % For every constituent that can be completed store(chart(C0,PC0, Goals,Position)), % make a new chart entry, Goals == [], % then fail here if Goals not empty, complete(C0,PC0,Position), % or process new entry the same way fail. complete(_,_,_). % then succeed with no further action.

Chart-Parsing25 Leere Konstituenten predict(Goal,Position) :- rule(Goal,[]), store(chart(Goal,Position,[],Position)), complete(Goal,Position,Position), fail. % rule(d,[])

Chart-Parsing26 Chart-Einträge Ohne Subsumption store(chart(A,B,C,D)) :- \+ chart(_,B,_,D), asserta(chart(A,B,C,D)). Mit Subsumption store(chart(A,B,C,D)) :- \+ (chart(A1,B,C1,D), subsumes_chk(A1,A), subsumes_chk(C1,C)), asserta(chart(A,B,C,D)).

Chart-Parsing27 Performance

Chart-Parsing28 Literatur Covington, Michael A. (1994): Natural Language Processing for Prolog Programmers. Chap. 6: Parsing Algorithms. Prentice-Hall. Gazdar, Gerald & Chris Mellish (1989): Natural Language Processing in Prolog. Addison Wesley.