{'fraction_non_alphanumeric': 0.030693025518552918, 'fraction_numerical': 0.005660961478926186, 'mean_word_length': 4.717319848293299, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Semantic Composition with (Robust) Minimal Recursion Semantics

We discuss semantic composition in Minimal Recursion Semantics (MRS) and Robust Minimal Recursion Semantics (RMRS). We demonstrate that a previously defined formal algebra applies to grammar engineering across a much greater range of frameworks than was originally envisaged. We show how this algebra can be adapted to composition in grammar frameworks where a lexicon is not assumed, and how this underlies a practical implementation of semantic construction for the RASP system.


Introduction
Minimal Recursion Semantics (MRS: Copestake et al. (2005)) is a flat semantic representation which factors semantics into elementary predications (EPs) and allows for underspecification of scope. It has been widely used, especially for HPSG. Robust Minimal Recursion Semantics (RMRS: Copestake (2003)) is a variant of MRS which takes this factorisation further to allow underspecification of relational information as well. While MRS has generally been used with hand-built HPSG grammars, RMRS is also suitable for use with shallower approaches to analysis, including part-of-speech tagging, noun phrase chunking and stochastic parsers which operate without detailed lexicons. MRSs can be converted into RMRSs: RMRS output from shallower systems is less fully specified than the output from deeper systems, but in principle fully compatible. In our work, the semantics produced by a deep grammar is taken as normative when developing semantic representations from shallower processing. For English, the target semantic representations are those produced by the English Resource Grammar (ERG, Flickinger (2000)). The MRS/RMRS approach has been adopted as a common framework for the DELPH-IN initiative (Deep Linguistic Processing with HPSG: http://www.delph-in.net).
An algebra for MRS was defined by Copestake et al. (2001) (henceforth CLF) and forms the starting point for the work reported here.
The aim of CLF was to formalise the notion of semantic composition within grammars expressed in a typed feature structure (TFS) logic. Here, we extend that work to non-lexicalist approaches and also describe how the formal principles of composition used in MRS can be adapted to produce a formalism for RMRS composition. Thus we demonstrate that the algebra applies to grammar engineering across a much wider range of frameworks than was originally envisaged. Besides its theoretical interest, this result has practical benefits when combining multiple processing systems in that it allows compatible semantic representations at a phrasal level as well as at a sentence level.
The next section ( §2) describes the most important features of MRS, RMRS and the earlier work on the algebra. We then outline how the algebra can be used for implementing deep non-TFS approaches ( §3) and explain how it works with RMRS ( §4). This is followed by discussion of the extension to grammars without a detailed lexicon ( §5). To briefly illustrate the practical applications, section ( §6) outlines how RMRS semantics is constructed from RASP (Robust accurate domain-independent statistical parsing: Briscoe and Carroll (2002)).

MRS, RMRS and the algebra
Details of MRS, RMRS and the algebra are given in the cited papers, but we will briefly introduce them here for convenience. Fig. 1 illustrates an MRS from a deep grammar (based on the ERG output, but simplified for expository purposes), an equivalent RMRS and a very underspecified RMRS, derived from a POS tagger.
The naming convention adopted for the relations (e.g., sit v) allows them to be constructed without access to a lexicon. ' v' etc are indications of the coarse-grained sense distinctions which can be inferred from part-of-speech information. Deep grammars can produce finer-grained sense distinctions, indicated by ' 1' etc, and there is an implicit hierarchy such that sit v 1 is taken as being more specific than sit v. However, in what follows, we will use simple relation names for readability. MRS and RMRS both assume an inventory of features on variables which are used to represent tense etc, but these will not be discussed in this paper.

The MRS algebra
In the algebra introduced by CLF, semantic structures (SEMENTS) for phrases consist of five parts: 1. Hooks: can be thought of as pointers into the relations list. In a full grammar, hooks consist of three parts: a label (l), an index (i) and an external argument (omitted here for simplicity).
2. Slots: structures corresponding to syntactic/semantic unsaturation -they specify how the semantics is combined. A slot in one sign is instantiated by being equated with the hook of another sign. (CLF use the term 'hole' instead of 'slot'.) For the TFS grammars considered in CLF, the slot corresponds to the part of the TFS accessed via a valence feature. The inventory of slot labels given by CLF is SUBJ, SPR, SPEC, COMP1, COMP2, COMP3 and MOD. Some rules contribute their own semantics (construction semantics: e.g., compound nouns). However, the MRS approach requires that this can always be treated as equivalent to having an additional daughter in the rule. Thus construction semantics need not be considered separately in the formal algebra, although it does result in some syntactically binary rules being semantically ternary (and so on).
The principles of composition are: 1. A (syntactically specified) slot in one structure (the daughter which corresponds to the semantic head) is filled by the hook of the other structure (by adding equalities).
2. The hook of the phrase is the semantic head's hook.
3. The eps of the phrase is equal to appending the eps of the daughters.
4. The eqs of the phrase is equal to appending the eqs of the daughters plus any eqs contributed by the filling of the slot.
5. The slots of the phrase are the unfilled slots of the daughters (although see below).
6. The hcons of the phrase is equal to appending the hcons of the daughters.
Formally, the algebra is defined in terms of a series of binary operations, such as op spec , which each correspond to the instantiation of a particular labelled slot. Fig. 2 illustrates this. The hook of cat instantiates the SPEC slot of a, which is the semantic head (though not the syntactic head in the ERG). This leads to the equalities between the variables in the result. Since the SPEC slot has been filled, it is not carried up to the phrase. Thus, abstractly at least, the semantics of the HPSG specifier-head rule corresponds to op spec . 1 The MRS algebra was designed to abstract away from the details of the syntax and of the syntaxsemantics interface, so that it can be applied to grammars with differing feature geometry. The assumption in CLF is simply that the syntax selects the appropriate op and its arguments for each application. i.e., semantic operations are associated with HPSG constructions so that there is a mapping from the daughters of the construction to the arguments of the operation. The algebra does not attempt to completely replicate all aspects of semantic construction: e.g., the way that the features (representing tense and so on) are instantiated on variables is not modelled. However, it does constrain semantic construction compared with the possibilities for TFS semantic compositional in general. For instance, as discussed by CLF, it enforces a strong monotonicity constraint. The algebra also contributes to limiting the possibilities for specification of scope. These properties can be exploited by algorithms that operate on MRS: e.g., generation, scope resolution.

The MRS algebra and the syntax-semantics interface
CLF did not discuss the syntax-semantics interface in detail, but we do so here for two reasons. Firstly, it is a preliminary for discussing the use of the algebra in frameworks other than HPSG in the following sections. Secondly, as CLF discuss, the constraints that the algebra imposes cannot be fully implemented in a TFS. Thus, for grammar engineering in TFS frameworks, an additional automatic checker is needed to determine whether a grammar meets the algebra's constraints. This requires specification of the syntax-semantics interface so that the checker can extract the slots from the TFSs and determine the slot operation(s) corresponding to a rule. Unfortunately, CLF are imprecise about the algebra in several respects. One problem is that they gloss over the issue of slot propagation in real grammars. CLF state that for an operation op x , the slot corresponding to op x on the semantic head is instantiated and all other slots appear on the result. For instance, the definition of op spec states that for all labels l = spec: slot l (op spec (a 1 , a 2 )) = slot l (a 1 ) ∪ slot l (a 2 ). However, this is inadequate for real grammars, if a simple correspondence between the slot names and the valence paths in the feature structure hook slots rels eqs hcons cat : Figure 2: Example of the MRS algebra is assumed. For instance, the passive rule involves coindexing a COMP in the original lexical sign with the SUBJ of the passive (informally, the complement 'becomes' the subject).
There are two ways round this problem. The first is to keep the algebra unchanged, but to assume that, for instance, the subject-head grammar rule corresponds to op subj in the algebra for non-passivized cases and to op comp1 for passives of simple transitives and so on. Though possible formally, this is not in accord with the spirit of the approach since selection of the appropriate algebra operation in the syntax-semantics interface would require non-local information. Practically, it also precludes the implementation of an algebra checker, since keeping track of the slot uses would be both complex and grammar-specific. The alternative is to extend the algebra to allow for slot renaming. For instance, op comp1-subj can be defined so that the COMP1 slot on the daughter is a SUBJ slot on the mother. This means extending the inventory of operations, but the choice of operation is then locally determinable from the rule (e.g., the passive rule would specify op comp1-subj to be its operation). Another issue arises in grammars which allow for optional complements. For instance, one approach to a verb like eat is to give it a single lexical entry which corresponds to both transitive and intransitive uses. The complement is marked as optional and the corresponding variable in the semantics is assumed to be discourse bound if there is no syntactic complement in the phrase. Optional complements can be discharged by a construction. This approach is (arguably) appropriate for eat because the intransitive use involves an implicit patient (e.g., I already ate means I already ate something), in con-trast to a verb like kick. CLF do not discuss optionality but it can be formalised in the algebra in terms of a construction-specified sement which has a hook containing the discourse referent and is otherwise empty. For instance, an optional complement construction corresponds to op comp1 (a 1 , a 2 ) where a 1 is the head (and the only daughter appearing in the TFS for the construction) and a 2 is stipulated by the rule to be

The algebra in non-lexicalist grammars
CLF motivate the MRS algebra in terms of formalisation of the semantics of constraint-based grammars, such as HPSG, but, as we outline here, it is equally applicable to non-lexicalist frameworks. With a suitable definition of the syntax-semantics interface, the algebra can be used with non-TFS-based grammars. Fig. 3 sketches an example of MRS semantics for a CFG. A syntax-semantic interface component of the rule (shown in the second line of the figure) specifies the ops and their daughters: the IOBJ slot of the verb is instantiated with the first NP's hook and the OBJ slot of the result is instantiated with the hook of the second NP. The idea is extremely similar to the use of the algebra with TFS but note that with the addition of this syntax-semantic interface, the algebra can be used directly to implement semantic composition for a CFG.
This still relies on the assumption that all slots are known for every lexical item: semantically the grammar is lexicalist even though it is not syntactically. In fact this is analogous to semantic composition in GPSG (Gazdar et al., 1985) in that conventional lambda calculus also assumes that the semantic properties are known at the lexical level.

RMRS composition with deep grammars
The use of the CLF algebra in RMRS composition with deep lexicalist grammars is reasonably straight-  Fig. 4 shows the RMRS version of Fig. 2. As mentioned above, earlier forms of RMRS used an explicit representation for conjunction: the ingroup, or in-g. Reasons to avoid explicit binary conjunction were discussed with respect to MRS by Copestake et al. (2005) and readers are referred to that paper for an explanation: essentially the problem is that the syntactic assumptions influence the semantic representation. e.g., the order of combination of intersective modifiers affects the semantic representation, though it has no effect on denotation. The binary in-g suffers from this problem.
One alternative would be to use an n-ary conjunction symbol. However such representations cannot be constructed compositionally if modification is binary branching as there is no way of incrementally adding the conjuncts. Another option we considered was the use of, possibly redundant, conjunction relations associated with each element which could be combined to produce a flat conjunction. This leads to a spurious in-g in the case where there is no modifier. This looks ugly, but more importantly, does not allow for incremental specialisation, although the demonstration of this would take us too far from the main point of this paper.
We therefore assume a modified version of RMRS which drops in-g symbols but uses anchors instead. This means that RMRS and MRS TFS grammars can be essentially identical apart from lexical types. Furthermore, it turns out that, for composition without a lexicon, an anchor is needed in the hook regardless of the treatment of conjunction (see below).

RMRS composition without a lexicon
We now discuss the algebra for grammars which do not have access to subcategorization information and thus are neither syntactically nor semantically lexicalist. We concentrate in particular on composition for the grammar used in the RASP system. RASP consists of a tokenizer, POS tagger, lemmatizer, tag sequence grammar and statistical disambiguator. Of the robust analysers we have looked at, RASP pro-  vides the biggest challenge for the RMRS approach because it provides quite detailed syntactic analyses which are somewhat dissimilar to the ERG: it is an intermediate rather than a shallow processor. The RMRS approach can only be fully successful to the extent that it abstracts away from the differences in syntactic analyses assumed by different systems, so intermediate processors are more difficult to deal with than shallow ones.
Instead of normal lexical entries, RASP uses the POS tags for the words in the input. For the example in Fig. 1, the output of the POS tagging phase is: the AT fat JJ cat NN1 sit+ed VVD on II a AT1 mat NN1 The semantics associated with the individual words in the sentence can be derived from a 'lexicon' of POS tags, which defines the EPs. Schematically: AT lexrel q(x) NN1 lexrel n(x) AT1 lexrel q(x) VVD lexrel v(e past ) JJ lexrel j(x) II lexrel p(e) Here, 'lexrel' is a special symbol, which is to be replaced by the individual lemma (with a leading underscore) -e.g., lexrel v(e past ) yields l1:a1: sit v(e). Producing the semantics from the tagger output and this lexicon is a simple matter of substitution. All EPs are labelled with unique labels and all variables are different unless repeated in the same lexical entry.
If the analysis were to stop at POS tagging, the semantic composition rules would apply trivially. There are no slots, the hooks are irrelevant and there are no equalities. The composition principle of accumulation of elementary predications holds, so the semantics of the result involves an accumulation of the rels (see the example at the bottom of Fig. 1).
When using the full RASP parser, although we cannot expect to obtain all the details available from deep grammars, we can derive some relational structure. For instance, given a sentence such as the cat chased the rat, it should be possible to derive the ARG1 and ARG2 for chase by associating the ARG1 with the application of the S/np_vp RASP rule (i.e., S->NP VP) and the ARG2 with the application of the V1/v_np rule. But since there can be no slot information in the lexical structures (at least not for open-class words), it is necessary to modify the lexicalist approach to semantics taken so far.
We assume that both the ARGs and the slots are specified at a phrasal level rather than lexically. As mentioned in §2.1, the MRS algebra allows for rules to contribute semantics as though they were normal phrases. The central idea in the application of the algebra to RASP is to make use of construction semantics in all rules. Fig. 5 illustrates this with the V1/v_np rule (the NP has been simplified for clarity) assuming the same sort of syntax-semantics interface specification as shown earlier for the CFG. This is semantically ternary because of the rule semantics. The rule has an ARG2 slot plus a slot R which is instantiated by the verb's hook. In effect, the rule adds a slot to the verb.
It is necessary for the anchor of the argumenttaking structure to be visible at all points where arguments may be attached. For instance, in the example above, the anchor of the verb chase has to be accessible when the ARG1 relation is introduced. Although generally the anchor will correspond to the anchor of the semantic head daughter, this is not the case if there is a scopal modifier (consider a cat did not chase a rat: the ARG1 must be attached to chase rather than to not). This is illustrated by not sleep in Fig. 6. Because not is associated with a unique tag in RASP, it can be assigned a slot and an ARG1 directly. The anchor of the result is equated with the label of sleep and thus the subject ARG1 can be appropriately attached. So the hook would have to include an anchor even if explicit conjunction were used instead of equating labels.  In this section, we outline the practical implementation of the algebra for RASP-RMRS. The RASP tag sequence grammar is formally equivalent to a CFG: it uses phrase structure rules augmented with features. As discussed, the algebra requires that ops are specified for each rule application, and the easiest way of achieving this is to associate semantic composition rules with each rule name. Composition operates on the tree output from RASP, e.g.,: (|T/txt-sc1/----| (|S/np_vp| (|NP/det_n1| |Every:1_AT1| (|N1/n| |cat:2_NN1|)) (|V1/v| |bark+ed:3_VVD|))) Composition operates bottom-up: the semantic structures derived from the tags are combined according to the semantics associated with the rule. The implementation corresponds very directly to the algebra, although the transitive closure of the equalities is computed on the final structure, since nothing requires that it be available earlier.
The notation used to specify semantics associated with the rules incorporates some simplifications to avoid having to explicitly specify the slot and ops. The specification of equalities between variables and components of the individual daughters' hooks is a convenient shorthand for the full algebra. If no semantic rule is specified corresponding to a rule used in a tree, the rels are simply appended. Semantic composition is thus robust to omissions in the semantic component of the grammar. In fact, semantic rules can be constructed semi-automatically, rather than fully manually, although we do not have space to discuss this in detail here.
There are cases of incompatibility between RASP-RMRS and ERG-RMRS. For example, the ERG treats it as expletive in it rains: the lexical entry for rain specifies an expletive subject (i.e., a semantically empty it). RASP makes no such distinction, since it lacks the lexical information and thus the sentence has extraneous relations for the pronoun and an incorrect ARG1 for rain. This is an inevitable consequence of the lack of lexical information in RASP. However, from the perspective of the evaluation of the revised algebra, the issue is whether there are any cases where compositional construction of RASP-RMRSs which match ERG-RMRSs is impossible due to the restrictions imposed by the algebra. No such cases have been found. Bos et al. (2004) and Bos (2005) derive semantic interpretations from a wide-coverage categorial grammar. There are several differences between this and RASP-RMRS, but the most important arise from the differences between CCG and RASP. The CCG parser relies on having detailed subcategorization information (automatically derived from the CCG Bank which was semi-automatically constructed from the Penn Treebank), and thus semantic construction can assume that the arity of the predicate is lexically available. However, because CCG is purely lexicalist, phenomena that we expect to have construction semantics (e.g., compound nouns, larger numbers) have to be dealt with in a post-parsing phase rather than compositionally. Spreyer and Frank (2005) demonstrate RMRS construction from TIGER dependencies, but do not attempt to match a deep parser output.

Conclusion
We have demonstrated that the MRS algebra, originally intended as a formalisation of some aspects of semantic composition in constraint-based grammars, can be extended to RMRS and other types of grammar framework and can be used as the basis of a full implementation of composition. The algebra can thus be used much more widely than originally envisaged and could be exploited by a wide range of parsers. Useful properties concerning monotonicity and scope (see Fuchss et al. (2004)) are thus guaranteed for a range of grammars. Phrasal-level compatibility of RMRS (to the extent that this is syntactically possible) is also an important result. The main practical outcome of this work so far has been a semantic component for the RASP system which produces representations compatible with that of the ERG without compromising RASP speed or robustness. RASP-RMRSs have already been used in systems for question answering, information extraction, email response, creative authoring and ontology extraction (e.g., Uszkoreit et al. (2004), Watson et al. (2003), Herbelot and Copestake (2006)).