Venue: NAACL 2019

# Implementation of a Chomsky-Schutzenberger \(n\)-Best Parser

for Weighted Multiple Context-Free Grammars

Thomas Ruprecht

Tobias Denkinger

Faculty of Computer Science

Technische Universitat Dresden

01062 Dresden, Germany

{thomas.ruprecht,tobias.denkinger}@tu-dresden.de

###### Abstract

Constituent parsing has been studied extensively in the last decades. Chomsky-Schutzenberger parsing as an approach to constituent parsing has only been investigated theoretically, yet. It uses the decomposition of a language into a regular language, a homomorphism, and a bracket language to divide the parsing problem into simpler subproblems. We provide the first implementation of Chomsky-Schutzenberger parsing. It employs multiple context-free grammars and incorporates many refinements to achieve feasibility. We compare its performance to state-of-the-art grammar-based parsers.

## 1 Introduction

The description of the syntax of natural languages (such as Danish, English, and German) with the help of formal grammars has been studied since Chomsky (1956). With a formal grammar, computers can calculate a syntactic representation (called _parse_) of a sentence in a natural language. Of the grammar classes in the Chomsky hierarchy Chomsky (1959), context-free grammars (short: CFGs) lack the expressive power necessary to model natural languages Shieber (1985) and parsing with context-sensitive grammars cannot be done efficiently (i.e. in polynomial time). This led to the introduction of a series of classes of _mildly context-sensitive grammars_Joshi (1985) that allow parsing in polynomial time but also capture an increasing amount of phenomena present in natural languages. Tree adjoining grammars Joshi et al. (1975), linear context-free string-rewriting systems (short: LCFRSs, Vijay-Shanker et al. (1987), and multiple CFGs short: MCFGs, Seki et al. (1991) are among those classes.

_Chomsky-Schutzenberger (short: CS) parsing_ was introduced by Hulden (2011) for CFGs and extended to MCFGs by Denkinger (2017). It uses a classical theorem by Chomsky and Schutzenberger (1963, or the generalisation by Yoshinaka et al. (2010), which states that the language \(\mathcal{L}(G)\) of a CFG (or an MCFG) \(G\) can be represented by a regular language \(R\), a homomorphism \(h\), and a Dyck language (resp. multiple Dyck language) \(D\) such that \(\mathcal{L}(G)=h(R\cap D)\). The elements of \(R\cap D\) correspond to parses in \(G\). For a sentence \(w\), a CS parser calculates the elements of \(h^{-1}(w)\cap R\cap D\) and transforms them into parses. CS parsing can be viewed as a coarse-to-fine mechanism where \(R\) corresponds to the coarse grammar and \(R\cap D\) to the fine grammar. The respective coarse-to-fine pipeline consists of (conceptually) simple operations such as \(h^{-1}\) or the intersection with \(R\), which provides great flexibility. The flexibility is used to provide a fallback mechanism in case a finer stage of the pipeline rejects all proposals of a coarser stage. It also permits CS parsing in a broader setting than usual (for parsing) with minimal modification (see sec. 6).

We suspected that the coarse-to-fine view on CS parsing leads to an efficient implementation. Since initial tests revealed that the original algorithm for MCFGs Denkinger (2017), alg. 3, recalled in sec. 2) is not feasible in practice, we explore numerous optimisations (sec. 4), one of which is the use of a context-free approximation of the multiple Dyck language \(D\). We introduce _component-wise derivations_ (sec. 3) to relate this context-free approximation to \(D\). Employing the optimisations, we provide the first implementation of a CS parser. In sec. 5, we compare our parser's performance to Grammatical Framework Angelov and Ljunglof (2014), rparse Kallmeyer and Maier (2013), and disco-dop van Cranburgh et al. (2016). We restrict our comparison to (discontinuous) grammar-based parsers (excluding e.g. transition systems, Maier (2015); Coavoux and Crabbe (2017) since the principle of CS parsing requires a grammar.





## 2 Preliminaries

The sets of _non-negative integers_ and _positive integers_ are denoted by \({\mathbb{N}}\) and \({\mathbb{N}}_{+}\), respectively. We abbreviate \(\{1,\ldots,n\}\) by \([n]\) for each \(n\in{\mathbb{N}}\).

Let \(A\) and \(B\) be sets. The _powerset of \(A\)_ and the _set of (finite) strings over \(A\)_ are denoted by \({\cal P}(A)\) and \(A^{*}\), respectively. The _set of possibly infinite sequences of elements of \(A\)_ is denoted by \(A^{\omega}\). A _partition of \(A\)_ is a set \(\mathfrak{P}\subseteq{\cal P}(A)\) whose elements (called _cells_) are non-empty, pairwise disjoint, and cover \(A\) (i.e. \(\bigcup_{\mathfrak{p}\in\mathfrak{T}}\mathfrak{p}=A\)). For each \(a\in A\) and each equivalence relation \(\approx\) on \(A\), we denoted the _equivalence class of a w.r.t. \(\approx\)_ by \([a]_{\infty}\). The set of _functions from \(A\) to \(B\)_ is denoted by \(A\to B\). Note that \((A\to B)\subseteq(A\times B)\). The _composition_ of two binary relations \(R_{1}\) and \(R_{2}\) is \(R_{2}\circ R_{1}=\{(a,c)~{}|~{}\exists b\colon(a,b)\in R_{1},(b,c)\in R_{2}\}\).

Finite state automata.We assume that the reader is familiar with finite state automata. For details, we refer to Hopcroft and Ullman (1979).

A _finite state automaton_ (short: FSA) is a tuple \({\cal A}=(Q,\Delta,q_{\rm i},q_{\rm f},T)\) where \(Q\) and \(\Delta\) are finite sets (_states_ and _terminals_, respectively), \(q_{\rm i},q_{\rm f}\in Q\) (_initial_ and _final state_, respectively), and \(T\subseteq Q\times\Delta^{*}\times Q\) is finite (_transitions_). We call \(q\) the _source_ and \(q^{\prime}\) the _target_ of a transition \((q,u,q^{\prime})\). A _run_ is a string \(\theta\) of transitions such that the target of a transition is the source of the next transition in \(\theta\). The _language of \({\cal A}\)_ is denoted by \({\cal L}({\cal A})\).

Sorts.Sorts are a widespread concept in computer science: one can think of sorts as data types in a programming language. Let \(S\) be a set (of _sorts_). An _\(S\)-sorted set_ is a tuple \((\Omega,sort)\) where \(\Omega\) is a set and \(sort\colon\Omega\to S\). We abbreviate \((\Omega,sort)\) by \(\Omega\) and \(sort^{-1}(s)\) by \(\Omega_{s}\) for \(s\in S\).

Now let \(\Omega\) be an \((S^{*}\times S)\)-sorted set. The _set of trees over \(\Omega\)_ is the \(S\)-sorted set \({\mathrm{T}}_{\Omega}\) where \(({\mathrm{T}}_{\Omega})_{s}=\{\omega(t_{1},\dots,t_{k})~{}|~{}s_{1},\dots,s_{ k}\in S,\omega\in\Omega_{(s_{1}\cdots s_{k},s)},t_{1}\in({\mathrm{T}}_{\Omega})_{s_{1}}, \dots,t_{k}\in({\mathrm{T}}_{\Omega})_{s_{k}}\}\) for each \(s\in S\).

Multiple context-free grammars.A rule of a context-free grammar has the ability to concatenate the strings generated by its right-hand side non-terminals. _Multiple_ context-free grammars extend this ability to concatenating string-_tuples_. This is done with the help of composition functions. Let \(\Sigma\) be a finite set. A _composition function w.r.t. \(\Sigma\)_ is a function \(c\) that takes tuples of strings over \(\Sigma\) as arguments and returns a tuple of strings over \(\Sigma\) (i.e. there are \(k\in{\mathbb{N}}\) and \(s_{1},\dots,s_{k},s\in{\mathbb{N}}_{+}\) such that \(c\colon(\Sigma^{*})^{s_{1}}\times\dots\times(\Sigma^{*})^{s_{k}}\rightarrow( \Sigma^{*})^{s}\)), and is defined by an equation \(c((x_{1}^{1},\dots,x_{1}^{s_{1}}),\dots,(x_{k}^{1},\dots,x_{k}^{s_{k}}))=(u_{1 },\dots,u_{s})\) where \(u_{1},\dots,u_{s}\) are strings of \(x_{j}^{j}\)'s and symbols from \(\Sigma\). We call \(c\)_linear_ if each \(x_{i}^{j}\) occurs at most once in \(u_{1}\cdots u_{s}\). We sometimes write \([u_{1},\dots,u_{s}]\) instead of \(c\). Furthermore, setting \(sort(c)=(s_{1}\cdots s_{k},s)\), the composition functions w.r.t. \(\Sigma\) form a sorted set.

The following example shows how linear composition functions are used in the rules of a multiple context-free grammar.

**Example 1**.: Consider \(G=(N,\Sigma,S,P)\) where \(N=\{S,A,B\}\) and \(\Sigma=\{{\mathrm{a}},{\mathrm{b}},{\mathrm{c}},{\mathrm{d}}\}\) are finite sets (_non-terminals_ and _terminals_, respectively), \(S\in N\) (_initial non-terminal_) and \(P\) is a finite set (_rules_) that contains the following five objects:

\[\rho_{1} =S\rightarrow[x_{1}^{1}x_{2}^{1}x_{1}^{2}x_{2}^{2}](A,B)\] \[\rho_{2} =A\rightarrow[{\mathrm{a}}x_{1}^{1},cx_{1}^{2}](A)\quad\rho_{4}=A \rightarrow[\varepsilon,\varepsilon]()\] \[\rho_{3} =B\rightarrow[{\mathrm{b}}x_{1}^{1},{\mathrm{d}}x_{1}^{2}](B)\quad \rho_{5}=B\rightarrow[\varepsilon,\varepsilon]().\]

We call \(G\) a multiple context-free grammar. Consider the rule \(\rho_{1}\). Similar to a rule of a context-free grammar, \(\rho_{1}\) rule has one left-hand side non-terminal (\(S\)) and zero or more right-hand side non-terminals (\(A\) and \(B\)). A _derivation of \(G\)_ can be build by combining rules in \(P\) to form a tree according to their left- and right-hand side non-terminals. If a derivation starts with the initial non-terminal (here \(S\)), then it is called _complete_. Hence, each complete derivation in \(G\) has the form \(d_{m,n}=\rho_{1}(\rho_{2}^{m}(\rho_{4}),\rho_{3}^{n}(\rho_{5}))\) for some \(m,n\in{\mathbb{N}}\). If we replace each rule in a derivation by its composition function, we obtain a term of composition functions which can be evaluated. We call the resulting value the _yield_ of a derivation. A derivation \(d_{m,n}\) has yield \(\operatorname{yd}(d_{m,n})={\mathrm{a}}^{\text{m}}{\mathrm{b}}^{\text{n}}{ \mathrm{c}}^{\text{m}}{\mathrm{d}}^{n}\). The set of yields of all complete derivations is the _language of \(G\)_: \({\mathcal{L}}(G)=\{{\mathrm{a}}^{\text{m}}{\mathrm{b}}^{\text{n}}{\mathrm{c}}^{ \text{m}}{\mathrm{d}}^{n}~{}|~{}m,n\in{\mathbb{N}}\}\). 

The following definition formalises the notions of ex. 1 and introduces some additional concepts.

**Definition 2** (Seki et al., 1991).: A _multiple context-free grammar_ (short: MCFG) is a tuple \(G=(N,\Sigma,S,P)\) where \(N\) is a finite \({\mathbb{N}}_{+}\)-sorted set (_non-terminals_), \(\Sigma\) is a finite set (_terminals_), \(S\in N_{1}\) (_initial non-terminal_), \(P\) is a finite \((N^{*}\times N)\)-sorted set of strings \(\rho\) of the form \(A\to c(B_{1},\dots,B_{k})\) such that \(A,B_{1},\dots,B_{k}\in N\),

\((sort(B_{1})\cdots sort(B_{k}),sort(A))\). The sort of \(\rho\) is \((B_{1}\cdots B_{k},A)\). The _left-hand side_ (short: lhs) of \(\rho\) is \(A\). The _fanout of \(\rho\)_ is \(\operatorname{fanout}(\rho)=sort(A)\) and the _rank of \(\rho\)_ is \(\mathit{rank}(\rho)=k\). The elements of \(P\) are called _rules_.

The _set of derivations (resp. complete derivations) of \(G\)_ is \(\mathrm{D}_{G}=\mathrm{T}_{P}\) (resp. \(\mathrm{D}^{*}_{G}=(\mathrm{T}_{P})_{S}\)). Let \(w\in\Sigma^{*}\) and \(d=\rho(d_{1},\ldots,d_{k})\in\mathrm{D}_{G}\) with \(\rho=A\to c(B_{1},\ldots,B_{k})\). The _yield of \(d\)_ is \(\operatorname{yd}(d)=c(\operatorname{yd}(d_{1}),\ldots,\operatorname{yd}(d_{ k}))\). The _set of derivations of \(w\) in \(G\)_ is \(\mathrm{D}^{*}_{G}(w)=\operatorname{yd}^{-1}(w)\cap\mathrm{D}^{*}_{G}\). The _language of \(A\) in \(G\)_ is \(\mathcal{L}(G,A)=\{\operatorname{yd}(d)~{}|~{}d\in(\mathrm{T}_{P})_{A}\}\). The _language of \(G\)_ is \(\mathcal{L}(G)=\mathcal{L}(G,S)\). Any language generated by an MCFG is called _multiple context-free_ (short: mcf). \(\square\)

A _context-free grammar_ (short: CFG) is an MCFG where each non-terminal has sort 1. Each rule of a CFG has the form \(A\rightarrow[u_{0}x_{i(1)}^{1}u_{1}\cdots x_{i(n)}^{1}u_{n}](B_{1},\ldots,B_{k})\). We abbreviate this rule by \(A\to u_{0}B_{i(1)}u_{1}\cdots B_{i(n)}u_{n}\).

Weighted multiple context-free grammars.A weighted MCFG is obtained by assigning a weight to each rule of an (unweighted) MCFG. In this paper, the weights will be taken from a partially ordered commutative monoid with zero (short: POCMOZ). A _POCMOZ_ is an algebra \((M,\odot,\mathbbold{1},\mathbbold{0},\leq]\) where \(\trianglelefteq\) is a partial order on \(M\); \(\odot\) is associative, commutative, decreasing (i.e. \(m\odot m^{\prime}\unlhd m\)), and monotonous (i.e. \(m_{1}\unlhd m_{2}\) implies \(m_{1}\odot m\unlhd m_{2}\odot m\)); \(\mathbbold{1}\) is neutral w.r.t. \(\odot\); and \(\mathbbold{0}\) is absorbing w.r.t. \(\odot\). We call \(M\)_factorisable_ if for each \(m\in M\setminus\{\mathbbold{1}\}\), there are \(m_{1},m_{2}\in M\setminus\{\mathbbold{1}\}\) with \(m=m_{1}\odot m_{2}\). The _probability algebra_\(\Pr=([0,1],\cdot,1,0,\leq)\) is a factorisable POCMOZ where \(r=\sqrt{r}\cdot\sqrt{r}\) for each \(r\in[0,1)\).

**Example 3** (continues ex. 1).: Consider the tuple \((G,\mu)\) where \(\mu\colon P\rightarrow\Pr\) is a function where \(\mu(\rho_{1})=1\), \(\mu(\rho_{2})=\mu(\rho_{4})=1/2\), \(\mu(\rho_{3})=1/3\), and \(\mu(\rho_{5})=2/3\). We call \((G,\mu)\) a weighted MCFG. The _weight_ of the a derivation \(d_{m,n}\) is obtained by multiplying the weights of all rule occurrences in it: \(\operatorname{wt}(d_{m,n})=1/2^{m+1}\cdot 2/3^{n+1}\). \(\square\)

**Definition 4**.: A _weighted MCFG_ (short: wMCFG) is a tuple \((G,\mu)\) where \(G=(N,\Sigma,S,P)\) is an MCFG (_underlying MCFG_), \(\mu\colon P\to M\setminus\{0\}\) (_weight assignment_), and \((M,\odot,\mathbbold{1},\mathbbold{0},\leq]\) is a factorisable POCMOZ.

\((G,\mu)\) inherits all objects associated with \(G\). Let \(d=\rho(d_{1},\ldots,d_{k})\in\mathrm{D}_{G}\). The _weight of \(d\)_ is \(\operatorname{wt}(d)=\mu(\rho)\odot\bigotimes_{i=1}^{k}\operatorname{wt}(d_{ i})\). \(\square\)

_For the rest of this paper, we fix a wMCFG \((G,\mu)\) with underlying MCFG \(G=(N,\Sigma,S,P)\) and weight assignment \(\mu\colon P\to M\)._

Chomsky-Schutzenberger theorem.In the Chomsky-Schutzenberger theorem for CFGs (cf. sec. 1), \(D\) contains strings of brackets where each opening bracket is matched by the corresponding closing bracket. This property can be described with an equivalence relation. Let \(\Delta\) be a set (of opening brackets) and \(\bar{\Delta}\) be the set (of closing brackets) that contains \(\bar{\delta}\) for each \(\delta\in\Delta\). We define \(\equiv_{\Delta}\) as the smallest equivalence relation where \(u\,\delta\bar{\delta}\,v\equiv_{\Delta}uv\) for each \(\delta\in\Delta\) and \(u,v\in\Delta^{*}\). The _Dyck language w.r.t. \(\Delta\)_ is \(\mathrm{D}_{\Delta}=[\varepsilon]_{\equiv_{\Delta}}\).

In the Chomsky-Schutzenberger representation for MCFGs, the brackets fulfil three functions: (i) _terminal brackets_\([\![_{o}\!]_{\sigma}\!]_{\sigma}\) stand for a terminal symbol \(\sigma\), (ii) _component brackets_\([\![_{\rho}\!]_{\sigma}\!]\) and \([\![_{\rho}\!]_{\rho}\!]\) denote beginning and end of substrings produced by the \(\ell\)-th component of a rule \(\rho\), and (iii) _variable brackets_\([\![_{\rho,i}^{j}\!]_{\rho,i}\!]\) and \([\![_{\rho,i}^{j}\!]_{\rho,i}\!]\) denote beginning and end of substrings produced by variable \(x_{i}^{j}\) in a rule \(\rho\). As for CFGs, each opening bracket must be matched by the corresponding closing bracket. Furthermore, because applying a rule of an MCFG produces multiple strings simultaneously, we need to ensure that the brackets corresponding to the same application of a rule occur simultaneously. This is described with another equivalence relation. Let \(\mathfrak{P}\) be a partition of \(\Delta\). Intuitively, each cell of \(\mathfrak{P}\) is a set of (opening) brackets that occur simultaneously. We define \(\equiv_{\mathfrak{P}}\) as the smallest equivalence relation on \(\mathcal{P}\bigl{(}(\Delta\cup\overline{\Delta})^{*}\bigr{)}\) where for each \(\{\delta_{1},\ldots,\delta_{s}\}\in\mathfrak{P}\) with \(|\{\delta_{1},\ldots,\delta_{s}\}|=s\), \(u_{0},\ldots,u_{s},v_{1},\ldots,v_{s}\in\mathrm{D}_{\Delta}\), and \(L\subseteq(\Delta\cup\overline{\Delta})^{*}\):

\[\begin{array}{rcl}&&\bigl{\{}u_{0}~{}\delta_{1}v_{1}\bar{\delta}_{1}~{}u_{1} \cdots~{}\delta_{s}v_{s}\bar{\delta}_{s}~{}u_{s}\bigr{\}}&\cup L\\ &&\equiv_{\mathfrak{P}}&&\bigl{\{}u_{0}\cdots u_{s},~{}v_{1}\cdots v_{s}\bigr{\}} &\cup L.\end{array}\]

The _multiple Dyck language w.r.t. \(\mathfrak{P}\)_ is \(\mathrm{mD}_{\mathfrak{P}}=\bigcup(L\mid L\in[\varepsilon]_{\equiv_{ \mathfrak{P}}})\). Note that \(\mathrm{mD}_{\mathfrak{P}}\subseteq\mathrm{D}_{\Delta}\).

Theorem 5 provides a representation of each mcf language by a multiple Dyck language (see above), a recognisable language (to ensure local consistency), and a homomorphism (to decode the bracket sequences into terminal strings). The corresponding construction is recalled in def. 6.

**Theorem 5** (cf. Yoshinaka et al., 2010, thm. 3).: For every mcf language \(L\subseteq\Sigma^{*}\) there are a homomorphism \(h\colon(\Delta\cup\bar{\Delta})^{*}\rightarrow\Sigma^{*}\), a regular language \(R\subseteq(\Delta\cup\bar{\Delta})^{*}\), and a multiple Dyck language \(\textit{mD}\subseteq(\Delta\cup\bar{\Delta})^{*}\) such that \(L=h(R\cap\textit{mD})\) 



**Definition 6**(Denkinger, 2017, def. 3.6, 4.9, 5.15).: The _multiple Dyck language w.r.t._\(G\) is \({\rm mD}_{G}={\rm mD}_{\mathfrak{P}_{G}}\) where \(\mathfrak{P}_{G}\) is the smallest set that contains the cell \(\left\{[\![_{\sigma}]\;\right\}\) for each \(\sigma\in\Sigma\) and the cells \(\left\{[\![^{f}_{\rho}|\;\ell\in[sort(A)]\!]\;\right\}\) and \(\left\{[\![^{j}_{\rho,i}\mid j\in[sort(B_{i})]\!]\;\right\}\) for each \(\rho=A\to c(B_{1},\ldots,B_{k})\in P\) and \(i\in[k]\). Let \(\Delta_{G}=\bigcup_{\mathfrak{p}\in\mathfrak{P}_{G}}\mathfrak{p}\). We denote the elements of \(\overline{\Delta_{G}}\) by closing brackets, e.g. \(\bar{[\![_{\sigma}=]\!]}_{\sigma}\), and let \(\Omega_{G}=\Delta_{G}\cup\overline{\Delta_{G}}\).

The _homomorphism w.r.t._\(G\), denoted by \({\rm hom}_{G}\), is the unique extension of \(h\colon\Omega_{G}\rightarrow\varSigma\cup\left\{\varepsilon\right\}\) to strings where \(h(\delta)=\sigma\) if \(\delta\) is of the form \([\![_{\sigma}\) and \(h(\delta)=\varepsilon\) otherwise.

The _automaton w.r.t._\(G\), denoted by \(\mathcal{A}_{G}\), is the FSA \((Q,\Omega_{G},S^{1},\overline{S^{1}},T)\) where \(Q=\left\{A^{\ell},\overline{A^{\ell}}\mid A\in N,\ell\in[sort(A)]\right\}\) and \(T\) is the smallest set such that for each rule \(\rho\in P\) of the form

\[A\rightarrow[u_{1,0}y_{1,1}u_{1,1}\cdots y_{1,n_{1}}u_{1,n_{1}} ,\;\dots,\\ u_{s,0}y_{s,1}u_{s,1}\cdots y_{s,n_{s}}u_{s,n_{s}}](B_{1}, \dots,B_{k})\]

where the \(y\)s are elements of X and the \(u\)s are elements of \(\varSigma^{*}\), we have (abbreviating \([\![_{\sigma_{1}}]\!]_{\sigma_{2}}\cdots[\![_{\sigma_{k}}]\!]_{\sigma_{k}}\) by \(\widehat{\sigma_{1}\cdots\sigma_{k}}\)) the following transitions in \(T\):

1. \(\big{(}A^{\ell},\;[\![^{l}_{\rho}\widetilde{u_{\ell,0}}]\!]^{\ell}_{\rho},\; \overline{A^{\ell}}\big{)}\in T\quad\text{for every $\ell\in[s]$ with $ n_{\ell}=0$}\),
2. \(\big{(}A^{\ell},\;[^{l}_{\rho}\widetilde{u_{\ell,0}}]\![^{j}_{\rho,i},\;B^{j} _{i}\big{)}\in T\quad\text{for every $\ell\in[s]$}\) where \(n_{\ell}\neq 0\) and \(y_{\ell,1}\) is of the form \(x^{j}_{i}\),
3. \(\big{(}\overline{B}^{j}_{i},\;]\;\underline{\mathsf{J}}^{j}_{\rho,i}\widetilde {u_{\ell,\kappa}}[\![^{j^{\prime}}_{\rho,i},\;B^{j^{\prime}}_{i^{\prime}})\in T \quad\text{for every $\ell\in[s]$ and $\kappa\in[n_{\ell}-1]$ where $y_{\ell,\kappa}$ is of the form $ x^{j}_{i}$ and $y_{\ell,\kappa+1}$ is of the form $x^{j^{\prime}}_{i^{\prime}}$, and}\)
4. \(\big{(}\overline{B}^{j}_{i},\;]\;\underline{\mathsf{J}}^{j}_{\rho,i}\widetilde {u_{\ell,n_{\ell}}}\underline{\mathsf{I}}^{\ell}_{\rho},\;\overline{A^{\ell}} \big{)}\in T\quad\text{for every $\ell\in[s]$ where $n_{\ell}\neq 0$ and $y_{\ell,n_{\ell}}$ is of the form $x^{j}_{i}$.}\)

We abbreviate \(\mathcal{L}(\mathcal{A}_{G})\) by \(\mathcal{R}_{G}\). 

**Example 7** (continues ex. 1).: The automaton w.r.t. \(G\) is shown in fig. 1. An illustration of the application of \(\equiv_{\mathfrak{P}_{G}}\) is given in the appendix (p. 11). 

**The vanilla parser.** The _vanilla parser_ (i.e. alg. 3 from Denkinger, 2017), is shown in fig. 2 (top). Similar to the parser proposed by Hulden (2011), we divide it in three essential phases: (i) FSA constructions for the intersection of \({\rm hom}_{G}^{-1}(w)\) and \(\mathcal{R}_{G}\), (ii) an extraction of (in our case _multiple_) Dyck words from the intersection, and (iii) the conversion of words into derivations.

Formally, the vanilla parser is the function \(V\colon\varSigma^{*}\rightarrow(\mathrm{D}_{G}^{c})^{\omega}\) defined as

\[V=\textsc{map}(\textsc{toDeriv})\circ\textsc{filter}({\rm m D }_{G})\] \[\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad



## 3 Component-Wise Derivations

In sec. 4, we will outline modifications to the vanilla parser that make the extraction of the elements of \({\rm mD}_{G}\) from \({\rm hom}^{-1}_{G}(w)\cap\mathcal{R}_{G}\) efficient (items 2-4). To facilitate this, we first decompose \(\textsc{filter}({\rm mD}_{G})\) into \(\textsc{filter}({\rm mD}_{G})\circ\textsc{filter}({\rm D}_{\Delta_{G}})\), which is possible because \({\rm D}_{\Delta_{G}}\supseteq{\rm mD}_{G}\). Secondly, we implement \(\textsc{filter}({\rm D}_{\Delta_{G}})\circ\textsc{sort}(\mu^{\prime})\) with a dynamic programming algorithm (cf. Hulden, 2011, alg. 1, similar to BarHillel et al., 1961, sec. 8). And lastly, we replace \(\textsc{filter}({\rm mD}_{G})\) by steps that exploit the well-bracketing of the elements of \({\rm D}_{\Delta_{G}}\).

The elements of \(\mathcal{R}_{G}\cap{\rm D}_{\Delta_{G}}\) can be represented as trees over rules of \(G\).2 We label the edges of those trees to allow us to check if vertices that correspond to the same application of a rule of the MCFG \(G\) match. The resulting objects are called _component-wise derivations_. The set \(\mathcal{R}_{G}\cap{\rm D}_{\Delta_{G}}\) is characterised in terms a CFG \(G_{\text{cf}}\).

Footnote 2: Those trees correspond to the derivations of the _guiding grammar_ in the coarse-to-fine parsing approach of Barthelemy et al. (2001, sec. 3).

**Definition 8**.: Let \(\rho\in P\) be a rule of the form \(A\rightarrow[u_{1},\ldots,u_{s}](B_{1},\ldots,B_{k})\), \(\ell\in[s]\), and \(u_{\ell}\) be of the form \(w_{0}x_{i(1)}^{j(1)}w_{1}\cdots x_{i(n)}^{j(n)}w_{n}\) for some \(w_{0},\ldots,w_{n}\in\Sigma^{*}\). We define the rule

\[\rho^{(\ell)}=A^{\ell}\rightarrow\big{[}\!\!\begin{subarray}{c}\ell\\ w_{0}\end{subarray}\!v_{1}\widetilde{w}_{1}\cdots v_{n}\widetilde{w}_{n} \Big{]}_{\rho}^{\ell}\]

where each \(v_{\kappa}=[\!\!\begin{subarray}{c}j^{(\kappa)}\\ j^{(\kappa)}_{i(\kappa)}\end{subarray}\!p^{j(\kappa)}_{i(\kappa)}\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!



**Example 13** (continues ex. 1).: We construct \(G_{\text{cf}}=(\{S^{1},A^{1},A^{2},B^{1},B^{2}\},M_{G},S^{1},P_{\text{cf}})\) where \(P_{\text{cf}}\) contains, among others, the following rules:

\[\rho_{1}^{(1)} =S^{1}\rightarrow\Big{[}\!\bigsqcup_{\rho_{1}}^{1}\!\bigsqcup_{ \rho_{1},1}^{1}\!\bigsqcup_{\rho_{1},1}^{1}\!\bigsqcup_{\rho_{1},2}^{1}\] \[\qquad\qquad\qquad\quad\left[\!\bigsqcap_{\rho_{1},1}^{2}A^{2}\right] \!\bigsqcup_{\rho_{1},1}^{2}\!\bigsqcup_{\rho_{1},2}^{2}\!B^{2}\!\bigsqcup_{ \rho_{1},2}^{2}\!\right]_{\rho_{1}}^{1},\] \[\rho_{3}^{(1)} =B^{1}\rightarrow\Big{[}\!\bigsqcup_{\rho_{3}}^{1}\widetilde{b} \!\bigsqcup_{\rho_{3},1}^{1}\!B^{1}\!\bigsqcup_{\rho_{3},1}^{1}\!\bigsqcup_{ \rho_{3},1}^{1}\!\Bigsqcup_{\rho_{3}}^{1},\] \[\rho_{4}^{(1)} =A^{1}\to[\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![\![ \![\!

gorithm even further such that items are explored in a similar fashion as in the CKY-algorithm (Kasami, 1966; Younger, 1967; Cocke and Schwartz, 1970).
4. For filter\(({\rm mD}_{G})\), instead of \(isMember^{\prime}\) by Denkinger (2017, p. 28-30), which runs in quadratic time, we use the composition of two algorithms that run in linear time: * alg. 1, which reads a cow derivation off a given word in \(\mathcal{R}_{G}\cap\mathrm{D}_{\Delta_{G}}\), and * an algorithm that checks a given cow derivation for consistency. (This is similar to alg. 2; but instead of derivations, we return Boolean values. The algorithm is given explicitly in sec. A.3.)
5. Algorithm 2 computes the bijection between \(\operatorname{cowD}_{G}^{\text{c}}\) and \(\mathrm{D}_{G}^{\text{c}}\) (see prop. 15). Analogously to def. 14, the function tOMcfgDeriv' checks a set of cow derivations for equivalence of the root symbol and the function collectChildren groups the subtrees via the first component of the successor labels. It is easy to see that tOMcgfDeriv\((t)\) is only defined if the cow derivation \(t\) is consistent (cf. item 4). Thus, we use tOMcfgDeriv in combination with tOCowDeriv to replace map\((\textsc{toDeriv})\circ\texttt{filter}({\rm mD}_{G})\). The time complexity of alg. 2 is linear in the number of vertices of the given cow derivation. This number, in turn, is linear in the length of the processed candidate.

The parser obtained by applying items 1 to 5 to the vanilla parser is visualised in fig. 2 (bottom). It is sound and complete.3 The following two modifications (items 6 and 7) destroy both soundness and completeness. Item 6 allows only the best intermediate results to be processed further and limits the results to a subset of those of the vanilla parser. In item 7, we compensate this by an approximation we consider useful in practise.

Footnote 3: A parser is _complete_ if it (eventually) computes all complete derivations of the given word in the given grammar. A parser is called _sound_ if all computed parses are complete derivations of the given word in the given grammar.
6. extractDyck is extended with an optional implementation of beam search by limiting the amount of items for certain groups of state spans to a specific number (_beam width_), cf. Collins (1999). In our implementation, we chose these groups of state spans such that they correspond to equal states in 

the automaton for \({\rm hom}_{G}^{-1}(w)\). Moreover, we introduce a variable that limits the number of candidates that are yielded by Algorithm 3 (_candidate count_). Both variables are the _meta-parameters_ of our parser.
7. We introduce a fallback mechanism for the case that filter\({\rm imD}_{G}\) has input candidates but an empty output. Usually, in that case, we would suggest there is no derivation for \(w\) in \(G\), yet for robustness, it is preferable to output some parse. Figure 3 illustrates a strategy to construct a complete derivation from any complete _cow_ derivation with an example.

## 5 Evaluation and Conclusion

We implemented the parser with the modifications sketched in sec. 4 for \(\varepsilon\)-free and simple wMCFGs,4 but no problems should arise generalising this implementation to arbitrary wMCFGs. The implementation is available as a part of Rustomata,5 a framework for weighted automata with storage written in the programming language Rust. We used the _NeGra corpus_ (German newspaper articles, 20,602 sentences, 355,096 tokens; Skut et al., 1998) to compare our parser to _Grammatical Framework_(Angelov and Ljunglof, 2014), _rparse_(Kallmeyer and Maier, 2013), and _discodop_(van Cranenburgh et al., 2016) with respect to parse time and accuracy.6 Our experiments were conducted on defoliated trees, i.e. we removed the leaves from each tree in the corpus. Parsing was performed on gold part-of-speech tags.

Footnote 4: A wMCFG \(G\) is called \(\varepsilon\)-free and simple if each composition function that occurs in the rules of \(G\) is either of the form \([u_{1},\ldots,u_{s}]\) for some non-empty strings of variables \(u_{1},\ldots,u_{s}\), or of the form \([t]\) for some terminal symbol \(t\).

Footnote 5: available on [https://github.com/tud-fop/rustomata](https://github.com/tud-fop/rustomata). We used commit 867a451 for evaluation.

Footnote 6: The evaluation scripts are available on [https://github.com/truprecht/rustomata-eval](https://github.com/truprecht/rustomata-eval).

We performed a variant of _ten-fold cross validation_ (short: TFCV; cf. Mosteller and Tukey, 1968), i.e. we split the corpus into ten consecutive parts; each part becomes the validation set in one iteration while the others serve as training set. We used the first iteration to select suitable values for our meta-parameters and the remaining nine for validation. In case of Rustomata, a binarised and markovized grammar was induced with discodop (head-outward binarisation, \(v=1\), \(h=2\), cf. Klein and Manning, 2003) in each iteration. For all other parsers, we induced a probabilistic LCFRS with the respective default configurations (for details, cf. the evaluation scripts). After that, we ran our parser on each sentence of the validation set and recorded the parse time and the computed 1-best parse. The computed parses were evaluated against the gold parses of the validation set w.r.t. precision, recall, and f\({}_{1}\)-score (according to the labelled parseval measures, cf. Black et al., 1991; Collins, 1997, we used the implementation by van Cranenburg et al., 2016).

Previous experiments with an implementation of the vanilla parser already struggled with small subsets (we used grammars extracted from 250-1500 parse trees) of the NeGra corpus. Therefore, we omit evaluation of the vanilla parser.

Meta-parameters.A grid search for meta-parameters was performed on sentences of up to 20 tokens (see the appendix, tab. 2, for a detailed listing). The results suggested to set the beam width to 200 and the candidate count to 10,000.

Comparison to other parsers.The experiments were performed on sentences with up to 30 tokens. We instructed rparse, Grammatical Framework (short: GF) and Rustomata (short: OP) to stop parsing each sentence after 30 seconds (_timeout_). Disco-dop did not permit passing a timeout. In the case of disco-dop's LCFRS parser (short: ddlcfs), we limited the validation set to sentences

Figure 4: Median parse times



of at most 20 tokens, since ddlcfrs frequently exceeded 30 seconds of parse time for longer sentences in preliminary tests. Disco-dop's coarse-to-fine data-oriented parser (short: ddctf-dop) and disco-dop's coarse-to-fine LCFRS parser (short:ddctf-lcfs) rarely exceeded 30 seconds of parse time in preliminary tests and we let them run on sentences of up to 30 tokens without the timeout.

Figure 4a shows the parse times for each sentence length and parser. The parsers ddctrl-dop, ddcft-lcfs, GF, and OP perform similar for sentences of up to 20 tokens. The parse times of rparse and ddlcfrs grow rapidly after 10 and 16 tokens, respectively. Rparse even exceeds the timeout for more than half of the test sentences that are longer than 15 tokens. For sentences with up to 30 tokens, the parse times of ddctf-dop, ddctf-lcfs and OP seem to remain almost constant.

Table 1 shows the accuracy (i.e. precision, recall, and f\({}_{1}\)-score) and the coverage (i.e. the percentage of sentences that could be parsed) for each parser on the validation set. We report these scores to assert a correct implementation of our parser and to compare the different approximation strategies (and our fallback mechanism) implemented in the parsers. The low coverage of rparse stems from the frequent occurrences of timeouts. They also depress the recall for pararse. For sentences with at most 20 tokens, ddlcfts, ddctf-lcfs and OP perform very similar. These three parsers are outperformed by ddctf-dop in all aspects. For sentences of up to 30 tokens, the scores of all tested parsers drop similarly. However, ddctf-dop's scores drop the least amount.

We repeated a part of the experiments with the Lassy corpus (Lassy Small, various kinds of written Dutch, 65,200 sentences, 975,055 tokens; van Noord et al., 2013). Since it is considerably larger than the NeGra corpus, we limited the experiments to one iteration of TFCV, and we only investigate OP, ddctf-lcfs, and ddctf-dop. The results are shown in fig. 4b (parse time) and at the bottom of tab. 1 (accuracy). Figure 4b shows the difference of ddctf-lcfs, ddctf-dop and OP in terms of parse times (which is not discernible in fig. 4a). This plot shows that OP maintains very small parse times - even for large copora - compared to the state-of-the-art parser disco-dop.

All in all, our parser performs comparable to state-of-the-art MCFG parsers (GF, rparse, ddclcfrs, ddctf-lcfs) and, using the NeGra corpus, it shows excellent results in parse time and good results in accuracy. Moreover, our parser can deal with any \(\varepsilon\)-free and simple MCFG provided by an external tool, making it more flexible than disco-dop and rparse. However, we are not able to compete with ddctf-dop in terms of accuracy, since discontinuous data-oriented parsing is a more accurate formalism (van Cranenburgh and Bod, 2013).

## 6 Future Work

We see potential to improve the fallback mechanism explained in sec. 4. For now, we only considered reporting the first cow derivation. By introducing some _degree of consistency_ of cow derivations, we could select a cow derivation that is closer to a derivation of \(G\).

Since recognisable languages are closed under inverse homomorphisms, we can use any recognisable language as input for \(\operatorname{hom}^{-1}_{G}\) (cf. fig. 2) without changing the rest of the pipeline. This is useful when the input of the parsing task is ambiguous, as in lattice-based parsing (e.g. Goldberg and Tsarfaty, 2008).

Moreover, since weighted recognisable languages are closed under inverse homomorphisms and scalar product, we can even use a weighted recognisable language as input for \(\operatorname{hom}^{-1}_{G}\), as in the setting of Rastogi et al. (2016).

### Acknowledgements

We thank our colleague Kilian Gephardt as well as the anonymous reviewers for their insightful comments on drafts of this paper.

 



## References

* Angelov and Ljunglof (2014) Krasimir Angelov and Peter Ljunglof. 2014. Fast statistical parsing with parallel multiple context-free grammars. In _Proceedings of the 14th Conference of the European Chapter of the Association for Computational Linguistics_, pages 368-376.
* Bar-Hilleel et al. (1961) Yehoshua Bar-Hilleel, Micha Asher Perles, and Eli Shamir. 1961. On formal properties of simple phrase structure grammars. _Zeitschrift fur Phonetik, Sprachwissenschaft und Kommunikationsforschung_, 14:143-172.
* Barthelemy et al. (2001) Francois Barthelemy, Pierre Boullier, Philippe Deschamp, and Eric Villemonte de la Clergerie. 2001. Guided parsing of range concatenation languages. In _Proceedings of the 39th Annual Meeting of the Association for Computational Linguistics_.
* Black et al. (1991) Ezra Black, Steven Abney, Dan Flickinger, Claudia Gdaniec, Ralph Grishman, Philip Harrison, Donald Hindle, Robert Ingria, Fred Jelinek, Judith Klavans, Mark Liberman, and Tomek Strzalkowski. 1991. A Procedure for Quantitatively Comparing the Syntactic Coverage of English Grammars. In _Proceedings of the Workshop on Speech and Natural Language_, pages 306-311. Association for Computational Linguistics.
* Chomsky (1956) Noam Chomsky. 1956. Three models for the description of language. _IEEE Transactions on Information Theory_, 2(3):113-124.
* Chomsky (1959) Noam Chomsky. 1959. On certain formal properties of grammars. _Information and control_, 2(2):137-167.
* Chomsky and Schutzenberger (1963) Noam Chomsky and Marcel Paul Schutzenberger. 1963. The algebraic theory of context-free languages. _Computer Programming and Formal Systems, Studies in Logic_, pages 118-161.
* Coavoux and Crabbe (2017) Maximin Coavoux and Benoit Crabbe. 2017. Incremental discontinuous phrase structure parsing with the gap transition. In _Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 1, Long Papers_, pages 1259-1270. Association for Computational Linguistics.
* Cocke and Schwartz (1970) John Cocke and J. T. Schwartz. 1970. Programming languages and their compilers: Preliminary notes. techreport, Courant Institute of Mathematical Sciences, New York University.
* Collins (1997) Michael Collins. 1997. Three generative, lexicalised models for statistical parsing. In _Proceedings of the 35th annual meeting on Association for Computational Linguistics and Eighth Conference of the European Chapter of the Association for Computational Linguistics_. Association for Computational Linguistics.
* Collins (1999) Michael Collins. 1999. _Head-driven statistical models for natural language parsing_. Ph.D. thesis.
* van Cranenburgh and Bod (2013) Andreas van Cranenburgh and Rens Bod. 2013. Discontinuous parsing with an efficient and accurate dop model. In _Proceedings of the 13th International Conference on Parsing Technologies_.
* van Cranenburgh et al. (2016) Andreas van Cranenburgh, Remko Scha, and Rens Bod. 2016. Data-oriented parsing with discontinuous constituents and function tags. _Journal of Language Modelling_, 4(1):57.
* Denkinger (2017) Tobias Denkinger. 2017. Chomsky-Schutzenberger parsing for weighted multiple context-free languages. _Journal of Language Modelling_, 5(1):3.
* Goldberg and Tsarfaty (2008) Yoav Goldberg and Reut Tsarfaty. 2008. A single generative model for joint morphological segmentation and syntactic parsing. _Proceedings of ACL-08: HLT_, pages 371-379.
* Hopcroft and Ullman (1979) John Edward Hopcroft and Jeffrey David Ullman. 1979. _Introduction to Automata Theory, Languages and Computation_, 1st edition.
* Hudden (2011) Mans Hulden. 2011. Parsing CFGs and PCFGs with a Chomsyk-Schutzenberger representation. In _Human Language Technology. Challenges for Computer Science and Linguistics_, volume 6562 of _Lecture Notes in Computer Science_, pages 151-160.
* Joshi (1985) Aravind K. Joshi. 1985. _Tree adjoining grammars: How much context-sensitivity is needed for characterizing structural descriptions?_, chapter 6. Cambridge University Press.
* Joshi et al. (1975) Aravind Krishna Joshi, Leon S. Levy, and Masako Takahashi. 1975. Tree adjunct grammars. _Journal of Computer and System Sciences_, 10(1):136-163.
* Kallmeyer and Maier (2013) Laura Kallmeyer and Wolfgang Maier. 2013. Data-driven parsing using probabilistic linear context-free rewriting systems. _Computational Linguistics_, 39(1):87-119.
* Kasami (1966) T. Kasami. 1966. An efficient recognition and syntax-analysis algorithm for context-free languages. techreport R-257, AFCRL.
* Klein and Manning (2003) Dan Klein and Christopher D. Manning. 2003. Accurate unlexicalized parsing. In _Proceedings of the 41st Annual Meeting on Association for Computational Linguistics_. Association for Computational Linguistics.
* Maier (2015) Wolfgang Maier. 2015. Discontinuous incremental shift-reduce parsing. 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 1202-1212, Beijing, China. Association for Computational Linguistics.
* Mosteller and Tukey (1968) Frederick Mosteller and John Wilder Tukey. 1968. Data analysis, including statistics. In G. Lindsey and E. Aronson, editors, _Handbook of Social Psychology_, volume 2. Addison-Wesley

Gertjan van Noord, Gosse Bouma, Frank Van Eynde, Daniel de Kok, Jelmer van der Linde, Inke Schuurman, Erik Tjong Kim Sang, and Vincent Vandeghintse. 2013. Large Scale Syntactic Annotation of Written Dutch: Lassy, pages 147-164. Springer Berlin Heidelberg, Berlin, Heidelberg.
* Rastogi et al. (2016) Pushpendre Rastogi, Ryan Cotterell, and Jason Eisner. 2016. Weighting finite-state transductions with neural context. In _Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies_, pages 623-633, San Diego, California. Association for Computational Linguistics.
* Seki et al. (1991) Hiroyuki Seki, Takashi Matsumura, Mamoru Fujii, and Tadao Kasami. 1991. On multiple context-free grammars. _Theoretical Computer Science_, 88(2):191-229.
* Shieber (1985) Stuart M. Shieber. 1985. Evidence against the context-freeness of natural language. _Linguistics and Philosophy_, 8(3):333-343.
* Skut et al. (1998) Wojciech Skut, Thorsten Brants, Brigitte Krenn, and Hans Uszkoreit. 1998. A Linguistically Interpreted Corpus of German Newspaper Text. In _Proceedings of the 10th European Summer School in Logic, Language and Information. Workshop on Recent Advances in Corpus Annotation_.
* Vijay-Shanker et al. (1987) Krishnamurti Vijay-Shanker, David Jeremy Weir, and Aravind Krishna Joshi. 1987. Characterizing structural descriptions produced by various grammatical formalisms. In _Proceedings of the 25th Annual Meeting on Association for Computational Linguistics_, pages 104-111.
* Yoshinaka et al. (2010) Ryo Yoshinaka, Yuichi Kaji, and Hiroyuki Seki. 2010. Chomsky-Schutzenberger-type characterization of multiple context-free languages. In Adrian-Horia Dediu, Henning Fernau, and Carlos Martin-Vide, editors, _Language and Automata Theory and Applications_, pages 596-607.
* Younger (1967) Daniel H. Younger. 1967. Recognition and parsing of context-free languages in time n3. _Information and Control_, 10(2):189-208.

## Appendix A Appendices

### Additional Examples

**Example 1** (continuing from p. 2).: Figure 5 shows graphical representations of a derivation and the corresponding term over composition functions. \(\square\)

**Example 7** (continuing from p. 4).: The following calculation reduces a word of \({\cal A}_{G}\) to \(\varepsilon\) using the equivalence relation \(\equiv_{\mathfrak{P}_{G}}\) (abbreviated by \(\equiv\)) and thereby proves that it is an element of \(\mathrm{mD}_{G}\). In each step, we point out, which cell of \(\mathfrak{P}_{G}\) was/were used. Note that the set obtained after two applications of \(\equiv\) has two elements.

\[\left\{\begin{array}{l}\Big{[}\raisebox{-0.0pt}{$\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\! 

form

\[\left[\!\begin{array}{c|cc}\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\! 

Proof.: Let \(s\in{\mathbb{N}_{+}}\) and let \(t^{1},\ldots,t^{s}\) be cow derivations in \(G\). We abbreviate the following property by \(\mathfrak{C}(t^{1},\ldots,t^{s})\): (i) \(\{t^{1},\ldots,t^{s}\}\) is consistent, (ii) \(s=\operatorname*{fanout}(\mathrm{root}(t^{1}))\), and (iii) \(t^{\ell}\) is an \(\ell\)-cow derivation for each \(\ell\in[s]\). Now, we show by structural induction that \(\mathfrak{C}(\mathrm{toCovD}(v^{1}),\ldots,\mathrm{to}\mathrm{LowD}(v^{s}))\) holds iff each permutation of \(v^{1},\ldots,v^{s}\) is in \(\mathrm{mD}_{G}\). Let \(\rho=A\rightarrow[c_{1},\ldots,c_{s}](B_{1},\ldots,B_{k})\) be a rule in \(P\). Let \(v_{i}^{j}\in\mathcal{L}(G,B_{i}^{j})\) for each \(i\in[k]\) and \(j\in[sort(B_{i})]\) such that

\[\begin{split}&\mathrm{Per}(v_{i}^{1},\ldots,v_{i}^{sort(B_{ i})})\subseteq\mathrm{mD}_{G}\\ &\qquad\iff\mathfrak{C}\big{(}t_{i}^{1},\ldots,t_{i}^{sort(B_{ i})}\big{)}\end{split}\] (IH)

for each \(i\in[k]\) where \(t_{i}^{j}\) abbreviates \(\mathrm{to}\mathrm{COWD}(v_{i}^{j})\) and \(\mathrm{Per}(v_{i}^{1},\ldots,v_{i}^{sort(B_{i})})\) is the set of permutations of \(v_{i}^{1},\ldots,v_{i}^{sort(B_{i})}\). For each \(\ell\in[s]\), let \(v^{\ell}\) be obtained from the right-hand side of \(\rho^{(\ell)}\) by replacing each non-terminal of the form \(B_{i}^{j}\) by \(v_{i}^{j}\). Clearly, for each \(\ell\in[s]\), the sequence \(v^{\ell}\) is an element of \(\mathcal{L}(G,A^{\ell})\). From now on, we will abbreviate \(\mathrm{to}\mathrm{CoWD}(v^{\ell})\) by \(t^{\ell}\) for each \(\ell\in[s]\). Now, let \(B_{i(\ell,1)}^{j(\ell,1)},\ldots,B_{i(\ell,n_{\ell})}^{j(\ell,n_{\ell})}\) be the nonterminals on the rhs of \(\rho^{(\ell)}\), then \(t^{\ell}\) is the cow derivation

Note that \(\rho\) is the root symbol of each \(t^{1},\ldots,t^{s}\) and the set of indices \(\{(i(\ell,\kappa),j(\ell,\kappa))\mid\ell\in[s],\kappa\in[n_{\ell}]\}\) is the set \(\{(i,j)\mid i\in[k],j\in[sort(B_{i})]\}\). We derive

\[\begin{split}&\mathfrak{C}(t^{1},\ldots,t^{s})\\ &\iff\{t^{1},\ldots,t^{s}\}\text{ is consistent \quad(by def.~{}\ref{eq:mD})\\ &\iff\forall i\in[k]\colon\{t_{i}^{1},\ldots,t_{i}^{sort(B_{i})} \}\text{ is consistent \quad(by def.~{}\ref{eq:mD})}\\ &\iff\forall i\in[k]\colon\mathrm{Per}(v_{i}^{1},\ldots,v_{i}^{ sort(B_{i})})\subseteq\mathrm{mD}_{G}\\ &\iff\mathrm{Per}(v_{i}^{1},\ldots,v_{i}^{sort(B_{i})})\subseteq \mathrm{mD}_{G}\\ &\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad 



### Results of Grid Search for Meta-Parameters

Table 2 shows the results of the grid search for the two introduced meta-parameters. For each combination of _beam width_ and _candidate count_, we list the _median_ and _mean parse time_s (since medians hide outliers, those two may differ drastically) for all sentences of length 20 and f\({}_{1}\)-_score_ over all test sentences. Moreover, we show the percentage of sentences (_coverage_) that we were able to parse with and without the fallback mechanism. The results for the combination of meta-parameters that was selected for later experiments (i.e. a beam width of \(200\) and a candidate count of \(10^{4}\)) are written in bold.

\begin{table}
\begin{tabular}{c l r r r r} \hline \hline  & & & \multicolumn{3}{c}{candidate count} \\  & & \(10^{2}\) & \(10^{3}\) & \(10^{4}\) & \(10^{5}\) \\ \hline \multirow{6}{*}{\(20\)} & median parse time & \(8.04\,\mathrm{ms}\) & \(8.55\,\mathrm{ms}\) & \(8.52\,\mathrm{ms}\) & \(9.61\,\mathrm{ms}\) \\  & mean parse time & \(8.18\,\mathrm{ms}\) & \(11.48\,\mathrm{ms}\) & \(34.71\,\mathrm{ms}\) & \(256.08\,\mathrm{ms}\) \\  & f\({}_{1}\)-score & \(67.83\,\%\) & \(68.44\,\%\) & \(68.45\,\%\) & \(68.80\,\%\) \\  & coverage (no fallback) & \(81.20\,\%\) & \(87.49\,\%\) & \(90.40\,\%\) & \(92.10\,\%\) \\  & coverage (with fallback) & \(97.31\,\%\) & \(97.31\,\%\) & \(97.31\,\%\) & \(97.31\,\%\) \\ \cline{2-6}  & median parse time & \(13.23\,\mathrm{ms}\) & \(15.26\,\mathrm{ms}\) & \(15.44\,\mathrm{ms}\) & \(15.77\,\mathrm{ms}\) \\  & mean parse time & \(13.11\,\mathrm{ms}\) & \(17.99\,\mathrm{ms}\) & \(53.51\,\mathrm{ms}\) & \(299.63\,\mathrm{ms}\) \\  & \(50\) & f\({}_{1}\)-score & \(70.54\,\%\) & \(71.82\,\%\) & \(72.17\,\%\) & \(72.46\,\%\) \\  & coverage (no fallback) & \(78.36\,\%\) & \(85.88\,\%\) & \(90.25\,\%\) & \(93.47\,\%\) \\  & coverage (with fallback) & \(98.31\,\%\) & \(98.31\,\%\) & \(98.31\,\%\) & \(98.31\,\%\) \\ \cline{2-6}  & \multirow{6}{*}{\(100\)} & median parse time & \(19.68\,\mathrm{ms}\) & \(23.18\,\mathrm{ms}\) & \(24.43\,\mathrm{ms}\) & \(24.67\,\mathrm{ms}\) \\  & mean parse time & \(18.81\,\mathrm{ms}\) & \(25.11\,\mathrm{ms}\) & \(70.12\,\mathrm{ms}\) & \(374.90\,\mathrm{ms}\) \\  & & f\({}_{1}\)-score & \(70.27\,\%\) & \(71.43\,\%\) & \(71.99\,\%\) & \(72.86\,\%\) \\  & coverage (no fallback) & \(76.82\,\%\) & \(84.11\,\%\) & \(88.72\,\%\) & \(92.93\,\%\) \\  & coverage (with fallback) & \(98.93\,\%\) & \(98.93\,\%\) & \(98.93\,\%\) & \(98.93\,\%\) \\ \cline{2-6}  & \multirow{6}{*}{\(200\)} & median parse time & \(31.33\,\mathrm{ms}\) & \(36.04\,\mathrm{ms}\) & **39.75 ms** & \(40.05\,\mathrm{ms}\) \\  & & mean parse time & \(30.10\,\mathrm{ms}\) & \(35.80\,\mathrm{ms}\) & **85.94 ms** & \(412.16\,\mathrm{ms}\) \\  & & f\({}_{1}\)-score & \(70.50\,\%\) & \(71.50\,\%\) & **72.13 \%** & \(72.98\,\%\) \\  & coverage (no fallback) & \(76.66\,\%\) & \(83.57\,\%\) & **88.33 \%** & \(92.79\,\%\) \\  & coverage (with fallback) & \(99.00\,\%\) & \(99.00\,\%\) & **99.00 \%** & \(99.00\,\%\) \\ \hline \multirow{6}{*}{\(500\)} & median parse time & \(53.16\,\mathrm{ms}\) & \(58.07\,\mathrm{ms}\) & \(68.22\,\mathrm{ms}\) & \(68.86\,\mathrm{ms}\) \\  & mean parse time & \(50.21\,\mathrm{ms}\) & \(56.70\,\mathrm{sm}\) & \(105.94\,\mathrm{ms}\) & \(431.90\,\mathrm{ms}\) \\ \cline{1-1}  & \multirow{2}{*}{\(F_{1}\)-score} & \(70.51\,\%\) & \(71.45\,\%\) & \(72.08\,\%\) & \(72.90\,\%\) \\ \cline{1-1}  & coverage (no fallback) & \(76.66\,\%\) & \(83.50\,\%\) & \(88.26\,\%\) & \(92.79\,\%\) \\ \cline{1-1}  & coverage (with fallback) & \(99.00\,\%\) & \(99.00\,\%\) & \(99.00\,\%\) & \(99.00\,\%\) \\ \hline \end{tabular}
\end{table}
Table 2: Results of the grid search for meta-parameters.