SlowGuess/ACL_2020_OCR huggingface dataset:
Proposition 3. The number of ways of instantiations of any inference rule is in  $\mathcal{O}(n^{\delta^{*}}d^{m_{g}}3^{dn_{g}})$  where  $n_g / m_g$  is the maximum count of nodes/terminal-edges of any RHS in  $\mathcal{G}$  and  $\delta^{*}$  is the maximum  $\delta$  of any RHS in  $\mathcal{G}$ .
Proof. When applying an inference rule on  $\eta$ , we first select the mappings for nodes in  $S(\eta)$  independently. According to the definition of  $S(\eta)$  for an active node  $v \notin S(\eta)$ , there must be a node
4105
$u \in S(\eta)$  such that  $u$  and  $v$  belong to the same connected component  $c$  of term  $(R_{\geq \eta})$ . Because  $u$  is already bounded, the number of isomorphisms of  $c$  is in  $\mathcal{O}(d^{m_c})$  where  $m_c$  is the number of edges in  $c$ . By enumerating nodes like  $v$ , we can get a set of connected components consisting of only terminal edges. The number of isomorphisms of all these components is in  $\mathcal{O}(\prod_c d^{m_c}) \leq \mathcal{O}(d^{m_g})$ . Therefore, the number of possible mappings for all active nodes is in  $\mathcal{O}(n^{|S(\eta)|} d^{m_g}) \leq \mathcal{O}(n^{\delta^*} d^{m_g})$ . The analysis for boundary edges is similar to Chiang et al.'s. The only difference is that the tree decomposition which minimizes  $\delta$  may not minimize the treewidth  $k$ . Since  $k \leq n_g - 1$ , the number of ways of boundary edges is in  $\mathcal{O}(3^{dn_g})$ .
We can conclude from Proposition 2 and 3 that our locality-centric analysis is tighter than the treewidth-centric one, and the upper bound of time complexity may decrease for some restricted HRGs. In Fig. 4, the treewidth of  $T_{2}$  is 3, but  $\delta(T_{2}) = 1$ . So the number of rule instantiations that can be applied along with  $T_{2}$  is in  $\mathcal{O}(n)$  instead of  $\mathcal{O}(n^{4})$ . In §4.3, we will introduce Weakly Regular Graph Grammar (WRGG), a new subclass of HRG, the  $\delta$  of which is more intuitively understandable.
4.3 Weakly Regular Graph Grammar
We discuss prototypes of HRG rules, investigating their key properties in a linguistic context. We then formally define WRGG that reflects the linguistic emphasis and also show that WRGG is actually a very expressive subclass of HRG.
Firstly, the HRG rule under discussion allows at most two non-terminals at RHS. Computationally speaking, we can transform a multi-branching rule into multiple binary rules without loss of expressiveness, as we are able to get a CFG in Chomsky Normal Form for any CFG. Linguistically speaking, multi-branching rules have been removed from generative linguistic theories, since at least Minimalist Program (Chomsky, 1995). Fig. 9 presents four prototypes with the binary constriction.  $\gamma_{3},\gamma_{6},\gamma_{7},\gamma_{8}$  and  $\gamma_{9}$  in Fig. 1 are of T0,  $\gamma_{1}$ ,  $\gamma_{4},\gamma_{5}$  and  $\gamma_{10}$  are of T1, and  $\gamma_{2}$  is of T3. Secondly, for a lexicalized grammar, most rules are of T0 or T1, since constructions barely take semantic materials. If a rule introduces heavy constructional meaning, it may affect one of its intermediate constituents (T2) or bridge the meanings between both of its intermediate constituents (T3),
Figure 9: Prototypes of binary HRG rules: (T0) lexical rules, (T1) rules without terminal edges, (T2) only one nonterminal edge of the rules contains non-free nodes, and (T3) both nonterminal edges of the rules contain non-free nodes. The area in blue represents all terminal edges. Dashed edges indicate optionality.
and hardly affect its intermediate constituent separately. Even though a rule has multiple terminal components, we can replace it with several rules of T0-T3. Thirdly, a node that is only connected to a nonterminal edge is a kind of placeholder, in that it does not affect current semantic composition but will be used in future. Otherwise it has been removed in a previous step. Finally, we do not consider disconnected RHS because it yields disconnected graphs.
Definition 2. A node  $v$  in an edge-labeled graph  $G$  is free, if  $E(v)$  contains only nonterminal edge(s). The number of those nodes is denoted by  $f(G)$ .
In Fig. 8, ① ② ③ are free nodes of  $R_{\geq \eta}$ .
Definition 3. A weakly regular rule  $A \to R$  satisfies the following conditions: (1)  $R$  is connected; (2) term(R) is an empty graph or a connected graph; (3) if a free node of  $R$  is incident to only one edge, it is also an external node.
Definition 4. An HRG is weakly regular, if all of its rules are weakly regular.
Proposition 4. If  $A \to R$  is binary and weakly regular, then  $\delta(R) = f(R)$  or  $f(R) + 1$ .
The proofs of this proposition can be found in the appendix. The tree shown in Fig. 10 is a valid nice tree decomposition of  $R$  and the  $\delta$  of the tree is  $f(R)$  or  $f(R) + 1$ . We argue that for parsing with a binary WRGG, the number of free nodes is more meaningful and we can use the tree decomposition shown in Fig. 10 rather than a tree decomposition with minimum treewidth.
Courcelle (1991) introduces Regular Graph Grammar (RGG). It is provable that RGG is a subclass of WRGG. There are no free nodes in RGG and graph parsing with an RGG can be finished in linear time by applying Chiang et al.'s algorithm.
Figure 10: A terminal edge-first tree decomposition of a binary and weakly regular rule. For every node  $\eta_{i}(1\leq i\leq l + 2)$ ,  $V_{\eta_i} = bn(R_{\geq \eta_i})\cup V(e_i)$  and  $E_{\eta_i} = \{e_i\}$ .  $e_1,\ldots ,e_l$  are terminal edges ordered by visiting time of a depth-first traversal.  $e_{l + 1},e_{l + 2}$  are nonterminal edges arranged in order such that  $R_{\geq \eta_{l + 1}}$  is also a connected graph.
This result is comparable to another algorithm proposed by Gilroy et al. (2017). However, the strong restrictions of RGG make it too weak to model linguistic structures. WRGG is much more linguistically adequate.
4.4 Distributed Argument-Structure
We value the trigger role played by terminal edges in an HRG rule. Now let us revisit the derivation governed by a lexicalized grammar. It is obvious that lexical rules try to use up all terminal edges at the initial stage of syntactic-semantic composition. If we can distribute terminal edges to all rules, both lexical and phrasal, we are able to get a reduced number of free nodes on average and in exactly this way improve graph parsing remarkably. The idea to distribute argument-structures exhibits a constructivist perspective, which is a competing hypothesis to lexicalism that dominates our field for dozens of years, since at least Bresnan and Kaplan (1982). The constructivist approaches to argument structures have been recently discussed by different theoretical linguistic theories, including but not limited to Distributed Morphology (Halle and Marantz, 1993, 1994) and Sign-Based Construction Grammar (Boas and Sag, 2012). The emphasis on the advantage of Distributed Argument-Structure under the consideration of language production is a computational support for many constructivist approaches.
Fig. 11 demonstrates a derivation with a construction grammar. Compare  $\gamma_{12}$  to  $\gamma_{4}$  and  $\gamma_{13}$  to  $\gamma_{5}$ , we can clearly see that  $\delta$  is significantly reduced. A comparison of lexical rules also confirms the importance of distributed argument-structure.
4.5 Fast Accessing of Chart Items
We will complete our discussion on locality by considering the edge-zero case, i.e. unifying nodes. In Fig. 8, when we try to integrate  $R_{\geq \eta_1}$  and  $R_{\geq \eta_2}$ , we must make sure that the three nodes
Figure 11: Semantic composition with a CxG.
on the boundary, viz. ②, ④ and ⑤, are identical in terms of mappings relative to  $\eta_{1}$  and  $\eta_{2}$  respectively. Otherwise, a failure occurs. In both cases, trying to unify them causes a bottleneck for graph parsing, as conceptually suggested in §3.3 and empirically confirmed by Tab. 2.
Considering the above problem in the framework of chart parsing, we would like to construct a data structure to efficiently access all chart items. In particular, when partial information is provided, this data structure can quickly find all compatible chart items. In this paper, we use a map, with the keys being partial information for query and the values being sets of chart items. The implementation used in §3.4 follows the method proposed by Chiang et al. (2013), only mentioning  $\ell(e)$  or  $\eta$  for indexing, which is not efficient in practice. We propose to build a more comprehensive map. See Tab. 3 for an example of our map.
Indexing key(s)	Item
{Y,3,{<1,A>,<2,C>,<3,F>}}	P1
{Y,3,{<1,A>,<3,F>}}	Y,3,{<2,C>,<3,F>}
{Y,3,{<1,A>}	Y,3,{<2,C>}
{Y,3,{<1,A>,<2,C>}	Y,3,{<3,F>}
{X,1,{<1,B>}	P2,A4
{η,{<2,A>,<3,F>,<4,B>}	A2,A3
Table 3: Examples for indexing chart items in Fig. 5.  $P_{1}$  has multiple keys.
During recognizing  $\eta$ , the set of nodes which connect branching subgraph(s)  $C(\eta)$  is  $bn(R_{\geq \eta_1}) \cap bn(R_{\geq \eta_2})$  for binary case, and  $bn(R_{\geq \eta_1}) \cap V(e)$  for unary case. Let  $e = (v_1, \dots, v_{|V(e)|})$  denote a hyperedge and index  $(e, v_i) = i$  denote an indexing function. For a list of nodes  $B$ ,  $B[i]$  denotes its  $i$ -th node. A passive item  $[A, J, B_x]$  has mul
tiple indexing keys. For a non-empty set of positive integers  $\text{mask} \subseteq \{1,2,\dots,|bn(J)|\}$ ,  $\langle A, |bn(J)|, \{\langle i, B_x[i] \rangle | i \in \text{mask} \} \rangle$  is a plausible key. For active item  $[\ast, \eta_1, I, \varphi]$ , let  $\eta$  be the parent of  $\eta_1$ . If  $\eta$  is binary, the item should be indexed by  $\langle \eta_1, \{\langle v, \varphi(v) \rangle | v \in C(\eta) \} \rangle$ . Otherwise  $\eta$  is unary and introduces some edge  $e$ . The item should be indexed by  $\langle \ell(e), |V(e)|, \{\langle \text{index}(e,v), \varphi(v) \rangle | v \in C(\eta) \} \rangle$ . During parsing, two items will be integrated only when they have the same key.
Note that the number of possible mask's for a passive item grows exponentially w.r.t. the number of the corresponding external nodes. However a significant number of mask's are not used by any tree decomposition of any rule. And such mask's can be found by processing a grammar before parsing. For all HRGs used for experiments, the maximum number of useful mask's for a passive item is 15.
4.6 Empirical Evaluation
A construction grammar (CxG) is automatically induced in a similar way to the experiments in §3.4. Note that our grammar extraction procedure makes sure that this grammar is weakly regular. As shown in Tab. 4, the average number of free nodes in CxG is much smaller. We conduct new experiments using the improvements mentioned in previous sections. We re-run the improved parser on 4195 EDS graphs, which can successfully receive derivation forests from the original parser. Tab. 5 and Fig. 12 show the effectiveness of our improvements. The terminal-first tree decomposition (as illustrated in Fig. 10) is able to significantly reduce the number of integrations. Our indexing method can effectively reduce the number of failed integrations. For the CxG, using the terminal-edge first strategy is more effective than the indexing strategy. Note that the cost to build a map for indexing chart items is not ignorable.
#Rule	Treewidth	δ	#Free
CxG	Lexical	34,348	avg.	0.36	—	—
max.	4	—	—
Phrasal	7,978	avg.	1.68	1.59	0.59
max.	7	7	6
LxG	Phrasal	8,594	avg.	1.62	2.51	2.27
max.	6	7	7
Table 4: Statistics of the CxG. #Free means the number of free nodes in HRG rules.
Time(s)	#Succ	#Total	#Succ/#Total
LxG	original	21.64	303.6	146535	0.21%
+terminal-first	21.02	174.9	145320	0.12%
+index	1.93	303.6	7165	4.24%
+both	1.51	174.9	6923	2.53%
CxG	original	0.41	61.4	1082	5.67%
+terminal-first	0.12	9.0	406	2.23%
+index	0.32	61.4	190	32.34%
+both	0.07	9.0	31	29.34 %
large (+both)	0.45	50.1	485	10.34 %
305 (+both)	0.32	35.5	379	9.40 %
Table 5: Performance of our implementation with improvements. The unit of integrations is  $10^{4}$  in the table. terminal-first means the terminal-first tree decomposition; index means the method proposed in §4.5; both means to use both terminal-first and index. large means to test the algorithm on 189 graphs with the size in the range of 70 to 90. 305 means to test the algorithm on the 305 graphs which receives an OOM error in previous experiment (§3.4).
Figure 12: The number of total integrations relative to size of input graphs. All data points in the plot are the average value on test samples of a given size.
We introduce several locality-centric refinements to advance graph parsing and empirically evaluate their effectiveness. We show that exact graph parsing can be efficient even for large graphs and with large graph grammars.
This work is supported in part by the National Hi-Tech R&D Program of China (No. 2018YFC0831900). Weiwei Sun is the corresponding author.
Hans Christian Boas and Ivan A Sag. 2012. Sign-based construction grammar. CSLI Publications/Center for the Study of Language and Information.
Joan Bresnan and Ronald M. Kaplan. 1982. Introduction: Grammars as mental representations of language. In J. Bresnan, editor, The Mental Representation of Grammatical Relations, pages xvii-lii. MIT Press, Cambridge, MA.
Yufei Chen, Weiwei Sun, and Xiaojun Wan. 2018. Accurate shrg-based semantic parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 408-418. Association for Computational Linguistics.
David Chiang, Jacob Andreas, Daniel Bauer, Karl Moritz Hermann, Bevan Jones, and Kevin Knight. 2013. Parsing graphs with Hyperedge Replacement Grammars. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 924-932, Sofia, Bulgaria. Association for Computational Linguistics.
Noam Chomsky. 1995. The Minimalist Program. MIT Press, Cambridge, MA.
Bruno Courcelle. 1991. The monadic second-order logic of graphs v: On closing the gap between definability and recognizability. Theoretical Computer Science, 80(2):153-202.
F. Drewes, H.-J. Kreowski, and A. Habel. 1997. Hyperedge Replacement Graph Grammars. In Grzegorz Rozenberg, editor, Handbook of Graph Grammars and Computing by Graph Transformation, pages 95-162. World Scientific Publishing Co., Inc., River Edge, NJ, USA.
Daniel Flickinger, Yi Zhang, and Valia Kordoni. 2012. Deepbank: A dynamically annotated treebank of the wall street journal. In Proceedings of the Eleventh International Workshop on Treebanks and Linguistic Theories, pages 85-96.
Sorcha Gilroy, Adam Lopez, and Sebastian Maneth. 2017. Parsing graphs with regular graph grammars. In Proceedings of the 6th Joint Conference on Lexical and Computational Semantics (* SEM 2017), pages 199-208.
Jonas Groschwitz, Alexander Koller, and Christoph Teichmann. 2015. Graph parsing with s-graph grammars. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1481-1490.
M Halle and Alec Marantz. 1993. Distributed morphology and the pieces of inflection, pages 111-176. The MIT Press.
Morris Halle and Alec Marantz. 1994. Some key features of distributed morphology. MIT working papers in linguistics, 21(275):88.
Martin Kay. 1996. Chart generation. In 34th Annual Meeting of the Association for Computational Linguistics, pages 200-204.
Alexander Koller, Stephan Oepen, and Weiwei Sun. 2019. Graph-based meaning representations: Design and processing. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: Tutorial Abstracts, pages 6-11, Florence, Italy. Association for Computational Linguistics.
Stephan Oepen and Jan Tore Lønning. 2006. Discriminant-based mrs banking. In Proceedings of the Fifth International Conference on Language Resources and Evaluation (LREC-2006), Genoa, Italy. European Language Resources Association (ELRA). ACL Anthology Identifier: L06-1214.
Mark Steedman. 1996. Surface Structure and Interpretation. Linguistic Inquiry Monographs. Mit Press.
Mark Steedman. 2000. The syntactic process. MIT Press, Cambridge, MA, USA.
A Proof for Proposition 4
We provide the proof for  $R$  with two nonterminal edges:  $e_{X}$  and  $e_{Y}$ .
Firstly, we prove  $\delta(R) \geq f(R)$ . For any nice tree decomposition  $T_R$  of  $R$ , let  $\eta_m$  be the node with minimum height such that  $R_{\underline{\geq}\eta_m}$  contains both  $e_X$  and  $e_Y$ .
[1]  $\eta_{m}$  is binary. Let  $\eta_1,\eta_2$  be the two children of  $\eta_{m}$ . Without loss of generality, we assume  $R_{\geq \eta_1}$  contains  $e_X$  and  $R_{\geq \eta_2}$  contains  $e_Y$ .
[2]  $\eta_{m}$  is unary. Let  $\eta_{1}$  be the only child of  $\eta_{m}$ . In this case,  $\eta_{m}$  introduces either  $e_{X}$  or  $e_{Y}$ . Without loss of generality, we assume  $\eta_{m}$  introduces  $e_{X}$ .
Let  $v$  be a free node of  $R$ .
Case 1  $v$  is incident to only one of  $e_{X}$  and  $e_{Y}$ . By property (3) of weakly regularity,  $v$  is an external node of  $R$ . Therefore,  $v \in bn(R) \subset bn(R_{\geq \eta_1}) \subset A(\eta_m)$ .
Case 2  $v$  is incident to both  $e_X$  and  $e_Y$ . When  $\eta_m$  is binary ([1]), we have  $v \in bn(R_{\geq \eta_1}) \cap bn(R_{\geq \eta_2}) \subset A(\eta_m)$ . When  $\eta_m$  is unary ([2]), we have  $v \in V(e_X) \subset A(\eta_m)$ .
By the above discussion, we conclude that all free nodes of  $R$  are active nodes of  $\eta_{m}$  and it is obvious that free nodes are independent. As a result, we have  $\delta(T_{R}) \geq \delta(\eta_{m}) \geq f(R)$ . The arbitrariness of  $T_{R}$  ensures that  $\delta(R) \geq f(R)$ .
Secondly, we prove that  $\delta(R) \geq f(R) + 1$  for prototype T3. If the rule is type T3, then there exist two nodes  $v, u$  such that  $v$  is incident with  $e_X$ ,  $u$  is incident with  $e_Y$  and  $u, v$  are in term  $(R)$ .
Case 1  $u = v$ . We have  $u \in bn(R_{\geq \eta_1}) \cap bn(R_{\geq \eta_2}) \subset A(\eta_m)$ .
Case 2  $u \neq v$  and  $\eta_{m}$  is unary ([2]). We have  $v \in V(e_{X}) \subset A(\eta_{m})$ .
Case 3  $u \neq v$  and  $\eta_{m}$  is binary ([1]). According to the property (2) of weakly regularity, term(R) is connected. So there exists a path  $e_1, e_2, \ldots, e_s (s \geq 1)$  in term(R) such that  $u \in V(e_1)$  and  $v \in V(e_s)$ . Let  $i$  be the minimum index such that  $e_i$  is not in  $R_{\geq \eta_1}$ . If  $i = 1$ , then  $u$  has an edge  $e_1$  which is not in  $R_{\geq \eta_1}$ . Therefore,  $u \in bn(R_{\geq \eta_1}) \subseteq$
$A(\eta_{m})$ . If  $s \geq i > 1$ , then all nodes inside  $V(e_{i-1}) \cap V(e_{i})$  are boundary nodes of  $R_{\geq \eta_{1}}$ . Therefore these nodes all belong to  $A(\eta_{m})$ . If  $i$  does not exist, then  $v$  has an edge  $e_{s}$  which is not in  $R_{\geq \eta_{2}}$ . Therefore,  $v \in bn(R_{\geq \eta_{2}}) \subseteq A(\eta_{m})$ .
By the above discussion, there is at least one active node which is not a free node. It is trivial that the node is independent with any free nodes. Therefore,  $\delta (T_R)\geq \delta (\eta_m)\geq f(R) + 1$ . The arbitrariness of  $T_{R}$  ensures that  $\delta (R)\geq f(R) + 1$
Thirdly, we prove that the equality can be achieved. It is trivial to prove that the tree  $T$  shown in Fig. 10 is a valid nice tree decomposition by going through the properties of tree decomposition. Since  $R_{\geq \eta_i}$ $(1 \leq i \leq l)$  is a connected terminal graph, we have  $\delta(\eta_i) = 1$ . By going through the four possible prototypes of current rule shown in Fig. 9, we conclude that  $\delta(\eta_j) \leq f(R) + 1$ , for  $l + 1 \leq j \leq l + 2$ . Therefore,  $\delta(R) \leq \delta(T) = \max_{p \in \mathbb{N}_T} \delta(\eta) \leq f(R) + 1$ .
In summary, we have  $f(R) \leq \delta(R) \leq f(R) + 1$ .