File Information
File: 05-lr/acl_arc_1_sum/cleansed_text/xml_by_section/metho/94/c94-1076_metho.xml
Size: 21,017 bytes
Last Modified: 2025-10-06 14:13:41
<?xml version="1.0" standalone="yes"?> <Paper uid="C94-1076"> <Title>Minimal Change and Bounded Incremental Parsing Mats Wirdn</Title> <Section position="3" start_page="461" end_page="462" type="metho"> <SectionTitle> 2 Batch-Mode Chart Parsing </SectionTitle> <Paragraph position="0"> An incremental problem can be defined by specifying its batch-mode version and the set of allowable modifications. We thus begin by specifying batch-rhode chart parsing, restricting ourselves to a standard context-free grammar without cyclic or empty productions.</Paragraph> <Paragraph position="1"> Definition 1 (Chart) A chart is a directed graph C = (V, E) such that V is a linite, non-empty set of vertices and E C V x V x R is a finite set of edges, where R iv the set of dotted context-free rules obtained from the grammar. 4 The vertices vl,...,vn+l G V correspond to the linear positions between the tokens r = tl ... t, of an n-token text. 5 All edge e G I'; hetween vertices vl and vj carries information al>out a (partially) analysed constituent between the corresponding positions.</Paragraph> <Paragraph position="2"> The algorithm makes use of an agenda (see Thompson \[12\]). Agenda t;~sks are created in response to tokens being read and edges being added to the chart, and may be ordered according to their priorities. To define the agenda, we make use of the set of possible tokens 7'kns and the set of possible edges Edgs.</Paragraph> <Paragraph position="3"> Definition 2 (Agenda)We define the agenda as Agda C Tkns U Edgs U ( Edgs x Edgs). We refer to the three types of tasks that it contains as scanning, prediction and combination tasks, respectively.</Paragraph> <Paragraph position="4"> Each agenda task is executed by a ste 1) of the algorithln below. We specify two versions of batch-nmde chart parsing -- the basic bottom-up (strictly speaking, leftcorner) and top-down (Earlcy-stylc) strategies - . aSSll~ ruing that the one or the other is chosen.</Paragraph> <Paragraph position="5"> Algorithm 1 (Batch-mode chart parsing) Input: A seqnence of tokens r = t1 .. * t,.</Paragraph> <Paragraph position="6"> Output: A chart.</Paragraph> <Paragraph position="7"> Initialization: If tile tOll-down strategy is used, then add an agenda task corresponding to ail initial top-down prediction (Vl, Vl, S --~ .c~) for each rule S --+ ~v, where S is ttle start category of tile grammar.</Paragraph> <Paragraph position="8"> Method: For each token, create a scanning tm~k.</Paragraph> <Paragraph position="9"> While tile agenda is not empty, remove the next task and execute tile corresponding step below: Scan: Given a token I at position j, lbr each lexical entry of the form X -> t, add all edge (vj,Vj+l,X --+ l.). d Add restllting new t~sks to the agenda.</Paragraph> <Paragraph position="10"> Predict 1 (Bottom-up): If tile edge is of the form (vj, vk,X --* cC/.), then, for each rule of the form Y --+ XT, add an edge (vjivj,Y ~-+ .XT) unless it already exists. Add resulting new tasks to tile agenda.</Paragraph> <Paragraph position="11"> Predict 2 (Top-down): If the edge is of tile form (vl, vj, X--+ oe. gfl), tlien, for each rule of the form Y &quot;-* 3', add an edge (vj,vj,Y -+ -7) unless it already exists. Add resulting new tasks to the agenda.</Paragraph> <Paragraph position="12"> Combine: If tile first edge is of tim form (vi, vj, X --* ~.Yfl} and the second is of the form (vj, vk, Y -, 7.), then add an edge (vi,vk,X -+ aY.fl). Add resulting new tasks to the agenda.</Paragraph> </Section> <Section position="4" start_page="462" end_page="463" type="metho"> <SectionTitle> 3 Incremental Chart Parsing a.1 The Problem </SectionTitle> <Paragraph position="0"> \]'lie overall incremental process can be thought of ~Ls a cliange-update loop, where each chalige of the input is immediately followed by a corresponding update of the output. To completely specify the state of this process, we shall make use of a conliguration consisting of (a reI)resentation of) an input text r, a cliart C and an edge-dependency relation 79 (to be &dined in section 4).</Paragraph> <Paragraph position="1"> The problem of incremental chart parsing can then be specilied abstractly as a mapping f((r,C, 79),Ar) ~ (r',C',79') from an old configuration and a modillcation Ar to a new configuration. We shall allow two kinds of change, namely, insertion and deletion of w > 1 contiguons ~We refer to the new edge as a lezical'edge.</Paragraph> <Paragraph position="2"> tokens. We assume that a modification A~ is given as a vertex pair vj, Vj+m G V defining the update interval and, in the cILsc of an insertion, a seqnence of tokens T ~ lj * * * tit m . We fiirthernlore ;ussume that either the bottom-up or top-down strategy is chosen throughout a change-ul)date session, and, in tile latter case, that tile toll-down initialization is made before the session is started.</Paragraph> <Section position="1" start_page="462" end_page="463" type="sub_section"> <SectionTitle> 3.2 A C, eneral Vertex Mapping </SectionTitle> <Paragraph position="0"> flow can tile minilnal change ASh, in be defined il, a chart-b~sed framework? One way of doing this is to colnpare the charts C = (V, E} and C' = (V', I',&quot;) that are obtained by batch-mode parsing of tile texts before and after a change, respectively. We thereby obtain a measure which is independent of particular increniental update algoril, hms. hltnitively, only those edges that are in E but not in lq re,st I)e relnoved, and only those elites that are in 1'; ~ Ilut not in E must lie generated anew. If the change is snlall, then a large fraction of the edges are in /q gl I'Y (I.hat is, are unchanged).</Paragraph> <Paragraph position="1"> llowever, to be able to colnpare the edge sets in the two ('harts, we nmst first establish a one-to-one mapping between their vertices, l,et us consider the case in wlfich a single token ti is (Meted from an n-token text.</Paragraph> <Paragraph position="2"> The probleln is that, becanse of tile remove(l token, the two vertices vl and vi+l would seem to correspond to a single w~rtex in V ~. llowever, we can regard this single vertex as consisting of a &quot;left half&quot; and a &quot;right half&quot;, which we assign diffe.rent indices. In other words, after having increase(l each index of v~_l.1,... , v~, G V' by one, we &quot;split&quot; vertex v~ and assign the index i+1 to its &quot;right half&quot;. The incoming non-predicted edges ms well as (looping) top-down predictions at tile split vertex are then associated with its left half, and tile ontgoing non-predicted edges as well ~us (looping) bottom-up predictions are associated with its right half. 7 q'he reason for dividing the pre(licted edges in this way is that a tOll-down prediction is made at (,tie ending vertex of the i,riggcril, g edge (that is, froln tim left), wllereas a /)ol.toln-up pre(liction is lnade at tim starting veri,ex of the triggering edge (that is, from the right).</Paragraph> <Paragraph position="3"> The lnapping Call I)e geIieralized to tile cruse ill whil:\]l Ill COlitiguoiiS tokelis are deleted. Ttlis is done by iilc.reasilig the index of eax:h w~rtex froin the &quot;right half&quot; of tile split wn'tex an(I oilwards by m (instead of one).</Paragraph> <Paragraph position="4"> Fnrtherinore, by nsing the salile lnlq)ping but in the opposite direction, we can ills() cover insertion of m contiguous toke\[is. To express this generalized inal)ping, m'-ISlliln~ that !) is the set of vertices of the larger chart and V is that of the smaller chart. A deletion of m contiguous tokens then involves a mapping frona to V and an insertion of rn tokens involves a real/ping from V to V. In terms of tile indexing that holds before the vertices in V are renumbered, and assuniing that l) 7A,u lllentloiled above, we aSsulne that only the one or the other st, i'ategy is ilsed, so that ii, is kllowli llefOl'ehllnd which kind of predi<:tlons the cltal't COlttliillS, ships&quot; under bottom-up parsing. Inactive edges are drawn using continuous lines, active edges using dashed lines, and predicted (looping) edges are depicted below the vertices.</Paragraph> <Paragraph position="6"> The mapping is thus established with respect to insettion or deletion of an arbitrary number of contiguous tokens, s</Paragraph> </Section> <Section position="2" start_page="463" end_page="463" type="sub_section"> <SectionTitle> 3.3 Minimal Change </SectionTitle> <Paragraph position="0"> Assume that E and E' are the sets of edges of the charts C and C' obtained by batch-mode parsing of a text before and after a modification Ar, respectively.</Paragraph> <Paragraph position="1"> 8 Presumably, it is possible to generalize the mapping to more complex (non-contiguous) operations such as replacements or reversals. However, we do not pursue that here.</Paragraph> <Paragraph position="3"> We can then define the minimal ontput change on the b~is of two edge sets as follows: Definition 3 (Minimal output change) We define the set of missing edges as tile set difference M = E\E j and the set of new edges as tile set difference N = E' \ E. We then define the minimal output change as Ac,,i, = M U N.</Paragraph> <Paragraph position="4"> Next, we can define the size of tile minimal change as follows: Definition 4 (Size of minimal change) We define the size of the minimal change as/~ = \[A~I + \]Ac,,,,I, the sum of the number of inserted or deleted tokens and the number of edges in Ac,,,i,.</Paragraph> </Section> <Section position="3" start_page="463" end_page="463" type="sub_section"> <SectionTitle> 3.4 An Example </SectionTitle> <Paragraph position="0"> As an illustration, tile chart in tigure 2 is obtained under (batch-mode) bottom-up parsing, given the grammar in figure 4 and the sentence 'q'he old man the tall ships&quot;. If the token &quot;tall&quot; is removed, the chart in figure 3 is obtained. Vertex v~ in figure 2 then col responds to the left half of vertex v~ in figure 3, and vertex v6 corresponds to the right half of vertex v~.</Paragraph> <Paragraph position="1"> Furthermore, v7 corresponds to v~. Clearly, tile input change A~ consists of the token &quot;tall&quot;. The output change AC/,,i, consists of the missing set M, which contains the three edges A26, NP27 and NPa4 in figure 2, and the new set N, which contains the singh.</Paragraph> <Paragraph position="2"> edge NPau in figure 3. '\]'he size of the change is then</Paragraph> <Paragraph position="4"> If instead &quot;tall&quot; is inserted before the last word in the sentence in figure 3, then the input change still eonslsts of the token &quot;tall&quot;. \]lowever, the two sets making up the output change are reversed: the missing set contains the single edge NPa2 in figure 3 and the new set contains the three edges A26, NP2r and NP34 in figure 2. Thus, the size of the change is again 5.</Paragraph> </Section> </Section> <Section position="5" start_page="463" end_page="464" type="metho"> <SectionTitle> 4 An Unbounded Algorithm </SectionTitle> <Paragraph position="0"> A key idea of the incremental chart-parsing algorithm put forward by Wir&, \[14, 15\] is to use edge dependencies for keeping track of edges that \]lave to be removed in response to a change. An edge e' is said to depend upon another edge or token e if it is formed (derived) directly on the b~usis of e. Furthermore, if e' is redundantly proposed by an edge f, then d can be said to that is equivalent to # to the chart, but thai, that edge is rejected by the standard redundancy test in chart parsing. In effect, f provides an additional &quot;justification&quot; for #.</Paragraph> <Paragraph position="1"> Given a chart C = (V, E) and a set of tokens r, these conditions correspond to the following dependency relation on E and r: Definition 5 (Edge dependency) We define 79 as a binary relation on the set of chart edges and the set of tokens E U r such that 79(s, d) hohts if and only if d G E is formed, or is redun(lantly proposed, directly using s C EU r according to a chart-l)arsing algorithm. We say that d is a dependent (or derivative) edge of s, and tl|at s is a source edge (token) of d.</Paragraph> <Paragraph position="2"> 7) can be ilh|strated by a graph. The dependency graph corresponding to the chart in figure 3 is shown in \[igure 5.</Paragraph> <Paragraph position="3"> On the basis of the dependency relation, WirSn and RSnnqnist \[15, 17\] define different disturbance sets, given as fimctions t'rom tokens to sets of edges, and containing edges that need to be removed from the chart in response to a token-level change. The simplest such set is 7)*(tj), the transitive closure of 79(tj). Wirdn and Rfnnquist \[15, 17\] discuss this and other alternatives and show completeness of 79* with respect to the missing set.</Paragraph> <Paragraph position="4"> The algorithm performs an update essentially by removing the entire disturbance set an(\[ then generating all possible edges. The latter set includes not only the new edges, but also disturbed, non-missing edges, which have to be generated anew. q'he coml)lexity analysis of the algorithm yields that it is unbounded incremental in both its botto|n-up and top-down version (see Wir6n \[16\]). The source of this is that the algorithm removes the entire disturbance set, whose size depends on n, the size of the entire input.</Paragraph> </Section> <Section position="6" start_page="464" end_page="465" type="metho"> <SectionTitle> 5 A Bounded Algorithm </SectionTitle> <Paragraph position="0"/> <Section position="1" start_page="464" end_page="465" type="sub_section"> <SectionTitle> 5.1 Intuitive Idea </SectionTitle> <Paragraph position="0"> Intuitively, a bounded incremental algorii.hm only processes the region where the input or output changes during an update cycle. In our c~se, the problem in achieving this is that the missing and new edges are not a priori known -- when the incremental update begins, only a set of potentially missing edges (the disturbance set) is known. Ilowever, the ul)date can be limited by using a change-prol)agation algorithm (compare Itamalingam and l{.eps \[10, page 21\]): By initially retaining the disturl)ance set, new and old edges can be coml)ared during reparsing. If a new edge e' is different from the corresponding old edge e (if this exists), then the dependants of c are regarded ms disturbed (potentially missing). If # is equivalent to e in the sense of giving rise to the sltme derivative edges, then the dependants of c are known not to be missing, and hence tim reparsing process does not have to proceed beyond this point in the search sl)ace, in order to avoid extra computation, the disturbed edges should be visited in the order given by the dependency graph.</Paragraph> <Paragraph position="1"> llow can the points aL which a change &quot;(lies out&quot; be characterized? Since we are interested in characterizing the conditions under which two edges give rise to the same derivtLtive edges, the contents part of an edge (that is, the rigltt-hand side before the dot of the dotted rule) is irrelevant. For example, we want to say that the new edge Nl):~2 in fig||re 3 to be reparsing-equivalent with edge NP:~4 in figure 2 although their dotted rules and parse trees are different: the dotte(I rule of the former is NP -~ Dcl N. and that of the latter is NI&quot; ~ l)cI A N.. We can summarize this in tile following delinition: Definition 6 (Reparsing-equivalent edges) Assume given a proposed edge e and a disturbed edge e' C- C. Wesay that e = (vi,vj,X-.*o~.fl) and # = (v,, vt, Y-*tt.v) are equivalent from the point of view ofreparsingifi=s,j=t,X=Y andfl=v.</Paragraph> <Paragraph position="2"> Inactive (combined or lexical) edges and predicted edges are special cases under this definition. Ill the former case, fl and u are empty, and thus two inactive edges are reparsing-equivalent if i = s, j = t and X = Y. In the latter case, (v and i t are empty, and thus two predicted edges e and c' are reparsing-equivalent if e = d.</Paragraph> </Section> <Section position="2" start_page="465" end_page="465" type="sub_section"> <SectionTitle> 5.2 The Algorithm </SectionTitle> <Paragraph position="0"> We now specify a bounded incremental chart-parsing algorithm that handles one update cycle. 9 In comparison with the unbounded algorithm, the differences are in the reparse and remove steps.</Paragraph> <Paragraph position="1"> Algorithm 2 (Incremental Chart Parsing) Input: A configuration (r,C,:D) and a modification Ar corresponding to insertion or dcletlon of m tokens ti , . . *, ti+m.</Paragraph> <Paragraph position="2"> Output: An updated configuration (r', C ~, D').</Paragraph> <Paragraph position="3"> Method: Do the following steps: Modify the problem instance: Insert or delete the modified tokens given by A~ into or from r.</Paragraph> <Paragraph position="4"> Prepare the chart: Do one of the following steps in the case of insertion or deletion, respectively: Insertion: Renumber edges as follows: First, replace each edge (vj,v~,r} where j _> i and k i with an edge (vj+m,vk,r}. Secondly, replace each edge (vj,v~,r) where k > i with an edge (vj, vk+m, r). Looping edges at the &quot;modification vertex&quot;, which have the form (vi, vi, r), are dealt with differently depending on where their sources are located, which in turn depends on the prediction strategy: * Bottom-up case: If the looping edge depends on an outgoing, non-looping edge ((vi, vj, r) such that j > i), then the looping edge is replaced with an edge (vi+,n, Vi+m, r) (in effect, it is moved).</Paragraph> <Paragraph position="5"> * Top-down case: If the looping edge depends on an incoming, possibly looping edge ((vi, v~, r) such that k < i), then do nothing. Finally, update the depemlency relation 79 so that any edge (vj,vk,r) such that j < i and k > i is made dependent on ti.</Paragraph> <Paragraph position="6"> Deletion: Renumber edges ms follows: First, replace each edge (vj, vie, r) where j > i with an edge (Vj-m,vk,r). Then replace each edge (vj, vk, r) where k > i with an edge (vj, vk ..... r).</Paragraph> <Paragraph position="7"> Reparse: Do the following steps: In the ease of insertion: create a scanning task for each new token; create a combination tmsk for each active-inactive edge pair meeting at vl and vi+m. In the case of deletion: create a combination task for each active-inactive edge pair meeting at vi. Reparse while visiting the disturbed edges in the order given by the dependency graph and treating the disturbed edges as &quot;sleeping&quot; (that is, they do not play any role in the parsing process ms such). 9The algorithm is currently being implenlented.</Paragraph> <Paragraph position="8"> Whenever a new edge is proposed, check if an equivalent edge exists in the disturbance set according to definition 6. If so, install the new edge, update 2) by letting the new edge inherit the dependencies from the old edge. Do not add any agenda items for the new edge (thereby discontinuing reparsing along this path). Mark the new edge as re-created (with respect to a reparsing-equivalent one).</Paragraph> <Paragraph position="9"> Remove edges: Remove each edge that is in the disturbance set but not in the dependency set of any re-created edge.</Paragraph> </Section> <Section position="3" start_page="465" end_page="465" type="sub_section"> <SectionTitle> 5.3 Incremental Complexity </SectionTitle> <Paragraph position="0"> For the purpose of analysing the incremental complexity of algorithm 2, we assume that adding or removing an edge takes unit time. We also assume that no edge h,'~ more than a constant munber of sources or dependants and, hence, that the time required to install or examine the depemlencies of k edges is O(k). tdeg We first focus on the reparsing step. 11 Consider the case of a deletion within a text. The set of new edges N are generated ;ks a result of joining two subcharts, which we assume have length i and j and contain O(i 2) and O(j 2) edges, respectively (disregarding the grammar constant \]G D. The joined chart thus has length i + j and consists of O((i + j)'-') edges. The number of uew edges resulting from joining the subcharts is then INI --O((i + j)2) _ (O(i 2) + O(j2)) = O(i. j) cages. Since the algorithm generates these edges by invoking a O(n 3) reparsing algorithm, the new edges require O((i+j)a) -</Paragraph> <Paragraph position="2"> time. The insertion case can be obtained in a similar way and gives the same result. In the remove step, the missing edges are found by following dependency chains originating from tokens until a reparsing-equivalent edge is found or the chain ends. This step can therefore be executed in O(IM\]) time. The algorithm as a whole then requires 0(/~ 2) time.</Paragraph> </Section> </Section> class="xml-element"></Paper>