{ "paper_id": "P96-1034", "header": { "generated_with": "S2ORC 1.0.0", "date_generated": "2023-01-19T09:02:45.303298Z" }, "title": "Efficient Transformation-Based Parsing", "authors": [ { "first": "Giorgio", "middle": [], "last": "Satta", "suffix": "", "affiliation": { "laboratory": "", "institution": "Universit\u00a3 di Padova Johns Hopkins University via Gradenigo", "location": { "addrLine": "6/A Baltimore", "postCode": "21218-2694 2-35131", "settlement": "Padova", "region": "MD", "country": "Italy" } }, "email": "satta@dei@it" }, { "first": "Eric", "middle": [], "last": "Brill", "suffix": "", "affiliation": { "laboratory": "", "institution": "Universit\u00a3 di Padova Johns Hopkins University via Gradenigo", "location": { "addrLine": "6/A Baltimore", "postCode": "21218-2694 2-35131", "settlement": "Padova", "region": "MD", "country": "Italy" } }, "email": "" } ], "year": "", "venue": null, "identifiers": {}, "abstract": "In transformation-based parsing, a finite sequence of tree rewriting rules are checked for application to an input structure. Since in practice only a small percentage of rules are applied to any particular structure, the naive parsing algorithm is rather inefficient. We exploit this sparseness in rule applications to derive an algorithm two to three orders of magnitude faster than the standard parsing algorithm.", "pdf_parse": { "paper_id": "P96-1034", "_pdf_hash": "", "abstract": [ { "text": "In transformation-based parsing, a finite sequence of tree rewriting rules are checked for application to an input structure. Since in practice only a small percentage of rules are applied to any particular structure, the naive parsing algorithm is rather inefficient. We exploit this sparseness in rule applications to derive an algorithm two to three orders of magnitude faster than the standard parsing algorithm.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Abstract", "sec_num": null } ], "body_text": [ { "text": "The idea of using transformational rules in natural language analysis dates back at least to Choresky, who attempted to define a set of transformations that would apply to a word sequence to map it from deep structure to surface structure (see (Chomsky, 1965) ). Transformations have also been used in much of generative phonology to capture contextual variants in pronunciation, starting with (Chomsky and Halle, 1968) . More recently, transformations have been applied to a diverse set of problems, including part of speech tagging, pronunciation network creation, prepositional phrase attachment disambiguation, and parsing, under the paradigm of transformation-based error-driven learning (see (Brill, 1993; Brill, 1995) and (Brill and Resnik, 1994) ). In this paradigm, rules can be learned automatically from a training corpus, instead of being written by hand. Transformation-based systems are typically deterministic. Each rule in an ordered list of rules is applied once wherever it can apply, then is discarded, and the next rule is processed until the last rule in the list has been processed. Since for each rule the application algorithm must check for a matching at all possible sites to see whether the rule can apply, these systems run in O(rrpn) time, where 7r is the number of rules, p is the cost of a single rule matching, and n is the size of the input structure. While this results in fast processing, it is possible to create much faster systems. In (Roche and Schabes, 1995 ), a method is described for converting a list of transformations that operates on strings into a deterministic finite state transducer, resulting in an optimal tagger in the sense that tagging requires only one state transition per word, giving a linear time tagger whose run-time is independent of the number and size of rules.", "cite_spans": [ { "start": 244, "end": 259, "text": "(Chomsky, 1965)", "ref_id": "BIBREF6" }, { "start": 394, "end": 419, "text": "(Chomsky and Halle, 1968)", "ref_id": "BIBREF7" }, { "start": 698, "end": 711, "text": "(Brill, 1993;", "ref_id": "BIBREF2" }, { "start": 712, "end": 724, "text": "Brill, 1995)", "ref_id": "BIBREF3" }, { "start": 729, "end": 753, "text": "(Brill and Resnik, 1994)", "ref_id": "BIBREF4" }, { "start": 1473, "end": 1497, "text": "(Roche and Schabes, 1995", "ref_id": "BIBREF15" } ], "ref_spans": [], "eq_spans": [], "section": "Introduction", "sec_num": "1" }, { "text": "In this paper we consider transformation-based parsing, introduced in (Brill, 1993) , and we improve upon the O(Trpn) time upper bound.. In transformation-based parsing, an ordered sequence of tree-rewriting rules (tree transformations) are applied to an initial parse structure for an input sentence, to derive the final parse structure. We observe that in most transformation-based parsers, only a small percentage of rules are actually applied, for any particular input sentence. For example, in an application of the transformation-based parser described in (Brill, 1993) , 7r = 300 rules were learned, to be applied at each node of the initial parse structure, but the average number of rules that are successfully applied at each node is only about one. So a lot of time is spent testing whether the conditions are met for applying a transformation and finding out that they are not met. This paper presents an original algorithm for transformation-based parsing working in O(ptlog(t)) time, where t is the total number of rules applied for an input sentence. Since in practical cases t is smaller than n and we can neglect the log(n) factor, we have achieved a time improvement of a factor of r. We emphasize that rr can be several hundreds large in actual systems where transformations are lexicalized.", "cite_spans": [ { "start": 70, "end": 83, "text": "(Brill, 1993)", "ref_id": "BIBREF2" }, { "start": 562, "end": 575, "text": "(Brill, 1993)", "ref_id": "BIBREF2" } ], "ref_spans": [], "eq_spans": [], "section": "Introduction", "sec_num": "1" }, { "text": "Our result is achieved by preprocessing the transformation list, deriving a finite state, determiflistic tree automaton. The algorithm then exploits the automaton in a way that obviates the need for checking the conditions of a rule when that rule will not apply, thereby greatly improving parsing run-time over the straightforward parsing algorithm. In a sense, our algorithm spends time only with rules that can be applied, as if it knew in advance which rules cannot be applied during the parsing process.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Introduction", "sec_num": "1" }, { "text": "The remainder of this paper is organized as fol-lows. In Section 2 we introduce some preliminaries, and in Section 3 we provide a representation of transformations that uses finite state, deterministic tree automata. Our algorithm is then specified in Section 4. Finally, in Section 5 we discuss related work in the existing literature.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Introduction", "sec_num": "1" }, { "text": "We review in the following subsections some terminology that is used throughout this paper.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Preliminaries", "sec_num": "2" }, { "text": "We consider ordered trees whose nodes are assigned labels over some finite alphabet E; this set is denoted as ET. Let T E S T. A node of T is called leftmost if it does not have any left sibling ( a root node is a leftmost node). The height of T is the length of a longest path from the root to one of its leaves (a tree composed of a single node has height zero). We define I TI as the number of nodes in T. A tree T E y]T is denoted as A if it consists of a single leaf node labeled by A, and as A (T1, T2, ... , Ta) , d >_ 1,", "cite_spans": [ { "start": 500, "end": 504, "text": "(T1,", "ref_id": null }, { "start": 505, "end": 508, "text": "T2,", "ref_id": null }, { "start": 509, "end": 514, "text": "... ,", "ref_id": null }, { "start": 515, "end": 518, "text": "Ta)", "ref_id": null } ], "ref_spans": [], "eq_spans": [], "section": "Trees", "sec_num": "2.1" }, { "text": "if T has root labeled by A with d (ordered) children denoted by T1,...,Td. Sometimes in the examples we draw trees in the usual way, indicating each node with its label. What follows is standard terminology from the tree pattern matching literature, with the simplification that we do not use variable terms. See (Hoffmann and O'Donnell, 1982) for general definitions. Let n be a node of T. We say that a tree S matches T at n if there exists a one-to-one mapping from the nodes of S to the nodes of T, such that the following conditions are all satisfied: (i) if n' maps to n\", then n ~ and n I~ have the same label; (ii) the root of S maps to n; and (iii) if n ~ maps to n\" and n ~ is not a leaf in S, then n ~ and n\" have the same degree and the i-th child of n ~ maps to the i-th child of n% We say that T and S are equivalent if they match each other at the respective root nodes. In what follows trees that are equivalent are not treated as the same object. We say that a tree T' is a subtree of T at n if there exists a tree S that matches T at n, and T ~ consists of the nodes of T that are matched by some node of S and the arcs of T between two such nodes. We also say that T' is matched by S at n. In addition, T' is a prefix of T if n is the root of T; T' is the suffix of T at n if T' contains all nodes of T dominated by n. We now introduce a tree replacement operator that will be used throughout the paper. Let S be a subtree of T and let S / be a tree having the same number of leaves as S. ", "cite_spans": [ { "start": 313, "end": 343, "text": "(Hoffmann and O'Donnell, 1982)", "ref_id": "BIBREF11" } ], "ref_spans": [], "eq_spans": [], "section": "Trees", "sec_num": "2.1" }, { "text": "B_ E I E B E B C B f D E", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Trees", "sec_num": "2.1" }, { "text": "Deterministic (bottom-up) tree automata were first introduced in (Thatcher, 1967 ) (called FRT there). The definition we propose here is a generalization of the canonical one to trees of any degree. Note that the transition function below is computed on a number of states that is independent of the degree of the input tree. Deterministic tree automata will be used later to implement the bottom-up tree pattern matching algorithm of (Hoffmann and O'-Donnell, 1982 Informally, a DTA M walks through a tree T by visiting its nodes in post-order, one node at a time. Every time a node is read, the current state of the device is computed on the basis of the states reached upon reading the immediate left sibling and the rightmost child of the current node, if any. In this way the decision of the DTA is affected not only by the portion of the tree below the currently read node, but also by each subtree rooted in a left sibling of the current node. This is formally stated in what follows. Let T E ~T and let n be one of its nodes, labeled by a. The state reached by M upon reading n is recursively specified as:", "cite_spans": [ { "start": 65, "end": 80, "text": "(Thatcher, 1967", "ref_id": "BIBREF16" }, { "start": 435, "end": 465, "text": "(Hoffmann and O'-Donnell, 1982", "ref_id": null } ], "ref_spans": [], "eq_spans": [], "section": "Tree automata", "sec_num": null }, { "text": "EQUATION", "cite_spans": [], "ref_spans": [], "eq_spans": [ { "start": 0, "end": 8, "text": "EQUATION", "ref_id": "EQREF", "raw_str": "6(T,n) = ~(X,X',a),", "eq_num": "(1)" } ], "section": "Tree automata", "sec_num": null }, { "text": "where X --q0 if n is a leftmost node, X --6(T, n') if n' is the immediate left sibling of n; and X' --q0 if n is a leaf node, X' = 6(T, n\") if n\" is the rightmost child of n. The tree language recognized by M is the set", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Tree automata", "sec_num": null }, { "text": "EQUATION", "cite_spans": [], "ref_spans": [], "eq_spans": [ { "start": 0, "end": 8, "text": "EQUATION", "ref_id": "EQREF", "raw_str": "L(M) = {T [ ~(T, n) E F, T E E T, n the root of T}.", "eq_num": "(2)" } ], "section": "Tree automata", "sec_num": null }, { "text": "Example 3 Consider the infinite set L =", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Tree automata", "sec_num": null }, { "text": "consisting of all right-branching trees with internal nodes labeled by B and with strings A'~C, n > 1 as their yields. Let M = (Q, {A, B, C}, 6, qo, {qBc}) be a DTA specified as follows: Q = {q0, qA, qnc, q-i}; 6(qo, qo,A) = qA, 6(qA,qo, C) = 5(qA, qBC, B) = qBC and q-i is the value of all other entries of 5. It is not difficult to see that L(M) = L. 1:3", "cite_spans": [ { "start": 127, "end": 130, "text": "(Q,", "ref_id": null }, { "start": 131, "end": 134, "text": "{A,", "ref_id": null }, { "start": 135, "end": 137, "text": "B,", "ref_id": null }, { "start": 138, "end": 141, "text": "C},", "ref_id": null }, { "start": 142, "end": 144, "text": "6,", "ref_id": null }, { "start": 145, "end": 148, "text": "qo,", "ref_id": null }, { "start": 149, "end": 155, "text": "{qBc})", "ref_id": null } ], "ref_spans": [], "eq_spans": [], "section": "{B(A, C), B(A, B(A, C)), B(A, B(A, B(A, C))),...}", "sec_num": null }, { "text": "Observe that when we restrict to monadic trees, that is trees whose nodes have degree not greater than one, the above definitions correspond to the well known formalisms of deterministic finite state automata, the associated extended transition function, and the regular languages.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "{B(A, C), B(A, B(A, C)), B(A, B(A, B(A, C))),...}", "sec_num": null }, { "text": "Transformation-based parsing was first introduced in (Brill, 1993) . Informally, a transformation-based parser assigns to an input sentence an initial parse structure, in some uniform way. Then the parser iteratively checks an ordered sequence of tree transformations for application to the initial parse tree, in order to derive the final parse structure. This results in a deterministic, linear time parser. In order to present our algorithm, we abstract away from the assignment of the initial parse to the input, and introduce below the notion of transformationbased tree rewriting system. The formulation we give here is inspired by (Kaptan and Kay, 1994) and (Roche and Schabes, 1995) . The relationship between transformation-based tree rewriting systems and standard term-rewriting systems will be discussed in the final section.", "cite_spans": [ { "start": 53, "end": 66, "text": "(Brill, 1993)", "ref_id": "BIBREF2" }, { "start": 638, "end": 660, "text": "(Kaptan and Kay, 1994)", "ref_id": null }, { "start": 665, "end": 690, "text": "(Roche and Schabes, 1995)", "ref_id": "BIBREF15" } ], "ref_spans": [], "eq_spans": [], "section": "Transformation-based parsing", "sec_num": "2.3" }, { "text": "Definition 2 A transformation-based tree rewriting system (TTS) is a pair G = (E,R), where ~ is a finite alphabet and R = (ri,r2,...,r~) , 7r >_ 1, is a finite sequence of tree rewriting rules having the form Q --+ Q', with Q, Q' E ~T and such that Q and Q' have the same number of leaves.", "cite_spans": [ { "start": 122, "end": 136, "text": "(ri,r2,...,r~)", "ref_id": null } ], "ref_spans": [], "eq_spans": [], "section": "Transformation-based parsing", "sec_num": "2.3" }, { "text": "If r = (Q ~ Q'), we write lhs(r) for Q and rhs(r) for Q'. We also write lhs(R) for {lhs(r) I r E R}. (Recall that we regard lhs(r/) and lhs(rj), i # j, as different objects, even if these trees are equivalent.)", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Transformation-based parsing", "sec_num": "2.3" }, { "text": "We define [r I = Ilhs(r) l + I rhs(r) I. The notion of transformation associated with a TTS G = (E, R) is now introduced. Let C, C' E E T. For any node n of C and any rule r = (Q ~ Q') of G, we write C ~ C'", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Transformation-based parsing", "sec_num": "2.3" }, { "text": "if Q does not match C at n and C = C'; or if Q matches C at n and C' = C[S/Q'], where S is the subtree of T matched by Q at n and Q'c is a fresh copy of Q'. Let 1, be the postordered sequence of all nodes of C. We write", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Transformation-based parsing", "sec_num": "2.3" }, { "text": "C ~ C' (4) r,n \u2022", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Transformation-based parsing", "sec_num": "2.3" }, { "text": "if Ci-i ~ Ci, 1 < i <_ t, Co = C and Ct = C'. Finally, we define the translation induced by G on Ea, as the map M(G) = {(C,C') I C E y]T, Ci_I~:~C i for 1 1, the ordered sequence of the left siblings of m, with m included, and call m~,..., m' k, -\" m', k' > 1, the ordered sequence of the left siblings of m ~, with m' included. If m' ~ Nr, then the two following conditions are equivalent: * m' E iv(T, m);", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Rule representation", "sec_num": "3" }, { "text": "\u2022 k = k' and, for 1 < i < k, the suffix of lhs(r) at m~ matches T at mi.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Rule representation", "sec_num": "3" }, { "text": "The claim can be shown by induction on the position of m ~ in a post-order enumeration of the nodes of lhs(r). The lemma then follows from the specification of set F and the treatment of set N~ in items (iii) and (iv) in Definition 3. [] We also need a function mapping F x {1..(r + 1)} into {1..r} U {.1_}, specified as (min@ =_1_): next(q,i) = min{j [ i < j < 7r, lhs(rj) has root node in q}.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Rule representation", "sec_num": "3" }, { "text": "Assume that q E F is reached by AG upon reading a node n (in some tree). In the next section next(q, i) is used to select the index of the rule that should be next applied at node n, after the first i -1 rules of R have been considered.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Rule representation", "sec_num": "3" }, { "text": "The algorithm", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "4", "sec_num": null }, { "text": "We present a translation algorithm for TTS that can immediately be converted into a transformationbased parsing algorithm. We use all definitions introduced in the previous sections. To simplify the presentation, we first make the assumption that the order in which we apply several instances of the same rule to a given tree does not affect the outcome. Later we will deal with the general case.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "4", "sec_num": null }, { "text": "We start with an important property that is used by the algorithm below and that can be easily shown (see also (Hoffmann and O'Donnell, 1982) ). Let G = (E, R) be a TTS and let ha be the maximum height of a tree in lhs(R). Given trees T and S, S a subtree of T, we write local(T, S) to denote the set of all nodes of S and the first ha proper ancestors of the root of S' in T (when these nodes are defined).", "cite_spans": [ { "start": 111, "end": 141, "text": "(Hoffmann and O'Donnell, 1982)", "ref_id": "BIBREF11" } ], "ref_spans": [], "eq_spans": [], "section": "Order-free case", "sec_num": "4.1" }, { "text": "Lemma 2 Assume that lhs(r), r E R, matches a tree T at some node n. Let T ~'~ T' and lel S be the copy of rhs(r) used in the rewriting. For every node n' no~ included in local(T', S), we have ~a(T, n') = Oa (T',n') .", "cite_spans": [ { "start": 207, "end": 214, "text": "(T',n')", "ref_id": null } ], "ref_spans": [], "eq_spans": [], "section": "Order-free case", "sec_num": "4.1" }, { "text": "We precede the specification of the method with an informal presentation. in between the time n has been inserted in rule (i) and the time i is retrieved from H, it could be that the current rule ri can no longer be applied at n.", "cite_spans": [ { "start": 122, "end": 125, "text": "(i)", "ref_id": null } ], "ref_spans": [], "eq_spans": [], "section": "[]", "sec_num": null }, { "text": "Information in state is used to detect these cases.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "[]", "sec_num": null }, { "text": "Crucial to the efficiency of our algorithm, each time a rule is applied only a small portion of the current tree needs to be reread by AG, in order to update our data structures, as specified by Lemma 2 above. Finally, the main loop is exited when the heap is empty.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "[]", "sec_num": null }, { "text": "Let G -(~,R) be a TTS, R = (rl,r2,...,r~) .and letT E ~ be an input tree. Let Aa = (2 ~ U {q0}, ~, ~a, q0, F) be the DTA associated with G and ~G the reached state function.", "cite_spans": [ { "start": 27, "end": 41, "text": "(rl,r2,...,r~)", "ref_id": null } ], "ref_spans": [], "eq_spans": [], "section": "Algorithml", "sec_num": null }, { "text": "Let also i be an integer valued variable, state be an associative array, rule(i) be an initially empty set, for 1 < i < ~', and let H be a heap data structure.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Algorithml", "sec_num": null }, { "text": "(n ---+ rule(i) adds n to rule(i); i ---* H inserts i in H;", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "Algorithml", "sec_num": null }, { "text": "i ~--H assigns to i the least element in H, ifH is not empty.) The algorithm is specified in Figure 4 .", "cite_spans": [], "ref_spans": [ { "start": 93, "end": 101, "text": "Figure 4", "ref_id": "FIGREF5" } ], "eq_spans": [], "section": "Algorithml", "sec_num": null }, { "text": "We describe a run of Algorithm 1 working with the sample TTS G = (E, R) previously specified (see Figure 2 ). proc update ( oldset, newset, j) (next(state(n) Let Ci E ~T, 1 < i < 3, be as depicted in Figure 5 .", "cite_spans": [ { "start": 122, "end": 142, "text": "( oldset, newset, j)", "ref_id": null } ], "ref_spans": [ { "start": 98, "end": 106, "text": "Figure 2", "ref_id": "FIGREF2" }, { "start": 143, "end": 157, "text": "(next(state(n)", "ref_id": null }, { "start": 200, "end": 208, "text": "Figure 5", "ref_id": "FIGREF6" } ], "eq_spans": [], "section": "[] Example 4 (continued)", "sec_num": null }, { "text": "We write mij to denote the j-th node in a postorder enumeration of the nodes of Ci, 1 < i < 3 and 1 < j < 7. Assume that CI is the input tree.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "[] Example 4 (continued)", "sec_num": null }, { "text": "After the first call to procedure update, we have state(m17) = qz0 = {n25} and state(m16) = qs = {nzh}; no other final state is associated with a node of C1. We also have that rule(l)= {m16}, rule(2) = {m17}, rule(3) = 0 and H contains indices 1 and 2.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "[] Example 4 (continued)", "sec_num": null }, { "text": "Index 1 is then retrieved from H and the only node in rule(l), i.e., mr6, is considered. Since the root of lhs(rz), i.e., node n15, belongs to q8, mz~ passes the test in the head of the for-statement in the main program. Then rz is applied to C1, yielding C2. Observe that mll = m21 and m17 --m27; all the remaining nodes of C2 are fresh nodes.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "[] Example 4 (continued)", "sec_num": null }, { "text": "The next call to update, associated with the application of rl, updates the associative list state in such a way that state(m27) = q9 = {n35}, and no other final state is associated with a node of C2. Also, we now have rule(l) = {m16}, rule(2)= {m27} (recall that m17 = m27), rule(3) = {m27}, and H contains indices 2 and 3.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "[] Example 4 (continued)", "sec_num": null }, { "text": "Index 2 is next retrieved from H and node m27 is considered. However, at this point the root of lhs(r2), i.e., node n~5, does no longer belong to state(m27), indicating that r~ is no longer applicable to that node. The body of the for-statement in the main program is not executed this time. Finally, index 3 is retrieved from H and node m27 is again considered, this time for the application of rule r3. Since the root of lhs(ra), i.e., node n35, belongs to state(m27), r3 is applied to C2 at node m27, yielding C3. Data structures are again updated by a call to procedure update with the second parameter equal to 4. Then state qs is associated with node m37, the root node of C3. Despite of the fact that qs E F, we now have next(qs, 4) = _k. Therefore rule rl is not considered for application to C3. Since H is now empty, the computation terminates returning C3. [] The results in Lemma 1 and Lemma 2 can be used to show that, in the main program, a node n passes the test in the head of the for-statement if and only if lhs(ri) matches C at n. The correctness of Algorithm 1 then follows from the definition of the heap data structure.", "cite_spans": [], "ref_spans": [], "eq_spans": [], "section": "[] Example 4 (continued)", "sec_num": null }, { "text": "We now turn to computational complexity issues. Let p = maxl