<?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"/><title>The Use of Instrumentation in Grammar Engineering</title><author surname="Broker" givenname="Norbert"><org  name="Rauenberg"/></author></firstpageheader><frontmatter><p>The Use of Instrumentation in Grammar Engineering</p><p>Norbert Bröker</p><p>Eschenweg 3, 69231 Rauenberg</p></frontmatter><abstract>This paper explores the usefulness of a technique from software engineering, code instrumentation, for the development of large-scale natural language grammars. Information about the usage of gram­mar rules in test and corpus sentences is used to improve grammar and testsuite, as well as adapting a grammar to a specific genre. Results show that less than half of a large-coverage grammar for German is actually tested by two large testsuites, and that 10-30% of testing time is redundant. This method­ology applied can be seen as a re-use of grammar writing knowledge for testsuite compilation. The construction of genre-specific grammars results in performance gains of a factor of four. </abstract></header><body><section number="1" title="Introduction"><p>The field of Computational Linguistics (CL) has both moved towards applications and towards large data sets. These developments call for a rigorous methodology for creating so-called lingware: linguis­tic data such as lexica, grammars, tree-banks, as well as software processing it. Experience from Soft­ware Engineering has shown that the earlier deficien­cies are detected, the less costly their correction is. Rather than being a post-development effort, quality-evaluation must be an integral part of development to make the construction of lingware more efficient (e.g., cf. (EAGLES, 1996) for a general evaluation framework and (Ciravegna et al., 1998) for the ap­plication of a particular software design methodol­ogy to linguistic engineering). This paper presents the adaptation of a particular Software Engineering (SE) method, instrumentation, to Grammar Engi­neering (GE). Instrumentation allows to determine which test item exercises a certain piece of (software or grammar) code.</p><p>The paper first describes the use of instrumenta­tion in SE, then discusses possible realizations in uni­fication grammars, and finally presents two classes of applications.</p></section><section number="2" title="Software Instrumentation"><p>Systematic software testing requires a match be­tween the test subject (module or complete system) and a test suite (collection of test items, i.e., sam­ple input). This match is usually computed as the percentage of code items exercised by the test suite.</p><p>Depending on the definition of a code item, vari­ous measures are employed, for example (cf. <b>(Het-</b>zel, 1988) and (EAGLES, 1996, Appendix B) for overviews):</p><p><b>statement coverage </b>percentage of single state­ments exercised</p><p><b>branch coverage </b>percentage of arcs exercised in control flow graph; subsumes statement cover­age</p><p><b>path coverage </b>percentage of paths exercised from start <b>to </b>end in control flow graph; subsumes branch coverage; impractical due <b>to </b>large (often infinite) number of paths</p><p><b>condition coverage </b>percentage of (simple or ag­gregate) conditions evaluated <b>to </b>both true and false (on different test items)</p><p>Testsuites are constructed to maximize the tar­geted measure. A test run yields information about the code items not exercised, allowing the improve­ment of the testsuite.</p><p>The measures are automatically obtained by in­strumentation: The test subject is extended by code which records the code items exercised during pro­cessing. After processing the testsuite, the records are used to compute the measures.</p></section><section number="3" title="Grammar Instrumentation"><p>Measures from SE cannot simply be transferred to unification grammars, because the structure of (im­perative) programs is different from (declarative) grammars. Nevertheless, the structure of a grammar (formalism) allows to define measures very similar to those employed in SE.</p><p><b>constraint coverage </b>is the quotient # constraints exercised # constraint m grammar where a constraint may be either a phrase-structure or an equational constraint, depend­ing on the formalism.<page local="2"/></p><doubt alpha="33.3" length="15" tooSmall="False" monospace="0.0">1COn =J:-7—r—--</doubt><p><b>disjunction coverage </b>is the quotient</p><doubt alpha="100.0" length="3" tooSmall="False" monospace="0.0">dis</doubt><p># disjunctions covered # disjunctions in grammar where a disjunction is considered covered when all its alternative disjuncts have been separately-exercised. It encompasses constraint coverage. Optional constituents and equations have to be treated as a disjunction of the constraint and an empty constraint (cf. Fig.2 for an example).</p><p><b>interaction coverage </b>is the quotient # disjunct combinations exercised # legal disjunct combinations where a disjunct combination is a complete set of choices in the disjunctions which yields a well-formed grammatical structure. As with path coverage, the set of legal disjunct combination typically is infinite due to recur­sion. A solution from SE is to restrict the use of recursive rules to a fixed number of cases, for example not using the rule at all, and using it only once.</p><doubt alpha="100.0" length="2" tooSmall="False" monospace="0.0">mt</doubt><p>The goal of instrumentation is to obtain informa­tion about which test cases exercise which grammar constraints. One way to record this information is to extend the parsing algorithm. Another way is to use the grammar formalism itself to identify the disjuncts. Depending on the expressivity- of the for­malism used, the following possibilities exist:</p><p><b>atomic features </b>Assuming a unique numbering of disjuncts, an annotation of the form <b>DISJUNCT</b>-nn = + can be used for marking. To determine whether a certain disjunct was used in constructing a solution, one only needs to check whether the associated feature occurs (at some level of embedding) in the solution.</p><p><b>set-valued features </b>If set-valued features are available, one can use a set-valued fea­ture <b>DISJUNCTS </b>to collect atomic sym­bols representing one disjunct each: <b>DISJUNCT</b>-nn <b>€ DISJUNCTS, </b>which might the collection of exercised disjuncts.</p><p><b>multiset of symbols </b>To recover the number of times a disjunct is used, one needs <b>to </b>leave the unification paradigm, because it is very difficult to count with unification grammars. We have used a special feature of our grammar develop­ment environment: Following the LFG spirit of different projections, it provides a projection for</p><doubt alpha="28.6" length="14" tooSmall="False" monospace="0.0">VP =&gt;    V4=f:</doubt><doubt alpha="38.7" length="31" tooSmall="False" monospace="0.0">NP?1=(f OBJ); PP*    {4=(fOBL);</doubt><p><b>I     </b>4-6 (f ADJUNCT); }.</p><figure caption="Figure 1: Sample Rule"></figure><doubt alpha="40.0" length="10" tooSmall="False" monospace="0.0">VP=&gt;V4-=f:</doubt><doubt alpha="41.5" length="41" tooSmall="False" monospace="0.0">{ e        DISJUNCT-001 € o*:INP4=(f OBJ)</doubt><doubt alpha="38.2" length="68" tooSmall="False" monospace="0.0">DISJUNCT-002 € o*: } { e        DISJUNCT-003 € o*:IPP+    {1=(f OBL)</doubt><doubt alpha="52.9" length="34" tooSmall="False" monospace="0.0">DISJUNCT-004 € o*:I4-6 (f ADJUNCT)</doubt><p>DISJUNCT-005 € o*:} }.</p><figure caption="Figure 2: Instrumented rule"></figure><p>symbolic marks, which is formally equivalent to a multiset of symbols associated with the com­plete solution (structural embedding plays no role; see (Frank et al., 1998) for applications). In this way, we can collect from the root node of each solution the set of all disjuncts exercised, together with a usage count.</p><p>Consider the LFG grammar rule in Fig.l.<footnote anchor="1"/> Con­straint coverage would require test items such that every category in the <b>VP </b>is exercised; a sequence of <b>V NP PP </b>would suffice for this measure. Disjunction coverage also requires to take the empty disjuncts into account: <b>NP </b>and <b>PP </b>are optional, so that four items are needed to achieve full disjunction cover­age on the phrase structure part of the rule. Due to the disjunction in the <b>PP </b>annotation, two more test items are required to achieve full disjunction cover­age on the complete rule. Fig.2 shows the rule from Fig.l with instrumentation.</p></section><section number="4" title="Grammar and Testsuite Improvement"><p>Traditionally, a testsuite is used to improve (or maintain) a grammar's quality (in terms of cover­age and overgeneration). Using instrumentation, one may extend this usage by looking for sources of overgeneration (cf. Sec.<page local="3"/>4.3), and may also improve the quality of the testsuite, in terms of coverage (cf. Sec.4.1) and economy (cf. Sec.4.2).</p><footnote label="1">Although the sample rule are in the format of LPG, noth­ing of the methodology relies on the choice of linguistic or computational paradigm. The notation: ?/*/+ represent op-tionality/iteration including/excluding zero occurrences on categories, e represents the empty string. Annotations to a category specify equality (=) or set membership (e) of fea­ture values, or non-existence of features (-i);  they are termi­nated by a semicolon (;). Disjunctions are given in braces ({...|...}). t (4-) are metavariables representing the fea­ture structure corresponding to the mother (daughter) of the rule, o* (for optimality) represents the sentence's multi-set valued symbolic projection. Comments are enclosed in quo­tation marks ("..."). Cf. (Kaplan and Bresnan, 1982) for an introduction to LPG notation.</footnote><p>Complementing other work on testsuite construc­tion (cf. Sec.4.4), I will assume that a grammar is already available, and that a testsuite has to be constructed or extended. While one may argue that grammar and testsuite should be developed in paral­lel, such that the coding of a new grammar disjunct is accompanied by the addition of suitable test cases, and vice versa, this is seldom the case. Apart from the existence of grammars which lack a testsuite, there is the more principled obstacle of the evolu­tion of the grammar, leading to states where previ­ously necessary rules silently loose their usefulness, because their function is taken over by some other rules, structured differently. This is detectable by-instrumentation, as discussed in Sec.4.1.</p><p>On the other hand, once there is a testsuite, it has to be used economically, avoiding redundant tests. Sec.4.2 shows that there are different levels of re­dundancy in a testsuite, dependent on the specific grammar used. Reduction of this redundancy can speed up the test activity, and give a clearer picture of the grammar's performance.</p></section><section number="4" title=".1 Testsuite Completeness"><p>If the disjunction coverage of a testsuite is 1 for some grammar, the testsuite is <i>complete </i>w.r.t. this gram­mar. Such a testsuite can reliably be used to mon­itor changes in the grammar: Any reduction in the grammar's coverage will show up in the failure of some test case (for negative test cases, cf. Sec.4.3).</p><p>If the testsuite is not complete, instrumentation can identify disjuncts which are not exercised. These might be either (i) appropriate, but untested, dis­juncts calling for the addition of a test case, or (ii) in­appropriate disjuncts, for which a grammatical test case exercising them cannot be constructed.</p><p>Checking completeness of our local testsuite of 1787 items, we found that only 1456 out of 3730 grammar disjuncts in our German grammar were tested, yielding = 0.39 (the TSNLP testsuite containing 1093 items tests only 1081 disjuncts, yielding <i>T^g </i>= 0.28).<footnote anchor="2"/> Fig.3 shows an example of a gap in our testsuite (there are no examples of circumpositions), while Fig.4 shows an inapproppri-<b>ate </b>disjunct thus discovered (the category ADVadj has been eliminated in the lexicon, but not in all rules). Another error class is illustrated by Fig.5, which shows a disjunct that can never be used due to an LFG coherence violation; the grammar is in­consistent here.<footnote anchor="3"/></p><footnote label="2">There are, of course, unparsed but grammatical test cases in both testsuites, which have not been taken into account in these figures. This explains the difference to the overall number of 1582 items in the German TSNLP testsuite.</footnote><footnote label="3">Test cases using a free dative pronoun may be in the test-</footnote><doubt alpha="50.0" length="22" tooSmall="False" monospace="0.0">PPstd =&gt;    Pprae4-=t:</doubt><doubt alpha="56.2" length="16" tooSmall="False" monospace="0.0">NPstd4-=(f OBJ);</doubt><doubt alpha="45.5" length="22" tooSmall="False" monospace="0.0">{ e DISJUNCT-011 € o*;</doubt><p><b>I </b>Pcircum 4-=t:</p><doubt alpha="60.5" length="38" tooSmall="False" monospace="0.0">DISJUNCT-012 € o* "unused disjunct"; }</doubt><figure caption="Figure 3: Appropriate untested disjunct"></figure><doubt alpha="36.8" length="38" tooSmall="False" monospace="0.0">ADVP =&gt;    {    { e DISJUNCT-021 € o*;</doubt><p><b>I </b>ADVadj 4=f</p><doubt alpha="60.5" length="38" tooSmall="False" monospace="0.0">DISJUNCT-022 € o* "unused disjunct"; }</doubt><p>ADVstd 4=f</p><doubt alpha="60.5" length="38" tooSmall="False" monospace="0.0">DISJUNCT-023 € o* "unused disjunct"; }</doubt><doubt alpha="10.0" length="10" tooSmall="True" monospace="0.0">I     - }•</doubt><figure caption="Figure 4: Inappropriate disjunct4.2   Testsuite Economy"></figure><p>Besides being complete, a testsuite must be econom­ical, i.e., contain as few items as possible. Instru­mentation can identify redundant test cases, where redundancy can be defined in three ways:</p><p><b>similarity </b>There is a set of other test cases which jointly exercise all disjunct which the test case under consideration exercises.</p><p><b>equivalence </b>There is a single test case which ex­ercises exactly the same combination (s) of dis­juncts.</p><p><b>strict equivalence </b>There is a single test case which is equivalent to and, additionally, exer­cises the disjuncts exactly as often as, the test case under consideration.</p><p>Fig.6 shows equivalent test cases found in our testsuite: Example 1 illustrates the distinction be­tween equivalence and strict equivalence; the test cases contain different numbers of attributive adjec­tives. Example 2 shows that our grammar does not make any distinction between adverbial usage and secondary (subject or object) predication.</p><p>The reduction we achieved in size and processing time is shown in Table 1, which contains measure­ments for a test run containing only the parseable test cases, one without equivalent test cases (for ev­ery set of equivalent test cases, one was arbitrar­ily selected), and one without similar test cases. The last was constructed using a simple heuristic: Starting with the sentence exercising the most dis­juncts, working towards sentences relying on fewer disjuncts, a sentence was selected only if it exercised a disjunct which no previously selected sentence ex­ercised. Assuming that a disjunct working correctly suite, but receive no analysis since the grammatical function PREEDAT is not defined as such in the configuration section.</p><page local="4"/><doubt alpha="10.0" length="10" tooSmall="True" monospace="0.0">I     - }•</doubt><doubt alpha="100.0" length="6" tooSmall="False" monospace="0.0">VPargs</doubt><doubt alpha="61.4" length="101" tooSmall="False" monospace="0.0">IPRONstd4.=(f FREEDAT)(4.CASE) = dat(4PRON-TYPE) = pers-.(tOBJ2) DISJUNCT-041 € o* "unused disjunct";</doubt><figure caption="Figure 5: Inconsistent disjunct"></figure><p>ein guter alter Wein ein guter alter trockener Wein</p><p><i>'a</i><i> good old (dry) wine'</i></p><p>Er ißt das Schnitzel roh.</p><p>Er ißt das Schnitzel nackt.</p><p>Er ißt das Schnitzel schnell.</p><p><b><i>'He </i></b><i>eats the schnitzel naked/raw/quickly.'</i></p><figure caption="Figure 6: Sets of equivalent test cases"></figure><p>once will work correctly more than once, we did not consider strict equivalence.</p><p>We envisage the following use of this redundancy-detection: There clearly are linguistic reasons to dis­tinguish all test cases in example 2, so they cannot simply be deleted from the testsuite. Rather, their equivalence indicates that the grammar is not yet perfect (or never will be, if it remains purely syn­tactic). Such equivalences could be interpreted as a reminder which linguistic distinctions need to be incorporated into the grammar. Thus, this level of redundancy may drive your grammar development agenda. The level of equivalence can be taken as a limited interaction test: These test cases repre­sent one complete selection of grammar disjuncts, and (given the grammar) there is nothing we can gain by checking a test case if an equivalent one was tested. Thus, this level of redundancy may be used for ensuring the quality of grammar changes prior to their incorporation into the production version of the grammar. The level of similarity- contains much less test cases, and does not test any (systematic) interaction between disjuncts. Thus, it may be used during development as a quick rule-of-thumb proce­dure detecting serious errors only.</p><p>Der Test fällt Die schlafen.</p><p>.eicht.</p><p>Man schlafen. Dieser schlafen. Ich schlafen. Der schlafen. Jeder schlafen. Derjenige schlafen. Jener schlafen. Keiner schlafen. Derselbe schlafen. Er schlafen. Irgendjemand schlafen.</p><p>Dieselbe schlafen. Das schlafen. Eines schlafen. Jede schlafen. Dieses schlafen. Eine schlafen. Meins schlafen. Dasjenige schlafen. Jedes schlafen. Diejenige schlafen. Jenes schlafen. Keines schlafen. Dasselbe schlafen.</p><figure caption="Figure 7: Sentences relying on suspicious disjunct"></figure><subsection number="4.3" title="Sources of Overgeneration"><p>To control overgeneration, appropriately marked un-grammatical sentences are important in every test-suite. Instrumentation as proposed here only looks at successful parses, but can still be applied in this context: If an ungrammatical test case receives an analysis, instrumentation informs us about the dis­juncts used in the incorrect analysis. One of these disjuncts must be incorrect, or the sentence would not have received a solution. We exploit this infor­mation by accumulation across the entire test suite, looking for disjuncts that appear in unusually high proportion in parseable ungrammatical test cases.</p><p>In this manner, six grammar disjuncts are singled out by the parseable ungrammatical test cases in the TSNLP testsuite. The most prominent disjunct appears in 26 sentences (listed in Fig.7), of which the top left group is indeed grammatical and the rest fall into two classes: A partial VP with object NP, interpreted as an imperative sentence (bottom left), and a weird interaction with the tokenizer in­correctly handling capitalization (right group).</p><p>Far from being conclusive, the similarity- of these sentences derived from a suspicious grammar dis­junct, and the clear relation of the sentences to only-two exactly specifiable grammar errors make it plau­sible that this approach is very promising in detect­ing the sources of overgeneration.</p></subsection><subsection number="4.4" title="Other Approaches to Testsuite Construction"><p>The delicacy of testsuite construction is acknowl­edged in (EAGLES, 1996, p.37). Although there are a number of efforts to construct reusable test-suites, none has to my knowledge explored how ex­isting grammars can be exploited.</p><p>Starting with (Flickinger et al., 1987), testsuites have been drawn up from a linguistic viewpoint, <i>in­formed by [the] study of linguistics and [reflecting] the grammatical issues that linguists have concerned themselves with </i>(Flickinger et al., 1987, p.4). Although the question is not explicitly addressed in (Balkan, 1994), all the testsuites reviewed there also seem to follow the same methodology.<page local="5"/> The TSNLP project (Lehmann and Oepen, 1996) and its succes­sor DiET (Netter et al., 1998), which built large mul­tilingual testsuites, likewise fall into this category.</p><table caption="Table 1: Reduction of Testsuites" class="main" frame="box" rules="all" border="0" regular="False"><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p></p></td><td class="cell"><p>test</p></td><td class="cell"><p>relative runtime</p></td><td class="cell"><p>relative</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p></p></td><td class="cell"><p>cases</p></td><td class="cell"><p>size</p></td><td class="cell"><p>(sec)</p></td><td class="cell"><p>runtime</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>TSNLP testsuite</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>parseable</p></td><td class="cell"><p>1093</p></td><td class="cell"><p>100%</p></td><td class="cell"><p>1537</p></td><td class="cell"><p>100%.</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>no equivalents</p></td><td class="cell"><p>783</p></td><td class="cell"><p>71%</p></td><td class="cell"><p>665.3</p></td><td class="cell"><p>43%.</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>no similar cases</p></td><td class="cell"><p>214</p></td><td class="cell"><p>19%</p></td><td class="cell"><p>128.5</p></td><td class="cell"><p>8%.</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p></p></td><td class="cell"><p>loca</p></td><td class="cell"><p>1 testsuite</p></td><td class="cell"><p></p></td><td class="cell"><p></p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>parseable</p></td><td class="cell"><p>1787</p></td><td class="cell"><p>100%.</p></td><td class="cell"><p>1213</p></td><td class="cell"><p>100%.</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>no equivalents</p></td><td class="cell"><p>1600</p></td><td class="cell"><p>89%</p></td><td class="cell"><p>899.5</p></td><td class="cell"><p>74%.</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>no similar cases</p></td><td class="cell"><p>331</p></td><td class="cell"><p>18%</p></td><td class="cell"><p>175.0</p></td><td class="cell"><p>14%.</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr></table><p>The use of corpora (with various levels of annota­tion) has been studied, but the recommendations are that much manual work is required to turn corpus examples into test cases (e.g., (Balkan and Fouvry, 1995)). The reason given is that corpus sentences neither contain linguistic phenomena in isolation, nor do they contain systematic variation. Corpora thus are used only as an inspiration.</p><p>(Oepen and Flickinger, 1998) stress the inter­dependence between application and testsuite, but don't comment on the relation between grammar and testsuite.</p></subsection></section><section number="5" title="Genre Adaptation"><p>A different application of instrumentation is the tai­loring of a general grammar to specific genres. All-purpose grammars are plagued by lexical and struc­tural ambiguity that leads to overly long runtimes. If this ambiguity could be limited, parsing efficiency would improve. Instrumenting a general grammar allows to automatically derive specialized subgram-mars based on sample corpora. This setup has sev­eral advantages: The larger the overlap between gen­res, the larger the portion of grammar development work that can be recycled. The all-purpose grammar is linguistically more interesting, because it requires an integrated concept, as opposed to several sepa­rate genre-specific grammars.</p><p>I will discuss two ways of improving the efficiency of parsing a sublanguage, given an all-purpose uni­fication grammar. The first consists in deleting un­used disjuncts, while the second uses a staged pars­ing process. The experiments are only sketched, to indicate the applicability of the instrumentation technique, and not to directly compete with other proposals on grammar specialization. For example, the work reported in (Rayner and Samuelsson, 1994; Samuelsson, 1994) differs from the one presented be­low in several aspects: They induce a grammar from a treebank, while I propose to annotate the gram­mar based on all solutions it produces. No criteria for tree decomposition and category specialization are needed here, and the standard parsing algorithm can be used. On the other hand, the efficiency gains are not as big as those reported by (Rayner and Samuelsson, 1994).</p></section><section number="5" title=".1 Restricting the Grammar"><p>Given a large sample of a genre, instrumentation al­lows you to determine the likely constructions of that genre.   Eliminating unused disjuncts allows faster</p><p>Descriptor Content Coverage</p><p>HC-DE Copier/Printer User Manual 89%</p><p>WHB Car Maintenance Instructions 76%</p><doubt alpha="61.5" length="39" tooSmall="False" monospace="0.0">NEWS News (5-30 words per sentence) 42%</doubt><p>NEWS-SC Verb-final subclauses from News 75%</p><table caption="Table 2: Corpora used for adaptation"></table><p>parsing due to a smaller grammar. An experiment was conducted with several corpora as detailed in Table 2. There was some effort to cover the corpus HC-DE, but no grammar development based on the other corpora. The NEWS-SC corpus is part the corpus of verb-final sentences used by (Beil et al., 1999).</p><p>A training set of 1000 sentences from each cor­pus was parsed with an instrumented <i>base gram­mar. </i>From the parsing results, the exercised gram­mar disjuncts were extracted and used to construct a corpus-specific <i>reduced grammar. </i>The reduced grammars were then used to parse a test set of an­other 1000 sentences from each corpus. Table 3 shows the performance improvement on the corpora: It gives the size of the grammars in terms of the number of rules (with regular expression right-hand sides and feature annotation), the number of arcs (corresponding to unary or binary rules with dis­junctive feature annotation), and the number of dis­juncts (unary or binary rules with unique feature annotation). The number of mismatches counts the sentences for which the solution (s) obtained differed from those obtained with the base grammar, while the number of additions counts the sentences which did not receive a parse with the base grammar due to resource limitations (runtime or memory), but re­ceived one with the reduced grammar. The other columns give timings to process the total corpus, and the longest and average processing time per sen­tence; time is in seconds. The last column gives the average number of solutions per sentence.</p><p>Due to the sampling of a genre, the grammars obtained can only be approximate. To determine the relation of the sample size to the quality of the grammar obtained, the coverage of random <i>fragment grammars </i>was measured in the following way: Ran­domly select a number of sentences from the to­tal corpus, construct (in the same way as described above for the reduced grammar) a fragment gram­mar, and determine its coverage on the test set from the respective corpus. The graphs in Fig.8 show how the coverage and runtime relate to the number of sentences on which the fragment grammars are based. The leftmost data point (x value 0) describes the performance of the reduced grammar on the training set, while the rightmost data point describes its performance on the test set. The data points in between represent fragment grammars based on as many sentences as given by the x axis value.<page local="6"/></p><doubt alpha="0.0" length="5" tooSmall="True" monospace="0.0">0 100</doubt><doubt alpha="0.0" length="19" tooSmall="True" monospace="0.0">200 300 400 500 600</doubt><doubt alpha="87.8" length="49" tooSmall="True" monospace="0.0">number of sentences used for grammar construction</doubt><doubt alpha="0.0" length="7" tooSmall="True" monospace="0.0">700 800</doubt><doubt alpha="0.0" length="27" tooSmall="True" monospace="0.0">200       300       400 500</doubt><figure caption="Figure 8: Performance of fragment grammars"></figure><p>The results reported here represent the minimal performance gain due to the fact that the construc­tion of reduced and fragment grammars are not based on the correct solutions for the training sen­tences, but rather on all solutions produced by the base grammar. The construction of a large-scale treebank with manually verified solutions is under way but has not yet progressed far enough to serve as input for this experiment. Even with this system­atic, but curable error, the reduction reduces overall processing by a factor of four. The number of solu­tions is constant because only unused disjuncts are eliminated; this will change if the treebank solutions are used to construct the reduced grammar.</p><subsection number="5.2" title="Staged Parsing"><p>Even eliminating only unlikely disjuncts necessarily reduces the coverage of the grammar. A sequence of parsing stages allows one to profit from a small and fast grammar as well as from a large and slow one. Staged parsing applies different grammars one after the other to the input, until one yields a solution, which terminates the process. In our case, a gram­mar of stage <i>n + </i>1 includes the grammar of stage <i>n, </i>but this need not be the case in general.</p><p>To reduce the variability for an experiment, I as­sume three stages: The first includes frequently used disjuncts, the second infrequent disjuncts, and the third unused disjuncts. This ensures the full cover­age of the base grammar, but allows to focus on fre­quent constructions in the first parsing stage. The procedure is similar as before: From the solutions of a training set, a <i>staged grammar </i>is constructed. Currently, experiments are performed to determine a useful definition of 'frequently used'. Independent from the actual performance gains finally obtained, the application of instrumentation allows a system­atic exploration of the possible configurations.</p></subsection><subsection number="5.3" title="Other approaches to grammar adaptation"><p>(Rayner and Samuelsson, 1994; Rayner and Carter, 1996; Samuelsson, 1994) present a grammar special­ization technique for unification grammars. From a treebank of the sublanguage, they induce a special­ized grammar using fewer <i>macro rules </i>which cor­respond to the application of several original rules. They report an average speed-up of 55 for only the parsing phase (taking lexical lookup into account, the speed-up factor was only 6-10). Due to the derivation of the grammar from a corpus sample, they observed a decrease in recall of 7.<page local="7"/>3% and an increase of precision of 1.6%. The differences to the approach described here are clear: Starting from the grammar, rather than from a treebank, we annotate the rules, rather than inducing them from scratch. We do not need criteria for tree decomposition and category specialization, and we can use the standard parsing algorithm. On the other hand, the efficiency gains are not as big as those reported by (Rayner and Carter, 1996) (but note that we cannot measure parsing times alone, so we need to compare to their speed-up factor of 10). And we did not (yet) start from a treebank, but from the raw set of solutions.</p><table caption="Table 3: Performance of reduced grammars" class="main" frame="box" rules="all" border="1" regular="False"><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p></p></td><td class="cell"><p># of rules</p><p># of arcs</p><p># of disjuncts</p></td><td class="cell"><p># of mismatches</p><p># of additions</p></td><td class="cell"><p>total time</p><p>max. time per sentence</p><p>avg. time per sentence</p><p>avg. solutions per sentence</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>Corpus HC-DE base grammar reduced grammar (938)</p></td><td class="cell"><p>185    3669 11564 112     960 3739</p></td><td class="cell"><p>n/a n/a 0 1</p></td><td class="cell"><p>7692.4      &gt;300      7.1 10.1 2089.4      162.7      1.9 17.6</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"><p>Corpus WHB base grammar reduced grammar (559)</p></td><td class="cell"><p>195    3728 11606 534 3072</p></td><td class="cell"><p>n/a 1</p></td><td class="cell"><p>1428.9    &gt;300.3 1.5 444.2        11.3 0.4</p></td><td class="cell"></td></tr><tr class="row"><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td><td class="cell"></td></tr></table></subsection></section><section number="6" title="Conclusion"><p>I have presented the adaptation of code instrumenta­tion to Grammar Engineering, discussing measures and implementations, and sketching several applica­tions together with preliminary results.</p><p>The main application is to improve grammar and testsuite by exploring the relation between both of them. Viewed this way, testsuite writing can ben­efit from grammar development because both de­scribe the syntactic constructions of a natural lan­guage. Testsuites systematically list these construc­tions, while grammars give generative procedures to construct them. Since there are currently many-more grammars than testsuites, we may re-use the work that has gone into the grammars for the im­provement of testsuites.</p><p>Other applications of instrumentation are possi­ble; genre adaptation was discussed in some depth. On a more general level, one may ask whether other methods from SE may fruitfully apply to GE as well, possibly in modified form. For example, the static analysis of programs, e.g., detection of unreachable code, could also be applied for grammar develop­ment to detect unusable rules.</p><doubt alpha="33.3" length="18" tooSmall="False" monospace="0.0">f^j6 f61* 6 n C 6s</doubt><p>L. Balkan and F. Fouvry. 1995. <i>Corpus-based test suite generation. </i>TSNLP-WP 2.2, University- of Essex.</p><p>L. et al. Balkan. 1994. <i>Test Suite Design Annotation Scheme. </i>TSNLP-WP2.2, University- of Essex.</p><p>F. Beil, G. Carroll, D. Prescher, S. Riezler, and M. Rooth. 1999. Inside-outside estimation of a lexicalized PCFG for german. In <i>Proc. 37th An­nual Meeting of the ACL. </i>Maryland.</p><p>F. Ciravegna, A. Lavelli, D. Petrelli, and F. Pianesi. 1998. Developing language reesources and appli­cations with GEPPETTO. In <i>Proc. 1st Int'l Conf. on Language Resources and Evaluation, </i>pages 619-625. Granada/Spain, 28-30 May 1998.</p><p>EAGLES. 1996. <i>Evaluation of Natural Language Processing Systems. </i>Final Report EAG-EWG-PR.2.</p><p>D. Flickinger, J. Nerbonne, I. Sag, and T. Wa-sow. 1987. <i>Toward Evaluation of NLP Systems. </i>Hewlett-Packard Laboratories, Palo Alto/CA.</p><p>A. Frank, T.H. King, J. Kuhn, and J. Maxwell. 1998. Optimality theory style constraint rank­ing in large-scale LFG grammar. In <i>Proc. of the LFG98 Conference. </i>Brisbane/AUS, Aug 1998, CSLI Online Publications.</p><p>W.C. Hetzel. 1988. <i>The complete guide to software testing. </i>QED Information Sciences, Inc. Welles-ley/MA 02181.</p><p>R.M. Kaplan and J. Bresnan. 1982. Lexical-functional grammar: A formal system for gram­matical representation. In J. Bresnan and R.M. Kaplan, editors, <i>The Mental Representation of Grammatical Relations, </i>pages 173-281. Cam­bridge, MA: MIT Press.</p><p>S. Lehmann and S. Oepen. 1996. Tsnlp - test suites for natural language processing. In <i>Proc. 16th Int'l Conf. on Computational Linguistics, </i>pages 711-716. Copenhagen/DK.</p><p>K. Netter, S. Armstrong, T. Kiss, J. Klein, and S. Lehman. 1998. Diet - diagnostic and eval­uation tools for nip applications. In <i>Proc. 1st Int'l Conf. on Language Resources and Evalua­tion, </i>pages 573-579. Granada/Spain, 28-30 May 1998.</p><p>S. Oepen and D.P. Flickinger. 1998. Towards sys­tematic grammar profiling:test suite techn. 10 years afte. <i>Journal of Computer Speech and Lan­guage, </i>12:411-435.</p><p>M. Rayner and D. Carter. 1996. Fast parsing us­ing pruning and grammar specialization. In <i>Proc. 34th Annual Meeting of the ACL. </i>Santa Cruz, USA.</p><p>M. Rayner and C. Samuelsson. 1994. Corpus-based grammar specialization for fast analysis. In M­S. Agnäs, H. Alshawi, I. Btrean, D. Carter, and K. Ceder, editors, <i>Spoken Language Translator: First-Year Report, </i>pages 41-54. Report CRC-043, Cambridge/UK: SRI International.</p><p>C. Samuelsson. 1994. Grammar spezialization through entropy thresholds. In <i>Proc. 32nd Annual Meeting of the ACL.</i></p></section></body></article>