File Information
File: 05-lr/acl_arc_1_sum/cleansed_text/xml_by_section/metho/83/a83-1010_metho.xml
Size: 21,330 bytes
Last Modified: 2025-10-06 14:11:29
<?xml version="1.0" standalone="yes"?> <Paper uid="A83-1010"> <Title>PARSING WITH LOGICAL VARIABLES</Title> <Section position="1" start_page="0" end_page="0" type="metho"> <SectionTitle> PARSING WITH LOGICAL VARIABLES </SectionTitle> <Paragraph position="0"/> </Section> <Section position="2" start_page="0" end_page="62" type="metho"> <SectionTitle> ABSTRACT </SectionTitle> <Paragraph position="0"> Logic based programming systems have enjoyed an increasing popularity in applied AI work in the last few years. One of the contributions to Computational Linguistics made by the Logic Programming Paradigm has been the Definite Clause Grammar. In comparing DCG's wlth previous parsing mechanisms such as ATN's, certain clear advantages are seen. We feel that the most important of these advantages are due to the use of Logical Variables with Unification as the fundamental operation on them. To illustrate the power of the Logical Variable, we have implemented an experimental ATN system which treats ATN registers as Logical Variables and provides a unification operation over them. We would llke to simultaneously encourage the use of the powerful mechanisms available in DCG's, and demonstrate that some of these techniques can be captured without reference to a resolution theorem prover.</Paragraph> <Paragraph position="1"> \[. Introduction Logic based programming systems have enjoyed an increasing popularity in applied AI work in the last few years. One of the contributions to Computational Linguistics made by the Logic Programming Paradigm has been the Deflnite Clause Grammar. An excellent introduction to this formalism can be found in \[Perelra\] in which the authors present the formalism and make a detailed comparison to Augmented Transition Networks as a means of both specifying a language and parsing sentences in a language.</Paragraph> <Paragraph position="2"> We feel Chat the major strengths offered by the DCG formalism arise from its use of Logical variables with Unification as the fundamental operation on them. These techniques can be abstracted from the theorem proving paradigm and adapted to other parsing systems (see \[Kay\] and \[Bossie\] ). We have implemented an experimental ATN system which treats ATN registers as Logic variables and provides a unification operation over them.</Paragraph> <Paragraph position="3"> The DCG formalism provides a powerful mechanism for parsing based on a context free grammar. The grammar rule S -> NP VP can be seen as the universally quantified logical statement, For all x, y, and z : N'P(x) /\ VP(y) /\ Concatenate(x,y,z) -> S(z). where &quot;x&quot; and &quot;y&quot; represent sequences of words which can be concatenated together to produce a sentence, &quot;S.&quot; Prolog, a progra~mulng language baaed on predicate calculus, allows logical statements to be input as Horn clauses in the foilowlng (reversed) form: s(Z) <- np(X),vp(Y),Concatenate(X,Y,Z).</Paragraph> <Paragraph position="4"> The resolution theorem prover that &quot;interprets&quot; the Prolog clauses would take the oegatlon of S as the goal and try and produce the null clause. Thus the preceding clause can be interpreted procedurally as, &quot;To establish goal S, try and establish subgoals, NP, VP and Concatenate.&quot; DCG's provide syntactic sugar on top of Prolog so that the arrow can be reversed and the &quot;Concatenate&quot; predicate can be dispensed with. The words in the input string are looked at sequentially each time a &quot;\[Word\]&quot; predicate is executed which implicitly tests for concatenation (see figure \[). DCG's allow grammar rules to be expressed very cleanly, while still allowing ATN-type augmentation through the addition of arbitrary tests on the contents of the variables. Pereira and Warren argue that the DCG formalism is well suited for specifying a formal description of a language and also for use with a parser. In particular, they assert that it is a significant advance over an ATN approach on both philosophical and practical grounds. Their chief claims are that: \[. DCGs provide a common formalism for theoretlcal work in Computational Linguistics and for writing efficient natural language processors.</Paragraph> <Paragraph position="5"> 2. The rule based nature of a DCG result %n systems of greater clarity and modularity.</Paragraph> <Paragraph position="6"> 3. DCG's provide greater freedom in the range of structures that can be built in the course of analyzing a constituent. \[n particular the DCG formalism makes it easy to create structures that do not follow the structure implied by the rules of a conscltuenc and easy Co create a structure for a constituent thac depends on items not yec encountered in the sentence.</Paragraph> <Paragraph position="7"> The flrsC two points have been discussed in the past whenever the ATN formalism is compared with a rule-based grammar (see \[PracC\] , \[Heldorn\] , \[Codd\] , or \[Bates\] ). The outcome of such discussions vary. It is safe Co say chat how one feels about these points depends quite heavily on past experience in using the two formalisms.</Paragraph> <Paragraph position="8"> We find the third point co be well founded, however. Ic is clear chac the DCG differs moeC from previous rule-baaed parsing systems in ice inclusion of Logical variables. These result in greater flexibility in building structures co represent constituents that do mot follow the Inherent structure determined by the rules themselves. They also allow one co create structures which refer Co Items chac have not yec been discovered in the course of analysing the sentence.</Paragraph> <Paragraph position="9"> We have built an experimental ATN system which can crest ATN registers as Logical variables and, we feel, capture these important strengths offered by the DCG formalism in the ocherwlse standard ATN formalism.</Paragraph> <Paragraph position="10"> The second section gives a more detailed desctpCton of DCG's and presents a simple grammar. In the third section we show am ATN grammar which is &quot;equivalent&quot; to the DCC grammar and discuss the source of Its awkwardness. The fourth section chert presence an ATN formalism extended co include viewing ATN registers as Logical variables which are subject to the standard unlficacloa operaclon. The final section concludes this note and suggests that logical variables might be fruitfully introduced into ocher parsing algorithms and systems.</Paragraph> <Paragraph position="11"> rip(X, Pl, P) -> dec(X, P2, PI, P), n(X, P3), relclauee(X, P3, P2).</Paragraph> <Paragraph position="12"> rip(X, P, P) -> name(X).</Paragraph> <Paragraph position="13"> vp(X, P) -> tranev(X, Y, Pl), np(Y, Pl, P).</Paragraph> <Paragraph position="14"> vp(X, P) -> tncransv(X, P).</Paragraph> <Paragraph position="15"> relclause(X, PI, (And PI P2)) -> \[chat\], vp(X, P2). relclauae(X, P, P) -> \[\], dec(X, Pl, P2, (ForAll X (-> P! P2))) -> \[everyl. dec(X, Pl, P2, (ForSome X (And Pt P2))) -> \[a\]. n(X, (man X)) -> \[,u.\].</Paragraph> <Paragraph position="16"> n(X, (woun X)) -> \[wom~.\].</Paragraph> <Paragraph position="17"> n(X, (dog X)) -> \[dog\].</Paragraph> <Paragraph position="18"> name(John) -> \[John\] name(mary) -> \[mary\] namI(fldo) -> \[fido\] transv(X, Y, (loves X Y)) -> \[loves\].</Paragraph> <Paragraph position="19"> transv(X, Y, (breaches X Y)) -> \[breathesl.</Paragraph> <Paragraph position="20"> Incranev(X, (loves X) -> \[loves\].</Paragraph> <Paragraph position="21"> lncransv(X, (lives X).-> \[lives\].</Paragraph> <Paragraph position="22"> incranev(X, (breathes X) -> \[breathes\].</Paragraph> </Section> <Section position="3" start_page="62" end_page="62" type="metho"> <SectionTitle> 2. Definite Clause Grammars </SectionTitle> <Paragraph position="0"> Figure \[ shows a simple DCG grammar adapted from \[Perelra\] . Figure 2 gives a sentence in the language recognized by thls grammar together wlth the associated surface syntactic structure and the semantic structure built by the grammar.</Paragraph> <Paragraph position="1"> Fi E * 2. A Sentence, Structure and Representation</Paragraph> </Section> <Section position="4" start_page="62" end_page="66" type="metho"> <SectionTitle> SENTENCE </SectionTitle> <Paragraph position="0"> &quot;John loves every woman who breathes&quot; The way in which unification produces the appropriate bindings for this example ls actually quite subtle, and requires a detailed analysis of the parse, as represented by the refutation graph in Figure 3. For the the refutation graph the Prolog clauses have been put into claueal normal form. Some liberties have been taken with the ordering of the predicates in the interest of compactness.</Paragraph> <Paragraph position="1"> In trying to establish the &quot;s(P)&quot; goal, the &quot;np(X,Pt,P)&quot; is first attempted. The &quot;PI&quot; is an empty variable that is a &quot;place-holder&quot; for predicate information chat will come from the verb.</Paragraph> <Paragraph position="2"> It will &quot;hold&quot; a place in the sentence structure that will be provided by =he determiner. &quot;P&quot; is destined to contain the sentence structure. The</Paragraph> <Paragraph position="4"> \[woman\] &quot;\[woman\]\/ -relclause(Y.(woman Y).P2~ -vp(X,P2)\/ -\[that\]\/ \ relC/ PL .0o)).</Paragraph> <Paragraph position="5"> (PI is bound to &quot;And-(woman Y) P2&quot;)//lause(x'PL'(And</Paragraph> <Paragraph position="7"> first &quot;np&quot; clause will be matched, but it will eventually fall since no determiner is present.</Paragraph> <Paragraph position="8"> The second &quot;rip&quot; clause will'succeed, having forever identified the contents of &quot;Pl&quot; with the contents of &quot;P, &quot; whatever they may be. Since there is no determiner in the first noun phrase, there is no quantification information. The quantlflcatlonal structure must be supplied by the verb phrase, so the structure for the sentence will be the same as the structure for the verb phrase. The variable &quot;X&quot; will be bound to &quot;John&quot;.</Paragraph> <Paragraph position="9"> In trying co establish &quot;vp(John,Pl), &quot; the first &quot;wp&quot; clause w(ll succeed, since &quot;loves&quot; is a transitive verb. It is important not to get the variables confused. Within the &quot;vp&quot; clause our original &quot;Pl&quot; has been renamed &quot;P&quot; and and we have a new &quot;PI&quot; variable that will be Instantlated to &quot;(loves John Y)&quot; by the success of the &quot;=canny&quot; goal. The &quot;Y&quot; Is as yet undetermined, but we can see that It will be supplied by the next &quot;np(Y,(loves John Y=),P)&quot; goal. It shows great foresight on &quot;transv's&quot; part to pass back a variable in such a way that it will correspond to a variable that has already been named. This pattern is repeated throughout the grammar, with powerfull repurcusslons. It is even clearer In the success of the &quot;np(Y,(loves John Y),P)&quot; goal, where the presence of the determiner &quot;every&quot; causes &quot;P&quot; to be bound to (Forall Y (-> PI (loves John Y)) This &quot;P&quot; is of course the &quot;P&quot; mentioned above which has been waiting for the verb phrase to supply It with a quantlflcatlonal structure.</Paragraph> <Paragraph position="10"> As the relative clause for this &quot;up&quot; is processed, the &quot;PI&quot; embedded in this structure, (our second new PII), is eventually bound to &quot;(And for &quot;P&quot; - the final structure built for the sentence.</Paragraph> <Paragraph position="11"> In following the execution of this grammar it becomes clear that very ~trong predictions are made about which parrs of the parse will be supplying particular ~ypes of information. Determiners will provide the quanClElers for the propositional ~tructure of the sentence, the flrsc noun phrase and the noun phrase following the verb will be the two participants in ~he predicate implied by the verb, etc. Obviously this is a simple grammar, but the power of the logical variables can only be made use of through the encoding of these strong linguistic assumptions. DCG's seem to provide, a =echanlsm well qualified for expressing such assumptions and then executing them. Coming up with the assumptions in the first place Is, of course, something of a major task In itself.</Paragraph> <Paragraph position="12"> 3. Comparing DC and ATN Grammars &quot;equivalent&quot; of the DCG grammar given in Figure t. The format used to specify the grammar is the one described in \[flninl\] and \[finln2\] . There are only two minor ways that this particular formalism differs from the standard ATN formalism described in \[WoodsY0\] or \[Bates\] . First, the dollar sign Character (i.a. $) followed by the name of a register stands for the contents of that register.</Paragraph> <Paragraph position="13"> Second, the function DEFATN defines a set of arcs, each of which is represented by a llst whose first element is the name of the state and whose remaining elements are the arcs emanating from the state.</Paragraph> <Paragraph position="14"> In addition, this example uses a very simple lexical manager in which a word has (1) a set of syntactic categories to which It belongs (2) an optional set of features and (3) an optional root form for the word. These attributes are associated with a word ualng the function LEX, which supplies appropriate default values for unspecified arguments.</Paragraph> <Paragraph position="15"> In the standard ATN model, a PUSH arc invokes a sub-computatlon which takes no arguments and, if successful, returns a single value. One can achieve the affect of passing parameters to a sub-computatlon by giving a register an initial value via a SENDR register setting action. There are two methods by which one can achieve the effect of returning more than one value from a sub-computatlon. The values to be returned can be packaged into a llst or the LIFTR register setting action can be used to directly set values in the higher level computation. This grammar makes use of SENDR and LIFTR to pass parameters into and ouC of ATN computations and thus the actions of the DCC example.</Paragraph> <Paragraph position="16"> Consider what must happen when looking for a noun phrase. The representation for a NP will be a predicate if the noun phrase is indefinite (i.e. &quot;a man&quot; becomes (man X)) or a constant If the noun phrase is a name (l.e. &quot;John&quot; becomes John). in this simple language, a NP is dominated by a either a sentence (if it is the subject) or by a verb phrase (if It ts the object). \[n either case, the NP also determines, or must agree with, the overall structure used to represent the dominating constituent. If the NP is a simple name, then Lt exerts no additional influence on the representation of its dominator. If the NP is noc a name, then It is indeflnice and will eventually result in a quantified expression for the dominating sentence or verb phrase, in this case we need to tell the dominating computation what the predicate, quantifier, connective, and variable name must be. In this ATN grammar, this ts done b? having the NP network return a value to represent the NP predicate and llft values for the quantifier, connective and variable name.</Paragraph> <Paragraph position="17"> Similarly, when we are lookzn8 for a verb phrase, we must know what token (i.e. variable name or constant) represents the subject (if the verb phrase is dominated by a S) or the head noun (if the verb phrase acts as a relative clause). This is done by sanding the subJvar register in the sub-computation the appropriate value via the SENDR function. The techniques used to quancificatlon and build an overall sentence structure in chls ATN grammar are similar co those used in th~ BBN Lunar Grammar \[Woods72\] .</Paragraph> <Paragraph position="18"> This heavy use of SENDR and LIFTR co communicate between levels in the grammar makes the ATN grammar cumbersome and difficult to unaerstand.</Paragraph> <Paragraph position="19"> In the next secton we investigate treating ATN registers as logic variables and providing a unification operation on them.</Paragraph> </Section> <Section position="5" start_page="66" end_page="66" type="metho"> <SectionTitle> 4. Replacing ATN Registers with ATN Variables </SectionTitle> <Paragraph position="0"> Although the previous &TN grammar does the Job, it is clearly awkward. We can achieve much of the elegance of the DCG example by treating the ATN registers as logical variables and including a unification operation on them. We will call such registers ATN Variables.</Paragraph> <Paragraph position="1"> Since our ATN variables must not be tampered with between unifications, assignment operations such as SETR, LIFTR and SENDR are precluded. Thus the only operations on ATN Registers are access and ualfy. It is possible to provide operations similar to the standard SENDR and LIFTR by defining unification operations which do the unification in the another environment, but we have not explored these possibilities.</Paragraph> <Paragraph position="2"> The scheduler component of the ATN parser has been modified to be sensitive to the success or failure of attempted unifications, if a unification operation on an arc fails, the arc is blocked and may not be taken.</Paragraph> <Paragraph position="3"> Figure 5 shows a grammar in the extended ATN formalism. A symbol preceded by a &quot;$&quot; represents an ATN Variable and &quot;*&quot; will again stand for ~he current constituenE. Thus in the state S in the grammar: (S (PUSH NP (UNIFY &quot;($SUBJVAR gYP $S) *)</Paragraph> </Section> <Section position="6" start_page="66" end_page="67" type="metho"> <SectionTitle> (TO S/SUBJ))) </SectionTitle> <Paragraph position="0"> the parser pushes to the state NP co parse a noun phrase. If one is found, it will pop back wi~h a value which will then be unified wi~h the expression (SSUBJVAR $VF $S). If this unification is successful, the parser will advance to state S/SUBJ. If It fails, the arc is blocked causing the parser to backtrack into the NP network.</Paragraph> <Paragraph position="1"> Although our grammar succeeds in mimicking the behavlour of the DCG, there are some open questions Involvlng the use of unification \[n parsing natural languages. An examination of ~his ATN grammar shows that we are really using unification as a method of passing parameters. The full power of unlficatton ls noc needed In this example since the grammar does not try to find &quot;most-general unifiers&quot; for complicated sets of terms. Most of the time it is simply using unification to bind a variable to the contents of another variable. The most sophisticated use involves binding a variable in a term to another copy of that term which also has a variable to be bound as in the &quot;a man loves a woman&quot; example in Figure 6. But even this binding is a simple one-way application of standard unification. St is not clear to the authors whether this is due to the simple nature of the grammars involved or whether it is an inherent property of the dlrectedneee of natural language parsing.</Paragraph> <Paragraph position="2"> A situation where full unification eight be required would arise when one is looking for a constituent matching some partial description. For example, suppose we were working with a syntactic grammar and wanted to look for a singular noun phrase. We might do this with the following PUSH arc:</Paragraph> </Section> <Section position="7" start_page="67" end_page="67" type="metho"> <SectionTitle> (PUSH NP T (UNIFY * '(NP (DET eDET) (NUMBER SINGULAR) (ADJ $ADJS) ...)) </SectionTitle> <Paragraph position="0"> If we follow the usual schedule of interpreting ATN gra.---rs the unification will not occur until the NP network has found a noun phrase and popped back with a value. This would require a fully symmetric unification operation since there are variables being bound to values in both arguments. It is also highly inefficient since we may know rlghc away that the noun phrase in the input is not singular.</Paragraph> <Paragraph position="1"> What we would iike is to be able to do the unification Just after the push is done, which would more closely parallel a Prolog-based DCG parse. Then an attempt to &quot;unify&quot; the number register with anything other than singular will fall immediately.</Paragraph> <Paragraph position="2"> This could be done automatically if we constrain a network to have only one state which does a pop and place some additional constraints on the forms that can be used as values to be popped.</Paragraph> <Paragraph position="3"> Although we have not explored this idea at any length, it appears to lead co some interesting possibilities.</Paragraph> </Section> class="xml-element"></Paper>