<?xml version="1.0"?><!DOCTYPE article SYSTEM "/project/take/software/searchbench_offline_processing/paperxml_generator/aclextractor/src/python/../resource/dtd/paperxml.dtd"><article><header><firstpageheader><page local="1" global="78"/><title>A Meta-grammar for CCG</title><author surname="Foreman" givenname="Mark"><org  name="The University of Adelaide Adelaide SA"/></author><author surname="McMichael" givenname="Daniel"><org  name="The University of Adelaide Adelaide SA"/></author></firstpageheader><frontmatter><p><b>A Meta-grammar for CCG</b></p><p><b>Mark FOREMAN</b></p><p>Dept. of Electrical and Electronic Eng. The University of Adelaide Adelaide SA 5005 Mark.Foreman@csiro.au</p></frontmatter><abstract>Applying CCG to domains outside of linguistics could require different sets of combinators to be developed for each domain. The meta-grammar described in this paper aims to assist such development by enabling simple, succinct expression of both existing and new combinator definitions. It favours the development of an easily-configurable, one­time-coded module that can perform CCG combinations for any combinator set of the researcher's choosing. A preliminary implementation shows both the feasibility and potential of the meta-grammar. </abstract></header><body><section number="1" title="Introduction"><p>The merits of Combinatory Categorial Grammar (CCG) have been established via natural language parser implementations like that of Hockenmaier and Steedman (2002) and Clark and Curran (2004). But recent findings show that categorial grammars based on CCG also display promise in domains outside of linguistics (McMichael et al., 2004). Over the years, new combinators have been developed to extend the system of pure categorial grammar (Steedman 2003), but although the set of combinators for CCG seems to have stabilised, this same set may not necessarily be applicable to analyses in other domains. In fact, McMichael et al. introduce two combinators - <i>functional application </i>and <i>modificational application, </i>both defined in section 2.1 - that are not part of the existing set of CCG combinators. Additionally, functional application cannot even be cleanly defined via a traditional combinator pattern. It is partly this inability of the existing techniques to cleanly define new combinators that motivates the proposal of a meta-grammar for combinator specification.</p><p>In this paper, we explain the motivations for and give a specification of the meta-grammar, along with complete examples of how it applies to new and existing combinators. Lastly, we examine the workings   and   potential   of   a preliminary <b>Daniel McMICHAEL</b></p><p>Information Enhancement Group CSIRO ICT Centre Waite Road, Urrbrae SA 5064 Daniel.McMichael@csiro.au implementation. The remainder of this section, however, presents a brief introduction to CCG.</p><subsection number="1.1" title="A Practical Introduction to CCG"><p>CCG operates by first assigning a syntactic category to each word in the sentence, as will be demonstrated in the proceeding example borrowed from Hockenmaier (2003). At this point, the notation for describing categories should be observed. Assuming     the simplistic subject-verb-object (SVO) pattern for English, the phrase "buys shares" will form a complete sentence S if it is preceded by a noun phrase, and we write this as:</p><p><b>buys shares   </b><b>h </b><b>S\NP</b></p><p>So the phrase "buys shares" can be thought of as a function that takes a noun phrase NP as an argument to its left and returns a sentence S.</p><p>Furthermore, "buys" will form a S\NP if it is followed by a noun phrase, and this is denoted as:</p><p><b>buys   </b><b>h </b><b>(S\NP)/NP</b></p><p>In doing this, we have eliminated the need for a separate verb category V, leaving us with the following category assignments:</p><doubt alpha="100.0" length="7" tooSmall="False" monospace="0.0">JohnhNP</doubt><p><b>shares   </b><b>h </b><b>NP</b></p><p>Formally, a category may be either atomic (S, NP, etc) or complex (S\S, (S\NP)/NP), etc). Complex categories take the general form a/ß or a\ß, where a and ß are themselves categories.</p><p>Given the above category assignments, a derivation proceeds as follows: "buys" is combined with "shares" under the operation of <i>forward application </i>(the term <i>forward </i>referring to both the direction of the slash). The phrase "buys shares" is combined with "John" under the operation of <i>backward application. </i>The combinators (operators) that govern these two operations are defined as follows:</p><page local="2" global="79"/><doubt alpha="27.6" length="29" tooSmall="False" monospace="0.0">X/Y Y ==&gt; X Y    X\Y    ==&lt; X</doubt><p>where X and Y represent any category. Typically, a derivation is represented in the following manner:</p><p>articles NP</p><doubt alpha="85.7" length="7" tooSmall="False" monospace="0.0">John NP</doubt><doubt alpha="64.3" length="14" tooSmall="False" monospace="0.0">buys (S\NP)/NP</doubt><p>shares NP</p><doubt alpha="75.0" length="4" tooSmall="False" monospace="0.0">S\NP</doubt><p>which corresponds to the following tree:</p><p>Several other combinators are defined by Steedman (2000) for capturing long-range dependencies in the English and Dutch languages: coordination (cD) type-raising (T), composition (B) and substitution (S). These combinator families are listed below:</p><p>The usage of some of these combinators is shown below, using example derivations taken from Steedman (2000) and Hockenmaier (2003).</p><doubt alpha="85.7" length="7" tooSmall="False" monospace="0.0">Anna NP</doubt><doubt alpha="61.5" length="13" tooSmall="False" monospace="0.0">met (S\NP)/NP</doubt><p>and conj</p><p>might marry (S\NP)/VP VP/NP</p><p>Manny NP</p><doubt alpha="54.2" length="24" tooSmall="False" monospace="0.0">(S\NP)/NP (S\NP)/NP S\NP</doubt><doubt alpha="100.0" length="1" tooSmall="False" monospace="0.0">S</doubt><doubt alpha="50.0" length="2" tooSmall="False" monospace="0.0">&gt;B</doubt><doubt alpha="0.0" length="2" tooSmall="True" monospace="0.0">—&lt;</doubt><doubt alpha="100.0" length="4" tooSmall="False" monospace="0.0">that</doubt><doubt alpha="50.0" length="14" tooSmall="False" monospace="0.0">(NP\NP)/(S/NP)</doubt><doubt alpha="100.0" length="4" tooSmall="False" monospace="0.0">file</doubt><doubt alpha="100.0" length="7" tooSmall="False" monospace="0.0">without</doubt><doubt alpha="100.0" length="7" tooSmall="False" monospace="0.0">reading</doubt><doubt alpha="53.3" length="30" tooSmall="False" monospace="0.0">NP    VP/NP   (VP\VP)/VP VP/NP</doubt><doubt alpha="50.0" length="20" tooSmall="False" monospace="0.0">S/(S\NP) (VP\VP)/NP&gt;</doubt><doubt alpha="50.0" length="4" tooSmall="False" monospace="0.0">—&lt;Sx</doubt><doubt alpha="60.0" length="15" tooSmall="False" monospace="0.0">(VP\VP)/NP S/NP</doubt><doubt alpha="80.0" length="5" tooSmall="False" monospace="0.0">NP\NP</doubt><doubt alpha="33.3" length="3" tooSmall="False" monospace="0.0">-&gt;B</doubt><doubt alpha="0.0" length="5" tooSmall="False" monospace="0.0">—&gt; —&lt;</doubt><p>For further reference on CCG, the reader is directed to Steedman (1996) and (2000).</p></subsection><subsection number="1.2" title="An Historical Note on CCG"><p>The slash notation seen in categories of CCG stems from that used in the early works on pure categorial grammar by Ajdukiewicz (1935), Bar-Hillel (1953) and Lambek (1958). Steedman (1993) explains that he and Dowty refined these earlier notations, leading to the more consistent and readable style that is described in section 1.1. The only rules permitted by pure categorial grammar are forward and backward application. CCG extends this system with the above-listed rules, based on Curry and Feys' <i>combinators </i>- a term coined in their 1958 work on combinatory logic, where they examined devices that operate on functions, irrespective of the number of arguments. The combinatory nature of CCG rules enables a transparent mapping between syntactic and semantic form, thus providing one of the major appeals of this grammar formalism.</p><doubt alpha="0.0" length="1" tooSmall="False" monospace="0.0">2</doubt><p><b>Motivations</b></p><p>As can be seen in section 1.1, enumerating the entire set of combinators can be lengthy. Given that combinators in a family like {&gt;B, &gt;Bx, &lt;B, &lt;Bx} differ only by the direction of the slashes and order of the operands, it seems wasteful to present each one explicitly. A more compact representation is afforded by specifying only the pattern for &gt;B, along with the transformations required to obtain the variations &gt;Bx, &lt;B and &lt;Bx. The proposed meta-grammar provides a method for succinctly specifying these variations.</p><p>Without recognising the similarity within combinator families, and even between combinator families, writing code to apply combinators can be laborious, error-prone and wasteful, unless these similarities are exploited for optimum code reuse. The implementation of this meta-grammar takes full advantage of intra- and inter-family similarities.</p></subsection><subsection number="2.1" title="New Domains"><p>Providing a meta-grammar by which to specify combinator families lends itself to a single-module implementation that can be easily configured to handle new combinators. This capability is important because, although the set of combinators for use in linguistics seems to have matured, there are other domains that stand to benefit from CCG analyses, but for which grammar development is still in its infancy.<page local="3" global="80"/> In particular, the authors are currently developing a generic parser capable of being configured to specific domains, including, but not limited to, NLP and situation assessment. Research into applying CCG to these domains is being assisted by an ability to perform rapid prototyping on their grammars.</p><doubt alpha="100.0" length="2" tooSmall="False" monospace="0.0">NP</doubt><table class="main" frame="box" rules="all" border="0" regular="False"><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>X   conj X</b></p></td><td class="cell"><p><b>=&lt;*&gt;</b></p></td><td class="cell"><p><b>X</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>X</b></p></td><td class="cell"><p></p></td><td class="cell"><p><b>Y/(Y\X)</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>X</b></p></td><td class="cell"><p><b>= &lt;T</b></p></td><td class="cell"><p><b>Y\(Y/X)</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>X/Y Y/Z</b></p></td><td class="cell"><p><b>= &gt;B</b></p></td><td class="cell"><p><b>X/Z</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>X/Y Y\Z</b></p></td><td class="cell"><p><b>= &gt;Bx</b></p></td><td class="cell"><p><b>X\Z</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>Y\Z X\Y</b></p></td><td class="cell"><p><b>= &lt;B</b></p></td><td class="cell"><p><b>X\Z</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>Y/Z X\Y</b></p></td><td class="cell"><p><b>= &lt;Bx</b></p></td><td class="cell"><p><b>X/Z</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>(X/Y)/Z Y/Z</b></p></td><td class="cell"><p><b>= &gt;S</b></p></td><td class="cell"><p><b>X/Z</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>(X/Y)\Z Y\Z</b></p></td><td class="cell"><p><b>= &gt;Sx</b></p></td><td class="cell"><p><b>X\Z</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>Y\Z (X\Y)\Z</b></p></td><td class="cell"><p><b>= &lt;S</b></p></td><td class="cell"><p><b>X\Z</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p><b>Y/Z (X\Y)/Z</b></p></td><td class="cell"><p><b>= &lt;Sx</b></p></td><td class="cell"><p><b>X/Z</b></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr></table><p>The two new combinators mentioned in the introduction - functional application (F) and modificational application (M) - are defined as follows:</p><doubt alpha="38.5" length="13" tooSmall="False" monospace="0.0">x/y    y=—&gt;fx</doubt><doubt alpha="38.5" length="13" tooSmall="False" monospace="0.0">y    x\y=&gt;&lt;fx</doubt><doubt alpha="41.7" length="12" tooSmall="False" monospace="0.0">x/x   x—^&gt;mx</doubt><doubt alpha="38.5" length="13" tooSmall="False" monospace="0.0">x    x\x—^&lt;mx</doubt><p>with the caveat that X^Y. These combinators find use in the authors' research in both English parsing and situation assessment. Note that &gt;F and &gt;M together cover all combinations possible under the traditional vanilla forward application rule &gt;; similarly for &lt;F and &lt;M with &lt;. It will suffice to say here that the reason for splitting the traditional rules into two was to correctly handle head inheritance while maintaining a simple mathematical model; further explanation is not within the scope of this paper<footnote anchor="1"/>. The &gt;F and &lt;F combinators defined above would incorrectly be interpreted as the vanilla &gt; and &lt; combinators if it were not for the caveat. So this example not only demonstrates new combinators, but also highlights the shortcomings of the current methods for specifying combinators. The proposed meta-grammar provides an elegant (caveat-free) solution to this problem.</p><p>Another domain that is planned for investigation is geology. The general intent is to analyse vertical sequences of discrete sedimentary layers in a manner analogous to English parsing, where sequences of (discrete) words are analysed. Griffiths (1989) founded the precursor to this research by demonstrating that meaningful analyses could be performed on sedimentary sequences using a context-free grammar. He also speculated that context-sensitive analyses might be able to resolve some ambiguities, lending weight to the application of CCG, which is mildly context-sensitive, to such a task.</p></subsection><subsection number="2.2" title="Converting Treebanks"><p>When employing a statistical parser, a suitable corpus of pre-parsed sentences is required for training the probabilities. However, altering the grammar through the addition or deletion of combinators (as is done when applying CCG to new domains) requires a new corpus to be marked-up accordingly. This process typically requires converting the context-free derivation trees from the Penn Treebank (Marcus et al., 1993, 1994) to intermediate binary context-free trees and then finally to CCG trees. The second stage of conversion (binary CF to CCG) requires a technique referred to as <i>inverse combination, </i>where an unknown left or right category is determined given the result category. This contrasts to regular combination, where the unknown result is deduced from two known operands. There are two types of inverse combination: <i>missing-left </i>(when the right operand and result are known) and <i>missing-right </i>(when the left operand and result are known. Missing-left and missing-right scenarios are shown left and right respectively below.</p><p>It will be shown in section 4.2 that a standard implementation of the meta-grammar can be made to perform these operations by merely permuting some of the configuration information passed to the module.</p></subsection><subsection number="2.3" title="Python Implementation"><p>The implementation described in this paper was coded in Python (Python Programming Language, 2004). Python was chosen for its ability to aid rapid prototyping and for its ease of integration with much faster C code. Thus we hope to benefit from lower coding times and easier debugging, with the option to port to C and re-integrate any mature code that is deemed time-critical.</p></subsection></section><section number="3" title="The Meta-grammar"><p>This section details the meta-grammar that controls the specification of a CCG. The set of combinators are specified as a list of combinator templates, one template for each combinator family:</p><footnote label="1">The authors would like to credit the work of Geoff Jarrad in developing these two combinators.</footnote><p><b>combinator-set :=</b><page local="4" global="81"/></p><p><b>COMBINATOR-TEMPLATE1</b> <b>COMBINATOR-TEMPLATEm</b></p><p>Each combinator template defined separately, as well as any atomic variations referenced in the templates. These are both described below, and proceeded by some example templates.</p><p>It is worth noting that this proposal focuses primarily on specifying combinators for the express purpose of performing combinations. The corresponding semantics (logical forms) may be associated with operands and the result, following from Steedman (2000).</p><subsection number="3.1" title="Specifying a Combinator Template"><p>A combinator template is specified as a tuple:</p><p><b>COMBINATOR-TEMPLATE := ( TYPE,</b> <b>OPERAND-PATTERN-LIST, RESULT-PATTERN, PERMITTED-VARIATIONS )</b></p><p>where the entries in the tuple are defined as:</p><p>TYPE: an identifier for the combinator that should be unique across all other combinator templates. Typically it is a single character; in section 1.1 we saw them as cD, T, B and S.</p><p>OPERAND-PATTERN-LIST: the ordered list of n operand patterns. Typically <b>n=2 </b>since most combinators are binary operations, although <b>n=1 </b>for type-raising (T). The syntax for these patterns is given in section 3.2.</p><p>RESULT-PATTERN: a pattern that specifies how to construct the resulting category from operand categories that successfully match the operand patterns.</p><p>PERMITTED-VARIATIONS: as mentioned in section 2, only one pattern set is specified per family of combinators. Each variation in the family is specified as a tersely coded entry in this list. For instance, the composition family (B) would have permitted-variations = <b>{  &gt;,   &gt;x,  &lt;,  &lt;x }</b>.</p></subsection><subsection number="3.2" title="Specifying a Pattern"><p>The patterns specified in the combinator template must conform to the following EBNF syntax:</p><doubt alpha="63.6" length="33" tooSmall="False" monospace="0.0">&lt;PATTERN&gt; := &lt;ATOMIC&gt;| &lt;COMPOUND&gt;</doubt><doubt alpha="28.3" length="106" tooSmall="False" monospace="0.0">&lt;ATOMIC&gt;   := &lt;A&gt;[,e'|,n']&lt;N&gt; &lt;A&gt;   :=   (lA'|...|lZ') + &lt;N&gt;   :=   (l0'|...|l9') + &lt;COMPOUND&gt;   := &lt;LEFT&gt;</doubt><doubt alpha="52.6" length="19" tooSmall="False" monospace="0.0">(&lt;RIGHT&gt;&lt;RIGHT&gt;1]')</doubt><doubt alpha="52.6" length="19" tooSmall="False" monospace="0.0">&lt;LEFT&gt; := &lt;ATOMIC&gt;|</doubt><footnote label="1">('&lt;COMPOUND&gt; 1 )'</footnote><doubt alpha="58.3" length="24" tooSmall="False" monospace="0.0">&lt;RIGHT&gt; := &lt;SLASH&gt;&lt;LEFT&gt;</doubt><doubt alpha="34.8" length="23" tooSmall="False" monospace="0.0">&lt;SLASH&gt;   :=(l\'|V')&lt;N&gt;</doubt><p>For simplicity of expression, we introduce the semantic requirement that an <b>&lt;A&gt;n&lt;N&gt; </b>pattern may only occur immediately after a slash. Alter­natively, we could provide a completely context-free grammar for patterns through a slightly less intuitive EBNF, by redefining <b>&lt;ATOMIC&gt; </b>and <b>&lt;RIGHT&gt; </b>:</p><doubt alpha="40.0" length="25" tooSmall="False" monospace="0.0">&lt;ATOMIC&gt;   := &lt;A&gt;[le']&lt;N&gt;</doubt><doubt alpha="55.6" length="18" tooSmall="False" monospace="0.0">&lt;RIGHT&gt; := &lt;SLASH&gt;</doubt><doubt alpha="44.4" length="18" tooSmall="False" monospace="0.0">(&lt;LEFT&gt;|&lt;A&gt;ln'&lt;N&gt;)</doubt><p>Some patterns that conform to this syntax include:</p><doubt alpha="100.0" length="2" tooSmall="False" monospace="0.0">Xi</doubt><doubt alpha="33.3" length="6" tooSmall="False" monospace="0.0">Y1/2Y3</doubt><doubt alpha="23.1" length="13" tooSmall="False" monospace="0.0">(X1/1Y1) \2X2</doubt><p>Atomic patterns (patterns without slashes or brackets) are specified as alphanumeric strings which to allows for greater control over pattern specification. Any two atomic patterns <b>(A'N' </b>and <b>A"N") </b>and the categories they match (C and <b>C" </b>respectively) are governed by the following constraints:</p><doubt alpha="26.7" length="45" tooSmall="False" monospace="0.0">A'=A", N'=N" == C'=C" A'=A",   N'^N" == C'^C"</doubt><p>As an example, suppose we want to match some category to the pattern <b>((X</b>1/1<b>X</b>1)/2<b>X</b>2)/3<b>Y</b>1, then the subcategory in the position of the first <b>X</b>1 must be equal to the subcategory in the position of the second <b>X1, </b>but must be <i>distinct </i>from the subcategory in the position of the <b>X</b>2 (and any other <b>X</b>&lt;N&gt; that might have been in the pattern). The subcategories in the positions of <b>X</b>1, <b>X</b>1 and <b>X</b>2 are <i>independent </i>of the subcategory in the position of <b>Y</b>1. For example, this pattern would match the categories <b>((A/A)/B)/A, ((A/A)/B)/B </b>and</p><doubt alpha="50.0" length="32" tooSmall="False" monospace="0.0">((A/A)/B)/C,but not((A/C)/B)/Aor</doubt><p><b>((A/A)/A)/A.</b></p><p>The presence of an 'e' in an atomic pattern indicates that the atomic pattern will only match with an atomic category. Thus Xe1 will match category <b>A, </b>but not <b>A/A.</b></p><p>The presence of an 'n' in an atomic pattern indicates that the atomic pattern will allow matching to an unlimited number of arguments, similar  to  the   "$   convention"  described in (Steedman 2000).<page local="5" global="82"/> A pattern <b>X</b><b>1/1</b><b>Y</b><b>n1 </b>would match categories <b>A/B, (A/B)/C, ((A/B)/C)/D, </b>etc.</p><p>Square brackets (if present) in a pattern surround an optional portion of that pattern. For example, the pattern <b>X</b><b>e1[/1</b><b>Y</b><b>e1] </b>would match categories <b>A </b>and <b>A/B, </b>but not <b>(A/B)/C </b>or <b>A/(B/C).</b></p></subsection><subsection number="3.3" title="Specifying Variations"><p>Each combinator in a given family corresponds to exactly one variation in the permitted-variations list of that family's combinator-template. Suppose we have operand and result patterns:</p><doubt alpha="62.5" length="8" tooSmall="False" monospace="0.0">TYPE = B</doubt><doubt alpha="43.5" length="46" tooSmall="False" monospace="0.0">OPERANDS  = X1/1Y1, Y1/2Z1RESULT      = X1/3Z1</doubt><p>then a <b>&gt; </b>in the permitted-variations list corresponds to the combinator:</p><doubt alpha="35.0" length="20" tooSmall="False" monospace="0.0">X1/Y1Y1/Z1 = &gt;BX1/Z1</doubt><p>That is, forward combination <b>&gt; </b>does not alter slash directions or operand order. On the other hand, backward combination <b>&lt; </b>reverses all slashes and operand order, so a <b>&lt; </b>in the permitted-variations list would correspond to the combinator:</p><doubt alpha="35.0" length="20" tooSmall="False" monospace="0.0">Y1\Z1X1\Y1 = &lt;BX1\Z1</doubt><p>Other atomic variations may be defined and used with either <b>&lt; </b>or <b>&gt; </b>. An atomic variation that is used in generating the composition (B) family is:</p><doubt alpha="11.1" length="9" tooSmall="False" monospace="0.0">x:{/2,/3}</doubt><p>That is, the <b>x </b>variant reverses the direction of slash 2 and slash 3. The effect of atomic variations is successive. So a variation like <b>&lt;x </b>would have operands and all slashes reversed by <b>&lt; </b>, but the <b>x </b>would reverse slashes 2 and 3 back to their original orientation (in this case, forward):</p><doubt alpha="42.9" length="14" tooSmall="False" monospace="0.0">Y1/Z1X1\YX1/Z1</doubt><p>Taking this one step further, suppose we invent an arbitrary variant <b>i:{/3}</b>, then the combinator corresponding to variant <b>&lt;xi </b>would be:</p><doubt alpha="53.8" length="13" tooSmall="False" monospace="0.0">Y1/Z1X1\YXAZ1</doubt><p>Slash 3 has been reversed once by <b>&lt; </b>, again by <b>x </b>and again by <b>i </b>, giving an overall effect of a single reversal.</p></subsection><subsection number="3.4" title="Some Example Templates"><p>This section is a simple demonstration of how the above-described meta-grammar can be used to specify both existing (type-raising, composition) and new (functional application, modificational application) combinators.</p><subsubsection number="3.4.1" title="Type Raising"><doubt alpha="63.6" length="22" tooSmall="False" monospace="0.0">TYPE = T OPERANDS = X1</doubt><doubt alpha="57.9" length="19" tooSmall="False" monospace="0.0">RESULT = Y1/AYA2X1)</doubt><doubt alpha="55.6" length="18" tooSmall="False" monospace="0.0">VARIATIONS = {&gt;,&lt;}</doubt><doubt alpha="31.2" length="32" tooSmall="False" monospace="0.0">X1 = &gt;TY1/(Y1\X1)X1=&lt;TY1\(Y1/X1)</doubt></subsubsection><subsubsection number="3.4.2" title="Composition"><p>Note that this template specifies general composition (Bn).</p><doubt alpha="53.7" length="41" tooSmall="False" monospace="0.0">OPERANDS = X1/1Y1,Y1/2Zn1RESULT = X1/3Zn1</doubt><doubt alpha="48.0" length="25" tooSmall="False" monospace="0.0">VARIATIONS  = {&gt;,&gt;x,&lt;,&lt;x}</doubt><doubt alpha="43.3" length="60" tooSmall="False" monospace="0.0">X1/Y1Y1/Zn1 = &gt;BX1/Zn1X1/Y1Y1\ZnX1\Zn1Y1\Zn1X1\Y1 = &lt;BX1\Zn1</doubt><doubt alpha="47.6" length="21" tooSmall="False" monospace="0.0">Y1/Zn1X1\Y1=&lt;BxX1/Zn1</doubt></subsubsection><subsubsection number="3.4.3" title="Functional Application"><doubt alpha="62.5" length="8" tooSmall="False" monospace="0.0">TYPE = F</doubt><doubt alpha="50.0" length="22" tooSmall="False" monospace="0.0">OPERANDS  = X1/1X2, X2</doubt><doubt alpha="58.6" length="29" tooSmall="False" monospace="0.0">RESULT = X1VARIATIONS = {&gt;,&lt;}</doubt><doubt alpha="41.7" length="24" tooSmall="False" monospace="0.0">X1/X2X2=&gt;FX1X2X1\X2=&gt;FX1</doubt></subsubsection><subsubsection number="3.4.4" title="Modificational Application"><doubt alpha="62.5" length="8" tooSmall="False" monospace="0.0">TYPE = M</doubt><doubt alpha="57.1" length="49" tooSmall="False" monospace="0.0">OPERANDS = X1/1X1,X1RESULT = X1VARIATIONS = {&gt;,&lt;}</doubt><doubt alpha="41.7" length="24" tooSmall="False" monospace="0.0">X1/X1X1=&gt;FX1X1X1\X1=&gt;FX1</doubt></subsubsection></subsection></section><section number="4" title="Using the Implementation"><p>A prototype module has been developed in Python to implement the meta-grammar described in this paper. The module can be thought of as a factory which takes a combinator-set conforming to the definition in section 3 and returns a single function, <b>combine ( ) </b>.<page local="6" global="83"/></p><p><b>COMBINE FACTORY</b></p><p><b>combinator templates</b> <b>v </b><b>'fn^</b><b> </b><b>combine() ' I function</b></p><p>The <b>combine() </b>function takes any number of operand categories as arguments and returns a list of (result-category, combinator) tuples that corresponds to all possible categories that can be derived from the input categories.</p><subsection number="4.1" title="Combination"><p>As an example, let us consider the module when configured by the type-raising and composition combinator templates given in sections 3.1 and 3.2. The input to the <b>combine() </b>function is a sequence of operand categories, and the output is a list of possible resulting categories and their corresponding combinators.</p><p>Suppose the input is a pair of categories, <b>A/B </b>and <b>B\C. </b>Type-raising is immediately discounted by the function because it is unary and thus cannot operate on a pair of categories. Consequently, the function only considers the composition (B) combinators. The function attempts to match the first category, <b>A/B, </b>with the first operand pattern, <b>X</b><b>1/1</b><b>Y</b><b>1,</b><b> </b>and the second category, <b>B\C, </b>with the second operand pattern, <b>Y</b><b>1/2</b><b>Z</b><b>n1,</b><b> </b>ignoring slash directions for the moment. This match is successful, and results in a <i>match dictionary </i>of <b>{X</b><b>1</b><b>:A, Y</b><b>1</b><b>:B, Z</b><b>n1</b><b>:C} </b>. The slashes are then found to match those required for forward crossing <b>(&gt;x) </b>composition <b>{s1:/, s2:\}, </b>but not for vanilla forward composition <b>{s1:/, s2:/}. </b>From these matches, the result can be built: <b>X</b><b>1</b><b>\Z</b><b>n1</b><b>:A\C. </b>To attempt the backwards combinations, the function then tries to match the input categories to the reversed sequence of operand patterns, i.e. <b>A/B </b>with <b>Y</b><b>1/2</b><b>Z</b><b>n1 </b>and <b>B\C </b>with <b>X</b><b>1/1</b><b>Y</b><b>1.</b><b> </b>This attempt fails because <b>Y</b><b>1</b><b>=A </b>in the first category, while <b>Y</b><b>1</b><b>=C </b>in the second category. So for the input <b>A/B B\C, </b>the output is a single category-combinator pair: <b>(A\C &gt;Bx) </b>.</p><p>If the input were <b>A/B </b><b>C,</b><b> </b>the output would be an empty list since the second category <b>C </b>will not match the structure of either of the operand patterns.</p><p>Suppose now the input is a single category <b>A.</b><b> </b>The composition combinators can be immediately discounted since they require two operands. However, it does match the single operand pattern for the type raising combinator, giving match dictionary <b>{X</b><b>1</b><b>:A} </b>. This conforms to both the forward and backward type-raising, so the function would output a pair list <b>{(*/(*\A) &gt;T), (*\(*/A) &lt;T)}, </b>where the <b>* </b>character indicates that there was no match for <b>Y</b><b>1 </b>in the input. The handling of these wildcards rests with the client software.</p></subsection><subsection number="4.2" title="Inverse Combination"><p>A very useful property of the meta-grammar and its associated implementation is that it can be configured to deduce a child category given the derived category and the other child/children. A process we term <i>inverse combination.</i></p><p>Consider the case of a binary combinator with pattern:</p><doubt alpha="60.7" length="28" tooSmall="False" monospace="0.0">OPERANDS = A B RESULT    = C</doubt><doubt alpha="50.0" length="20" tooSmall="False" monospace="0.0">VARIATIONS = {&gt;*,&lt;*}</doubt><p>where <b>A,</b><b> </b><b>B,</b><b> </b><b>C</b><b> </b>are pattern <i>placeholders </i>( - they are obviously not valid patterns themselves), <b>&gt;* </b>represents some number of forward variations and <b>&lt;* </b>represents some number of backward variations. Now suppose we know the left and result categories (cA and cC), and wish to enumerate all valid right categories (cB) - the <i>missing-right </i>scenario. This is achieved via a two-step process, involving the instantiation of two <b>combine() </b>functions:</p><doubt alpha="60.7" length="28" tooSmall="False" monospace="0.0">OPERANDS = A C RESULT    = B</doubt><doubt alpha="58.8" length="17" tooSmall="False" monospace="0.0">VARIATIONS = {&gt;*}</doubt><p><b>[COMBINE FACTORY]</b> <b>combine</b><b>1()</b> <b>combine</b><b>2()</b></p><doubt alpha="0.0" length="1" tooSmall="False" monospace="0.0">1</doubt><doubt alpha="60.7" length="28" tooSmall="False" monospace="0.0">OPERANDS = C A RESULT    = B</doubt><doubt alpha="52.6" length="19" tooSmall="False" monospace="0.0">VARIATIONS  = {&lt;*}1</doubt><p>Simple addition of the two returned lists obtains the desired result:</p><p><b>combine</b><b>1</b><b>(c</b><b>A</b><b>,c</b><b>C)  </b><b>+ combine</b><b>2</b><b>(c</b><b>A</b><b>,c</b><b>C)</b><page local="7" global="84"/></p><p>This works because <b>comb ine</b><b>1() </b>returns the list of <b>c</b><b>B</b>'s that result from valid matches of <b>A:c</b><b>A, </b><b>C:c</b><b>C. </b><b>combine</b><b>2() </b>also matches <b>A:c</b><b>A, </b><b>C:c</b><b>C, </b>but its operation is a little less obvious: because <b>combine</b><b>2() </b>only considers backward combinations, it always reverses the order of its operands <b>c</b><b>A </b>and <b>c</b><b>C, </b>so <b>A </b>is still compared with <b>c</b><b>A, </b>and <b>C </b>with <b>c</b><b>C.</b></p><p>Inverse combination for the <i>missing-left </i>scenario can be performed similarly, so in the interest of brevity its detail is omitted.</p><p>While the above approach may seem awkward, keep in mind that no changes are required to the meta-grammar definition or to the implementation's code base. So inverse combination is obtained for free.</p></subsection></section><section number="5" title="Conclusion"><p>We have defined a meta-grammar for specifying complete families of CCG combinators. This meta-grammar covers existing combinators, but more importantly, it provides a guide for specifying and using new combinators. A brief look at a preliminary implementation reveals that the meta-grammar is indeed practical, and lends itself to powerful exploitation.</p></section><section number="6" title="Acknowledgements"><p>This paper is based on work supported by Boeing and CSIRO, and by a Commonwealth scholarship (APA) plus Woodside PhD top-up scholarship to the first author. The authors would like to thank Geoff Jarrad for his input to discussions and assistance with reviewing. Many thanks also to the official reviewers for their helpful suggestions.</p></section><references><p>(2004). Python Programming Language, Python Software Foundation. 2004.</p><p>Ajdukiewicz, K. (1935). "Die syntaktische Konnexität." <i>Studia Philosophica </i>1: 1-27.</p><p>Bar-Hillel, Y. (1953). "A Quasi-Arithmetical Notation for Syntactic Description." <i>Language </i>29: 47-58.</p><p>Clark, S. and J. Curran (2004). Parsing the WSJ using CCG and Log-Linear Models. <i>42nd Annual Meeting of the Association for Computational Linguistics (ACL-04), </i>Barcelona, Spain.</p><p>Curry, H. and R. Feys (1958). Combinatory logic. Amsterdam, North-Holland.</p><doubt alpha="58.1" length="43" tooSmall="False" monospace="0.0">Griffiths, C. M. (1989). "The nature of the</doubt><p>geological     representation     language and consequent constraints on machine interpretation." <i>Advances in Geophysical Data Processing </i>3: 49-77.</p><p>Hockenmaier, J. (2003). Data and Models for Statistical Parsing with Combinatory Categorial Grammar. School of Informatics. Edinburgh, University of Edinburgh: 280.</p><p>Hockenmaier, J. and M. Steedman (2002). Generative Models for Statistical Parsing with Combinatory Categorial Grammar. <i>40th Annual Meeting of the Association for Computational Linguistics, </i>Philadelphia.</p><p>Lambek, J. (1958). "The mathematics of sentence structure." <i>American Mathematical Monthly </i>65:</p><p>154-170.</p><p>Marcus, M. P., G. Kim, et al. (1994). The Penn treebank: Annotating predicate argument structure. <i>Human Language Technology Workshop.</i></p><p>Marcus, M. P., B. Santorini, et al. (1993). "Building a Large Annotated Corpus of English: The Penn Treebank." <i>Computational Linguistics</i></p><doubt alpha="44.8" length="67" tooSmall="False" monospace="0.0">19(2): 313-330. McMichael, D., G. Jarrad, et al. (2004). Modelling,</doubt><p>Simulation and Estimation of Situation Histories.</p><p><i>7th International Conference on Information Fusion (Fusion 2004), </i>Stockholm, Sweden, International Society for Information Fusion.</p><p>Steedman, M. (1993). "Categorial grammar." <i>Lingua </i>90(3): 221-258.</p><p>Steedman, M. (1996). Surface Structure and Interpretation. Massachusetts, MIT Press.</p><p>Steedman, M. (2000). The Syntactic Process. Massachusetts, MIT Press.</p><p>Steedman,  M.   and   J.   Baldridge (2003).</p><p>Combinatory Categorial Grammar (Draft 4.0,</p><p>August 10, 2003).</p><p>ftp://ftp.cogsci.ed.ac.uk/pub/steedman/ccg/manif esto.pdf [Internet]. Accessed 15 September 2004.</p></references></body></article>