<?xml version="1.0"?><!DOCTYPE article SYSTEM "/project/take/software/searchbench_offline_processing/paperxml_generator/aclextractor/src/python/../resource/dtd/paperxml.dtd"><article><header><firstpageheader><page local="1" global="785"/><title>A Breadth-First Representation for Tree Matching in Large Scale Forest-Based Translation</title><pubinfo>Proceedings of the 5th International Joint Conference on Natural Language Processing,pages 785-793, Chiang Mai, Thailand, November 8 - 13, 2011. ©2011 AFNLP</pubinfo><author surname="Ghodke" givenname="Sumukh"><org  name="University of Melbourne" country="Australia" city="Melbourne"/></author><author surname="Bird" givenname="Steven"><org  name="University of Melbourne" country="Australia" city="Melbourne"/></author><author surname="Zhang" givenname="Rui"><org  name="Peking University" country="China" city="Beijing"/></author></firstpageheader><frontmatter><p><b>A Breadth-First Representation for Tree Matching in Large Scale Forest-Based Translation</b></p><p><b>Sumukh Ghodke Steven Bird Rui Zhang</b></p><p>Department of Computer Science and Software Engineering University of Melbourne, Victoria 3010, Australia {sghodke,sb,rui}@csse.unimelb.edu.au</p></frontmatter><abstract>Efficient data structures are necessary for searching large translation rule dictionar­ies in forest-based machine translation. We propose a breadth-first representation of tree structures that allows trees to be stored and accessed efficiently. We de­scribe an algorithm that allows incremen­tal search for trees in a forest and show that its performance is orders of magni­tude faster than iterative search. A B-tree index is used to store the rule dictionar­ies. Prefix-compressed indexes with a large page size are found to provide a bal­ance of fast search and disk space utilisa­tion. </abstract></header><body><section number="1" title="Introduction"><p>Statistical machine translation (SMT) uses ma­chine learning and parallel corpora to perform translations automatically. Syntax based SMT systems can be broadly classified into two types based on the input to the system: tree-based and string-based (Mi et al., 2008). In a tree-based sys­tem, the input is a parse tree of the source lan­guage, whereas in the latter, the input is a sequence of words that is simultaneously parsed and trans­lated. Forest-based translation employs multiple parse trees for each source language sentence.</p><p>Forest-based translation can be performed in three main steps. First, the input sentence is parsed into a packed forest, which is then pruned. Next, for each tree in the packed forest, all matching translation rules are found. These translation rules are then combined to form a translation forest. The translation forest is finally decoded to produce a sentence in the target language.</p><p>The second step - finding all matching trans­lation rules for each tree in the source sentence forest - is a complex task in itself. It could be performed by enumerating all trees in the forest and then searching for those trees in the transla­tion rule dictionary. Of the enumerated trees, those that are present in the rule dictionary produce the translation forest. However, enumerating all pos­sible trees from a forest incurs an exponential cost and many or most of those generated trees may not exist in the rule dictionary. Hence, a com­mon approach in MT research is to perform the inverse task, and iterate over all the rules to check whether each rule matches anywhere in the source forest. This is a relatively easy task, especially if the rule dictionary is not large. In experimen­tal setups a subset of rules may be used based on the prior knowledge of the rules required for the given test sentences. While that method works for research experiments on translation methods, no prior knowledge is available for online MT sys­tems, and iterating over all rules will not be effi­cient for large rule dictionaries. Another method used to quicken the search is to limit the depth of the rules. Shallower rule trees are lesser in num­ber. However, the reduction in depth can lower the translation quality.</p><p>This paper's contribution is in the second step of forest-based translation. We propose a breadth-first representation of translation rule trees and a sorted index architecture to store and retrieve translation rules efficiently. Together, they allow all translation trees to be discovered at each node in the forest, incrementally. Each node in the for­est is expanded to form trees that are present in the rule dictionary. This allows the rule dictionary to contain all rules without any restriction on the depth of the rule or the size of the collection.</p><p>Translation rules are stored in the Berke-leyDB (Olson et al., 1999) B-tree index structure. Section 3 describes the breadth-first representation used to store trees in the index. The architec­ture of the translation system and the method of incremental tree expansion are described in Section 4.<page local="2" global="786"/> Section 4 also discusses the significance of the breadth-first over a depth-first tree storage approach.</p><p>Section 5 describes our experimental setup. The experiments measure the total time to construct a translation forest from a pruned source forest. An iterative search over the rule dictionary is the base­line performance measure. In addition to compar­ing the indexed search with the baseline, this sec­tion also analyses the effect of page size and com­pression on search performance. Multiple rule in­dexes are created to test the effect of the database parameter settings. The operating system disk cache and the database cache are cleared to sim­ulate a fresh start before operating on each for­est. The experiments are conducted on two rule dictionaries and three forest collections. The first rule dictionary has 11.8M rule trees and the sec­ond has 33.1M rules. The rules are extracted from NIST (2010a) data while the forest collections are extracted from NIST (2010a; 2010b) data.</p></section><section number="2" title="Background"><p>In this section we present the fundamentals of packed forests and forest-based translation before briefly describing the B-tree index structure.</p><subsection number="2.1" title="Packed Forest"><p>Packed forests or forests are directed hypergraphs and have been used to model and represent sev­eral applications in computer science and discrete mathematics (Klein and Manning, 2001).</p><p>Directed hypergraphs can be de­fined as a pair: <i>H </i><i>= </i>(V, E) where <i>V </i><i>= </i><i>{v</i><b><i>i</i></b><i>,v2, • • •</i>, vn} is the set of nodes and <i>E </i><i>= </i><i>{E</i><b><i>i</i></b><i>,E2, • • •, Em} </i>is the set of hyper-edges. Each hyperedge can be defined as a pair: E<b>i </b>= <i>(Xi, </i>Y) | <i>Xi, </i>Y <i>Ç </i>V, i <i>=</i><i> </i><i>1,</i><i> </i>2, • • •, m.</p><p>Packed forests have been used in NLP in the area of sentence parsing (Gallo et al., 1993) where the propositions of a parse analysis correspond to the nodes in the hypergraph and rules are repre­sented as hyperedges. A similar model is used in forest based machine translation, where multi­ple parses of the input sentence are modelled as a forest. In NLP applications, the head of a hyper-edge is usually a single node. This allows a single hyperedge to be semantically equivalent to a tree node with its children.</p><doubt alpha="100.0" length="2" tooSmall="False" monospace="0.0">IP</doubt><doubt alpha="50.0" length="32" tooSmall="False" monospace="0.0">NP ^z3:VPB___t-----—*xiX'iwithX2</doubt><p><b>z^NPB </b>CC <b>x2:NPB</b></p><doubt alpha="100.0" length="2" tooSmall="False" monospace="0.0">ya</doubt><p>Figure 1:   A translation rule reproduced from</p><doubt alpha="50.0" length="20" tooSmall="False" monospace="0.0">(Mi and Huang, 2008)</doubt></subsection><subsection number="2.2" title="Forest Based Translation"><p>Forest-based SMT overcomes the limitations of parse errors in tree-based translation and has been shown to be faster than k-best tree-based transla­tion (Mi et al., 2008). For translating a sentence using the forest-based translation technique, we require a parser that can process a source language sentence and produce a packed forest and a trans­lation rule dictionary, or database, which is a col­lection of <i>tree-to-string</i><i> </i>translation rules (Huang et al., 2006; Liu et al., 2006).</p><p>A translation rule is a mapping from a source language tree to a string in the target language. An example translation rule from Chinese to En­glish is shown in Figure 1. The left-hand-side is the source language tree. The Chinese word yU is translated to <i>with</i><i> </i>in the target side on the right. The <i>xi</i><i> </i>variables on the right-hand-side are place­holders for the corresponding elements in the tree. Other numerical parameters associated with each translation rule are not shown here. Note that there may be several rules in the rule dictionary that have identical source language trees but different translations.</p><p>Once a source language sentence is parsed into a packed forest and pruned, the next step is to find trees in the forest that have matching rules in the translation rule dictionary. Matching rules are used to produce a translation forest for decoding into a target language string. The forest is a hyper­graph made up of hyperedges where each hyper-edge has a single source node, while the rules in the rule dictionary are trees.</p><p>Recent work by Huang and Mi (2010) has shown that forest expansion can be done in de­coders using beam search (Koehn, 2004). How­ever, to the best of our knowledge, no index-based search structures for incrementally finding trees have been proposed to date.</p><page local="3" global="787"/><doubt alpha="40.9" length="22" tooSmall="False" monospace="0.0">A(B(C D) E F(G H)) (b)</doubt><doubt alpha="50.0" length="18" tooSmall="False" monospace="0.0">A3B2C0D0E0F2G0H0 M</doubt><doubt alpha="42.1" length="19" tooSmall="False" monospace="0.0">A3B2E0F2C0D0G0H0 «0</doubt><doubt alpha="45.0" length="20" tooSmall="False" monospace="0.0">ABEFCDGH32020000 (e)</doubt><figure caption="Figure 2: Transforming a tree into a breadth-first format"></figure></subsection><subsection number="2.3" title="Indexing Methods"><p>Data structures for indexing can be broadly clas­sified into either memory based or disk based. Memory based indexes are not considered here since an online SMT system with a large transla­tion rule dictionary requires disk based storage.</p><p>B-trees are balanced search trees that are de­signed to work eficiently from the disk. They minimise disk I/O and provide an insert and delete time complexity of <i>O(log</i><i> n), </i>where n is the num­ber of objects in the database. The keys in a B-tree are always in sorted order, therefore providing a guarantee of proximity for comparable keys.</p><p>The B-tree implementation in BerkeleyDB is used in our experiments. Since the keys are sorted, consecutive keys often share a common preix. BerkeleyDB allows the compression of keys in a database via user-deined compress and decom­press functions. If no such functions are supplied, it performs preix compression. Our experiments test the performance of search with page size and compression of keys. Other settings such as the minimum number of keys for each leaf page and cache size allow us to ine tune the performance of the system, but we do not report experiments on those for lack of space.</p></subsection></section><section number="3" title="Breadth-first Representation"><p>The storage and efficient retrieval of the left-hand-side of translation rules is closely linked to the format in which they are stored. This section de­scribes the format we use to represent trees both in queries and for rules in the index.</p><p>Trees can be represented linearly in several ways. As mentioned in Section 2.2, although a forest is a hypergraph made up of hyperedges, the left-hand-sides of rules in the rule dictionary are actually trees. Each node in a forest can have zero or more outgoing hyperedges. A hyperedge is be treated as a tree node with its children. Source sentence trees are constructed by recursively ex­panding nodes in the forest.</p><p>Figure 2a shows a tree constructed with three hyperedges, having head nodes A, B and F. Fig­ure 2b shows the typical string representation of the tree where a node's descendants are scoped by an open and close bracket. The bracketed for­mat, although visually intuitive, is not eficient for storage and processing. There has been much research on succinct representation of tree struc­tures. Succinct representations encode trees in the most compact fashion by either using a balanced bracket representation or depth irst unary degree sequences (Jansson et al., 2007). Such methods often represent the open and close brackets of a tree in bit notations. However, braces can only be matched when the trees are stored in a depth-irst format and it cannot be applied to breadth-irst representations.</p><p>Figure 2c represents the tree as a sequence of label and integer pairs. The labels represent node labels in the tree in a depth irst format and the in­tegers that follow each node label give the number of children at that node. Figure 2d shows a similar encoding scheme, but with the tree traversed in a breadth-irst format. Finally, Figure 2e shows the format used in this paper. In our format, we sep­arate the node labels and the integers representing the number of child nodes. When using this rep­resentation in the index, each node label is rep­resented by a unique integer, which occupies four bytes, whereas the integer representing the number of child nodes is restricted to a maximum value of 255, and can therefore be represented in one byte.</p><p>Separating the node labels from integers rep­resenting the number of child nodes gives us a greater preix overlap between consecutive expan­sions. For example, if we were to use the in­terleaved expansion method shown in Figure 2d on the hyperedge with head A and then expand the hyperedge with head B, the breadth-first rep­resentation of the trees would be A3B0E0F0 and A3B2E0F0C0D0. We can see that the expansion of the node B has resulted in its number of children being updated to 2 from 0. Since, each label is en­coded using 4 bytes and the child count using 1 byte, the overlap between the expanded sequences is 9 bytes.<page local="4" global="788"/> With the separated breadth-first for­mat (Figure 2e) the two trees are ABEF3000 and 16 bytes. The separated form helps in increasing the preix overlap of expanded tree structures.</p><doubt alpha="65.9" length="44" tooSmall="False" monospace="0.0">ABEFCD320000, an overlap of 4 node labels or</doubt><p>If, instead, the depth-irst notation is used, then the second tree is represented as A3B2C0D0E0F0. Then, even if the integers are separated, the preix shared by the two queries is only 9 bytes.</p><p>To generalise the breadth-irst representation and the prefix overlap, consider a tree T con­taining k nodes, denoted here as an ordered se­quence <i>N </i><i>= </i><i>(ni,n2, • • •</i>, nk) in breadth-first or­der. Each node is either fully expanded or is collapsed, therefore, if <i>k </i>is greater than 1, then the irst node, being the root, must be fully ex­panded. Let the labels of nodes in N be a sequence <i>L </i><i>= </i><i>(l</i><b><i>i </i></b><i>,l</i><b><i>2, </i></b><i>•••</i><i>, lk </i><i>) </i>and let <i>C </i><i>= </i>(ci, C2, • • •, <i>ck</i><i> </i>) denote the sequence of the number of children of each node in <i>N. </i>The separated breadth-irst repre­sentation of <i>T, </i>which is used in this paper, is the sequence <i>B</i><i> </i><i>= </i><i>(l</i><b><i>i, </i></b><i>I</i><b><i>2, </i></b><i>•••</i><i>, lk, </i>ci, C2, • • •, Ck ). In a tree <i>T,</i><i> </i>the number of nodes that can be expanded is equal to the number of leaves p, where <i>p &lt; k. </i>Each expansion of a leaf node in <i>T </i>produces a new tree. Let <i>S </i><i>=</i><i> </i><i>{T </i>| <i>i e </i><i>{1,</i>2, • • •, k}} be the set of all trees produced as a result of the expansion, where | S | = p and each tree, Ti, is an expansion of node <i>ni</i><i> </i>in T and its sep­arated breadth-first representation is Bi. Let <i>Ni </i><i>= </i><i>{nj </i>| <i>depth(nj</i><i>) </i><i>&lt; depth(ni)} </i>be a set of all nodes of depth less than or equal to node <i>ni</i>'s depth in <i>T. </i>Then, <i>Bi</i><i> </i>shares a preix of at least 4 | Ni | bytes with B.</p><p>Now, each node ni has been considered to have either no child or one ordered set of children. While this is true in a tree, a forest is different. Each node in a forest can have multiple expan­sions, or hyperedges. The algorithm discussed in the next section therefore iterates over all possible hyperedges at a node.</p></section><section number="4" title="Index Architecture"><p>This section explains the structure of the index and the incremental search algorithm. To present a broader picture of where the index and search components fit within a larger online MT system, a representative block diagram of a complete forest-based MT system is provided in Figure 3. We fo­cus only on the the incremental search algorithm</p><p><b>source sentence .</b></p><p><b>target sentence</b> <b>Indexed Data Store</b> <b>label to integer dictionary</b></p><p><b>rule dictionary</b></p><p><b>translation info dictionary</b></p><figure caption="Figure 3: Architecture for an online forest-based translation system"></figure><p>and the rule dictionary in this section. The func­tion of other components in the indexed data store is only briefly explained as they are not critical to the operation of the search algorithm.</p><p>The indexed data store is composed of three dic­tionaries. The irst is a label to integer mapper. It assigns an integer identiier to all unique labels in the system. All tree node labels, including words, that appear on both sides of translation rules are indexed within this dictionary. The integer id for a label can be looked up using the label string as the key while encoding a tree query or while creat­ing the other two dictionaries. A reverse mapping from the integer id to the label is used while con­structing the translation forest from encoded rule trees. Any key-value data-structure could be used for the label mapper. It could even be a memory based hash table if it its in memory.</p><p>The other two dictionaries, the rule dictionary and the translation info dictionary, contain the in­formation about translation rules. The rule dictio­nary or database is a collection of left-hand-sides of translation rule trees accessible by a tree as the key. Each tree in the rule database has a unique integer id as its value. The integer id is the refer­ence to a position in the translation info dictionary. Each rule tree may have one or more target lan­guage translations. Hence, each entry in the trans­lation info database is a list of translations. Each element in the list is a tuple of the target language strings and the parameters deining the statistics of that translation. The target language strings are stored as a sequence of integer ids and the parame­ters are stored in a pre-deined binary format. The translation info database uses a simple record list structure from the BerkeleyDB library.</p><p>A large rule dictionary, requires a disk-resident index to support eficient access. The B-tree data-structure is used as the rule database because of its scaling capabilities and its sorted key storage property which is critical to the operation of the incremental search algorithm.<page local="5" global="789"/></p><table class="main" frame="box" rules="all" border="1" regular="False"><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>Parse and</b></p></td><td class="cell"><p><b>packed</b></p></td><td class="cell"><p></p></td><td class="cell"><p><b>translation</b></p></td><td class="cell"><p></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>forest</b></p></td><td class="cell"><p><b>Incremental</b></p></td><td class="cell"><p><b>forest ^</b></p></td><td class="cell"><p><b>Decoder</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>■**</b></p></td><td class="cell"><p><b>Search</b></p></td><td class="cell"><p></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>Prune</b></p></td><td class="cell"><p></p></td><td class="cell"><p></p></td><td class="cell"><p></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr></table><subsection number="4.1" title="Incremental Forest Exploration"><p>The incremental search algorithm inds trees within a forest that are also present in the rule dictionary. Nodes are expanded incrementally to ensure that expansions occur only where there is a possibility of a translation rule when expanded. This section also explains the signiicance of the breadth-irst representation to the working of the algorithm and the reason why depth-irst encoding will not work.</p><p>The algorithm works on a given source lan­guage forest where each node has one or more hy-peredges. The function ProcessJNode in Pseudo­code 1 iterates over each node in a forest in or­der to ind the trees originating at that node. The incremental search itself is detailed in function Find/Tree.Increment in Pseudocode 1. Theincre-ment inding function is now explained here by assuming that a tree is being processed. It can be extended to work with forests as shown in the pseudocode.</p><p>Consider the tree <i>T </i>with <i>k </i>nodes, of which <i>p </i>nodes are leaves, as described in Section 3. The separated breadth-irst representation of <i>T,</i><i> B, </i>is essentially made up of two halves. The irst half of <i>B </i>contains node label identiiers while the lat­ter half contains child counts. This is true when the elements of <i>B </i>are considered as integers only, but the ratio is different in the binary form of <i>B </i>where the irst half is represented using 4 bytes and the second half uses only 1 byte each. Nev­ertheless, both halves represent the information of nodes in sequence <i>N,</i><i> </i>where <i>N</i><i> </i>is in breadth-irst order. To ind a tree <i>T </i>in the rule dictionary, the tree has to be translated to the binary encoding of <i>B </i>to be searched in the index. Then, the tree would need to be expanded at <i>p </i>nodes to check if there are any possible rules that match when ex­panded. The process of inding any expansions of a tree is performed recursively in the function Find_Tree_Increment of Pseudocode 1.</p><p>When expanding trees, the data-structure needs to be an eficient one to operate on, since this is a recursive task. The algorithm should also fa­cilitate a simple way of tracking the position in the tree where the expansion is taking place. This can be performed very easily because of a prop<b>Pseudocode 1 </b>Incremental search for trees <b>proc </b>Get_Translation_Forest <i>sourceForest</i></p><p>RuleDB points to the translation rule database</p><p><b>for </b><i>node </i>in <i>sourceForest </i><b>do call </b>ProcessJNode with <i>node</i> <b>proc </b>ProcessJNode <i>node</i> <b>if </b><i>node </i>doesn't have hyperedges <b>then</b> <i>label </i><i>4 </i><i>node's </i>label <i>word </i><b>4- </b>child of <i>node</i> <b># </b>the only tree possible is 'label(word)' <i>query </i><i>4- </i><b>call </b>SeparatecLBreadthJFirst with <i>label(word)</i></p><doubt alpha="85.7" length="7" tooSmall="False" monospace="0.0">end for</doubt><p><b>if </b><i>query </i>is present in RuleDB <b>then </b>add <i>query </i>to translation forest</p><doubt alpha="83.3" length="6" tooSmall="False" monospace="0.0">end if</doubt><p><b>return end if</b> <i>hyperedges </i><i>4- </i>all hyperedges at <i>node </i><b>for </b><i>hyperedge </i>in <i>hyperedges </i><b>do</b> <i>query </i><i>4- </i><b>call </b>Separated J3readth_First with <i>hyperedge</i></p><p><b>if </b><i>query </i>is found in RuleDB <b>then </b>add <i>query </i>to translation forest <b>if </b><i>query </i>is found or <i>(query </i>is not found but prefix of <i>query </i>is found) <b>then</b></p><p><b>call </b>FincLTreeJncrement with <i>query </i><b>end if end for</b></p><p><b>proc </b>FincLTreeJncrement <i>sbfArray labels </i><i>4- </i>first half of <i>sbfArray childCounts </i><b>4- </b>second half of <i>sbfArray lastNd </i><i>4 </i>node corresponding to <i>labels' </i>last element <i>startNd </i><i>4 </i>node imm.    after node corresponding to <i>childCounts's </i>last non-zero entry # startNd contains the node after the last expanded node # in breadth-first order</p><p><b>for </b><i>node </i>from <i>startNd </i>to <i>lastNd </i><b>do if </b><i>node </i>doesn t have hyperedges <b>then</b> <i>word </i><i>4 </i>child of <i>node</i> <i>appLabel </i><i>4 </i><i>labels </i>+ [word's label] <i>appChild </i><i>4 </i><i>childCounts </i>+ [0] <i>appChild[node] </i><i>4- </i>the number of children of <i>node</i> <i>query </i><i>4 </i><i>appLabel </i>+ <i>appChild</i></p><p><b>continue end if</b> <i>hyperedges </i><i>4 </i>all hyperedges at <i>node </i><b>for </b><i>hyperedge </i>in <i>hyperedges </i><b>do</b> <i>numTails </i><i>4 </i>number of <i>hyperedge </i>s tail nodes <i>appLabel </i><i>4 </i><i>labels </i>+ <i>[hyperedge </i>s tail labels] <i>arrayOfZeroes </i><i>4 </i>[0] * <i>numTails</i> <i>appChild </i><i>4 </i><i>childCounts </i>+ <i>arrayOfZeroes</i> <i>appChild[node] </i><i>4 </i><i>numTails</i> <i>query </i><i>4 </i>appLabel + appChild <b>if </b><i>query </i>is found or <i>(query </i>is not found but preix of <i>query </i>is found) <b>then</b></p><p><b>call </b>Find_TreeJncrement with <i>query </i><b>end if end for end for</b> <b>proc </b>Separate(LBreadth jnrst <i>tree</i> <b>return </b>the separated breadth irst representation of <i>tree</i><page local="6" global="790"/></p><p>erty of the breadth-irst representation. The prop­erty is that, when we expand node <i>ni</i><i> </i>in a tree <i>T, </i>and the <i>depth(ni) </i><i>= </i><i>depth(T) </i>or <i>depth(ni) </i><i>= </i><i>depth(T) — </i><i>1 </i>and $ <i>nj </i>where <i>j &gt; i </i>and nj is expanded, then, the child nodes of node <i>ni</i><i> </i>can simply be appended to <i>N. </i>In the function Find_Tree_Increment, the <i>startNd </i>and <i>lastNd </i>variables point to the start and end of expand­able nodes in the tree represented by <i>sbf Array. </i>The <i>startNd </i>node is located by inding the node immediately after the last expanded node when traversing the sequence <i>N </i>from <i>k </i>to 1. A node <i>ni</i><i> </i>is expanded if <i>ci</i><i> </i>is greater than 0. Hence, since this pattern exists, the recursive function treats its input parameter as a list and ignores the fact that it s operating on a tree.</p><p>A depth-irst representation does not support such a property that allows expansions ofnodes to be appended at the end of the list. This is because the tree expansion for searching rules is such that when a node is expanded, all its children have to be included at once, due to which expansions of trees in the depth-irst method will almost always have child nodes appear in-between the original sequence of nodes. The only exception is when the very last node in the depth-irst sequence is ex­panded. Having successive expansions differ from one another reduces their proximity in the index.</p></subsection></section><section number="5" title="Experiments 5.1 Data"><p>We use two rule collections in our experiments. The rules are extracted from 1.5M word-aligned sentence pairs of Chinese and English from the NIST (2010a) machine translation corpus. The first rule collection contains 11.8M Chinese trans­lation rules, of which about 7.8M are for unique trees. All trees are limited to a depth of ive lev­els. The second rule collection contains 33.1M rules, of which 23.9M are unique. The rules in the second collection are binarized but not limited by depth. The rule collections are 285MB and 2.5GB on disk, respectively, when gzipped.</p><p>In total, we use three forest collections. The irst forest collection contains 254 forests from NIST (2010a) data. The second forest collec­tion contains 288 forests, also obtained by parsing NIST (2010a) data, but they are binarized to work with the second rule collection. The third forest collection contains 348 binarized forests obtained by parsing NIST (2010b) data.</p><subsection number="5.2" title="Setup"><p>The experiments are run on an Intel Core2Duo processor (2.4GHz; 4MB cache) desktop ma­chine with 2GB of RAM. The operating system is Ubuntu desktop edition version 10.04.2. The index and program are installed on two different hard disks, both having a disk speed of 5400 rpm. The disk on which the code is installed has a page size of 4KB while the index disk has a page size of 8KB.</p><p>The index is created using B-tree index struc­tures in the BerkeleyDB (version 5.1) library. The search algorithm is coded in Python and is open sourced<footnote anchor="1"/>. Database accesses from the python pro­gram are through a python wrapper for Berke-leyDB called bsddb3<footnote anchor="2"/>. The B-tree indexes are cre­ated with and without preix compression. We also create indexes with four different page sizes (4K, 8K, 16K, and 32K) to analyse the effect of page size on performance. The sizes of the B-tree rule dictionaries are shown in Table 1.</p><p>Caching has a signiicant impact on perfor­mance measurements for disk-based searching. There are a minimum of 2 levels of caching while performing the tests. One cache is han­dled by the database while the other is a disk level cache managed by the operating system. We clear the database cache by choosing an in­memory cache and re-starting the database pro­cess when required. The commands <i>sync; </i>fol­lowed by <i>echo</i><i> </i><i>3</i><i> </i><i>&gt;</i><i> </i><i>/proc/sys/vm/drop.caches;</i><i> </i>are used to clear the operating system cache.</p><p>Search time is measured using the <i>datetime</i><i> </i>package in Python version 2.6 and cache perfor­mance of the database is measured using Berke-leyDB tools. Every test is run three times and the average time is reported. The exact search process rule set   forest set   baseline breadth-irst is explained in the speciic experiment s sections.<page local="7" global="791"/></p><footnote label="1"> https://bitbucket.org/leopardspot/forest-search  2 http://pybsddb.sourceforge.net/bsddb3.html</footnote><table caption="Table 1: Size of B-tree indexes" class="main" frame="box" rules="all" border="0" regular="False"><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>rule set</p></td><td class="cell"><p>page size</p></td><td class="cell"><p>regular</p></td><td class="cell"><p>compressed</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>1</p></td><td class="cell"><p>4K</p></td><td class="cell"><p>1001MB</p></td><td class="cell"><p>569MB</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>1</p></td><td class="cell"><p>8K</p></td><td class="cell"><p>947MB</p></td><td class="cell"><p>537MB</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>1</p></td><td class="cell"><p>16K</p></td><td class="cell"><p>960MB</p></td><td class="cell"><p>525MB</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>1</p></td><td class="cell"><p>32K</p></td><td class="cell"><p>954MB</p></td><td class="cell"><p>496MB</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>4K</p></td><td class="cell"><p>3.1GB</p></td><td class="cell"><p>1.6GB</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>8K</p></td><td class="cell"><p>3.0GB</p></td><td class="cell"><p>1.5GB</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>16K</p></td><td class="cell"><p>3.0GB</p></td><td class="cell"><p>1.3GB</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>32K</p></td><td class="cell"><p>3.0GB</p></td><td class="cell"><p>1.2GB</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr></table></subsection><subsection number="5.3" title="Incremental Tree Matching"><p><b>Experiment 1: Comparison with baseline</b></p><p>This experiment compares the performance of the baseline system with the breadth-irst index based approach. The baseline checks if each rule in the rule dictionary is found in the forest being trans­lated. If found, the rule is added to the translation forest. Almost one-third of the rules in the full rule collection have a common left-hand side. Also, rules with the same left-hand-side have been found to be consecutive in the collection. Therefore, the outcome of previous rule s check is reused if the current rule is same as the previous one.</p><p>The average forest search time with the baseline setup is compared with the best breadth-irst in­dex based search method in Table 2. The times re­ported for the incremental breadth-irst search are obtained when using a regular 32K page size in­dex. The average time is the ratio of the total time required to search all forests in a forest set, and the number of forests in the set.</p><p><b>Experiment 2: Page size and compression</b></p><p>This experiment compares the effects of page size and compression on the search time in a breadth-irst index. For each forest in a forest collection, the time to search the forest is measured. An av­erage of those times across all forests in the col­lection is shown in Table 3 for indexes of various page sizes, with and without compression.</p><p><b>Experiment 3: Cache utilisation</b></p><p>In order to measure the cache utilisation of the in­dexes, the forests are searched sequentially with­out closing the database or clearing the disk cache. A BerkeleyDB utility is then used to obtain the memory usage statistics which displays the cache hit ratio. The cache usage will depend on the or­der in which the forests are searched and also on the content of the forests. However, the forests are searched in the same order across all indexes, therefore, their relative cache performances can be meaningfully compared.</p></subsection><subsection number="5.4" title="Analysis"><p>From Table 2, it is clear that the baseline method is more than an order of magnitude slower. It can also be observed that forest sets 2 and 3 take about the same amount of time on average over rule set 2. It is therefore clear that the search time for the baseline method is primarily determined by the size of the rule set and not on the size of the for­est. Table 3 shows that the best performance in B-tree indexes is always obtained in the uncom­pressed, or regular, index and when using the 32K page size. However, the performance of the com­pressed index seems to stabilise and not deterio­rate much beyond the 8K page size. Considering that the compressed indexes are almost half the size of the regular index - or even smaller than half in the case of rule set 2 with 16K and 32K page sizes - they might be the better option to consider for very large collections.</p><p>The average run times on a collection of forests depend on the properties of individual forests in the collection. A histogram of the number of forests searched in time intervals shows us that when searching a compressed index the search op­erates faster on already fast searches and slower on the initially-slow searches. Figure 4 and Fig­ure 5 show the histograms for the third set of forests searched using a compressed and an un­compressed index, respectively, each with a page size of 8K. From the igures, it is evident that the number of forests translated in less than 5s - the irst stick in the igures - increase in the com­pressed index, while the slower forests which take about 200s on a regular index take about 250s or<page local="8" global="792"/></p><table caption="Table 3: Average time for breadth-irst search" class="main" frame="box" rules="all" border="0" regular="False"><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>rule</p></td><td class="cell"><p>forest</p></td><td class="cell"><p>page</p></td><td class="cell"><p>regular</p></td><td class="cell"><p>compressed</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>set</p></td><td class="cell"><p>set</p></td><td class="cell"><p>size</p></td><td class="cell"><p>(s)</p></td><td class="cell"><p>(s)</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>1</p></td><td class="cell"><p>1</p></td><td class="cell"><p>4K</p></td><td class="cell"><p>2.35</p></td><td class="cell"><p>2.09</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>1</p></td><td class="cell"><p>1</p></td><td class="cell"><p>8K</p></td><td class="cell"><p>2.01</p></td><td class="cell"><p>1.93</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>1</p></td><td class="cell"><p>1</p></td><td class="cell"><p>16K</p></td><td class="cell"><p>1.69</p></td><td class="cell"><p>1.86</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>1</p></td><td class="cell"><p>1</p></td><td class="cell"><p>32K</p></td><td class="cell"><p>1.55</p></td><td class="cell"><p>2.01</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>2</p></td><td class="cell"><p>4K</p></td><td class="cell"><p>20.86</p></td><td class="cell"><p>22.90</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>2</p></td><td class="cell"><p>8K</p></td><td class="cell"><p>25.42</p></td><td class="cell"><p>18.52</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>2</p></td><td class="cell"><p>16K</p></td><td class="cell"><p>17.73</p></td><td class="cell"><p>18.69</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>2</p></td><td class="cell"><p>32K</p></td><td class="cell"><p>15.71</p></td><td class="cell"><p>19.62</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>3</p></td><td class="cell"><p>4K</p></td><td class="cell"><p>14.13</p></td><td class="cell"><p>15.03</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>3</p></td><td class="cell"><p>8K</p></td><td class="cell"><p>17.86</p></td><td class="cell"><p>12.78</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>3</p></td><td class="cell"><p>16K</p></td><td class="cell"><p>12.63</p></td><td class="cell"><p>13.16</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>3</p></td><td class="cell"><p>32K</p></td><td class="cell"><p>11.49</p></td><td class="cell"><p>14.03</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr></table><table caption="Table 2: Average time to search a forest" class="main" frame="box" rules="all" border="0" regular="False"><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>1</p></td><td class="cell"><p>1</p></td><td class="cell"><p>~ 23min</p></td><td class="cell"><p>1.55sec</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>2</p></td><td class="cell"><p>~ 80min</p></td><td class="cell"><p>15.71sec</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>2</p></td><td class="cell"><p>3</p></td><td class="cell"><p>80min</p></td><td class="cell"><p>11.49sec</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr></table><doubt alpha="0.0" length="11" tooSmall="False" monospace="0.0">100 150 200</doubt><p>Search time (seconds)</p><figure caption="Figure 4: Distribution of forests searched in an 8K compressed index"></figure><doubt alpha="100.0" length="2" tooSmall="False" monospace="0.0">ii</doubt><doubt alpha="58.6" length="29" tooSmall="False" monospace="0.0">100 150 Search time (seconds)</doubt><figure caption="Figure 5: Distribution of forests searched in an 8K uncompressed index"></figure><p>longer on the compressed index. This is true even in other page sizes. Histograms for the 32K page size index - omitted here for lack of space - look similar to Figure 4 and Figure 5, but the com­pressed index shows a very marginal increase in the number of faster forests and a clear increase in the time for the slower forests. But, even without compression, the 32K index has about the same number of forests translated in less than 5s as the faster 8K compressed index.</p><p>Cache utilisation is found to be very high in all cases. The number of pages retrieved from a com­pressed index is always lower than that for an un­compressed one. Cache misses are clearly not the cause for the slowdown in the compressed indexes. The decompress operation is the most likely rea­son. However, with compression, more queries, or keys, would fit in one page which may causes a speedup when fewer queries are required while searching a forest.</p><p>Another observation is that although rule set 2 is about 3 times as large as rule set 1- both in the number of rules and in the size of the index - the search times do not show a 3-fold increase. This could be the result of various factors. One, the rule set 1 might have more pages cached than rule set 2, because it s a smaller index. Two, the depth of the rules in rule set 1 are limited to 5 whereas the depth is not limited in set 2. We feel that the most likely reason in this case is the first one. How­ever, to verify we would have to test with a larger dataset which is limited in depth.</p></subsection></section><section number="6" title="Conclusion and Future Work"><p>We propose a breadth first representation for trees and use that representation in an algorithm to in­crementally find all trees in a forest that are also present in a rule dictionary. We compare the per­formance of the algorithm on two different rule sets and three forest collections. We find our method to outperform an exhaustive search base­line by more than an order of magnitude. We find that the a compressed index provides a balance of fast search and less disk space, but uncompressed indexes are faster with large B-tree page sizes.</p><p>In the future, we would like to explore the prop­erties of forests that influence their search time. We would also like to perform more experiments with depth limitation to ascertain if a depth limit improves performance.</p></section><section title="Acknowledgements"><p>We thank Dr. Liang Huang from ISI, USA and Dr. Haitao Mi from ICT, China, for their feedback and technical discussions during this research. We also thank Google for their travel scholarship awarded to the first author.</p><page local="9" global="793"/></section><references><p>Giorgio Gallo, Giustino Longo, Stefano Pallottino, and Sang Nguyen. 1993. Directed hypergraphs and ap­plications. <i>Discrete Applied Mathematics, </i>42:177­201, April.</p><p>NIST Multimodal Information Group. 2010b. NIST 2008 Open Machine Translation (OpenMT) Evalua­tion, Linguistic Data Consortium, Philadelphia.</p><p>Liang Huang and Haitao Mi. 2010. Efficient incre­mental decoding for tree-to-string translation. In <i>Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, </i>EMNLP</p><p>10, pages 273-283, Stroudsburg, PA, USA. Associ­ation for Computational Linguistics.</p><p>Liang Huang, Kevin Knight, and Aravind Joshi. 2006. A syntax-directed translator with extended domain of locality. In <i>Proceedings of the Workshop on Computationally Hard Problems and Joint Inference in Speech and Language Processing, </i>CHSLP 06, pages 1-8, Stroudsburg, PA, USA. Association for Computational Linguistics.</p><p>Jesper Jansson, Kunihiko Sadakane, and Wing-Kin Sung. 2007. Ultra-succinct representation of or­dered trees. In <i>Proceedings ofthe eighteenth an-nualACM-SIAM symposium on Discrete algorithms,</i></p><p>SODA 07, pages 575-584, Philadelphia, PA, USA.</p><p>Society for Industrial and Applied Mathematics.</p><p>Dan Klein and Christopher D. Manning. 2001. Parsing and hypergraphs. In <i>Seventh International Work­shop on Parsing Technologies (IWPT- 2001), </i>pages 123-134, Beijing, China, October.</p><p>Philipp Koehn. 2004. Pharaoh: a beam search de­coder for phrase-based statistical machine transla­tion models. In <i>Proceedings ofthe Sixth Confer­ence ofthe Association for Machine Translation in the Americas, </i>pages 115-124.</p><p>Yang Liu, Qun Liu, and Shouxun Lin. 2006. Tree-to-string alignment template for statistical machine translation. In <i>Proceedings ofthe 21st International Conference on Computational Linguistics and the 44th annual meeting of the Association for Com­putational Linguistics, </i>ACL-44, pages 609-616, Stroudsburg, PA, USA. Association for Computa­tional Linguistics.</p><p>Haitao Mi and Liang Huang. 2008. Forest-based trans­lation rule extraction. In <i>Proceedings ofthe Con­ference on Empirical Methods in Natural Language</i> <i>Processing, </i>EMNLP 08, pages 206-214, Strouds-burg, PA, USA. Association for Computational Lin­guistics.</p><p>Haitao Mi, Liang Huang, and Qun Liu. 2008. Forest-based translation. In <i>Proceedings of ACL-08: HIT,</i> pages 192-199, Columbus, Ohio, USA, June. Asso­ciation for Computational Linguistics.</p><p>Michael A. Olson, Keith Bostic, and Margo Seltzer. 1999. Berkeley DB. In <i>Proceedings ofthe annual conference on USENIX Annual Technical Confer­ence, </i>pages 43-43, Berkeley, CA, USA. USENIX Association.</p></references></body></article>