001    package ch.uzh.ifi.attempto.acewiki.aceowl;
002    
003    import java.util.ArrayList;
004    import java.util.HashMap;
005    import java.util.List;
006    
007    import ch.uzh.ifi.attempto.chartparser.Annotation;
008    import ch.uzh.ifi.attempto.chartparser.Nonterminal;
009    import ch.uzh.ifi.attempto.chartparser.GrammarRule;
010    import ch.uzh.ifi.attempto.chartparser.LexicalRule;
011    import ch.uzh.ifi.attempto.chartparser.StringRef;
012    import ch.uzh.ifi.attempto.chartparser.Terminal;
013    import ch.uzh.ifi.attempto.chartparser.Preterminal;
014    import ch.uzh.ifi.attempto.chartparser.Category;
015    import ch.uzh.ifi.attempto.chartparser.BackrefCategory;
016    import ch.uzh.ifi.attempto.chartparser.FeatureMap;
017    
018    /**
019     * This grammar class is automatically generated on the basis of a file in Codeco notation.
020     *<p>
021     * For more information, see the Codeco package {@link ch.uzh.ifi.attempto.codeco} of the
022     * <a href="http://attempto.ifi.uzh.ch/acewiki/" target="_top">AceWiki</a> system and the thesis
023     * "<a href="http://attempto.ifi.uzh.ch/site/pubs/papers/doctoral_thesis_kuhn.pdf">Controlled
024     * English for Knowledge Representation</a>".
025     */
026    @SuppressWarnings("all")
027    public class ACEGrammar extends ch.uzh.ifi.attempto.chartparser.Grammar {
028    
029            public static final ACEGrammar grammar = new ACEGrammar();
030            
031            /**
032             * Creates a new grammar object.
033             */
034            public ACEGrammar() {
035                    List<Category> l = new ArrayList<Category>();
036                    Terminal term;
037                    Nonterminal nonterm;
038                    Preterminal preterm;
039                    BackrefCategory brefcat;
040                    FeatureMap fm;
041                    HashMap<Integer, StringRef> featureHash = new HashMap<Integer, StringRef>();
042                    Annotation ann;
043                    
044                    
045                    /* === AceWiki Grammar === */
046                    
047                    /* - Tobias Kuhn, 10 December 2010 - */
048                    
049                    /* Below, the grammar rules of the AceWiki grammar are shown: */
050                    
051                    
052                    /* --- Texts and Sentences --- */
053                    
054                    /* 'text' stands for a complete text consisting of an arbitrary number of complete
055                    sentences (including zero): */
056                    
057                    // text=>[]
058                    l.clear();
059                    featureHash.clear();
060                    ann = new Annotation();
061                    nonterm = new Nonterminal("text");
062                    fm = new FeatureMap();
063                    nonterm.setFeatureMap(fm);
064                    l.add(nonterm);
065                    addGrammarRule(new GrammarRule(ann, l, false));
066                    
067                    // text=>complete_sentence, text
068                    l.clear();
069                    featureHash.clear();
070                    ann = new Annotation();
071                    nonterm = new Nonterminal("text");
072                    fm = new FeatureMap();
073                    nonterm.setFeatureMap(fm);
074                    l.add(nonterm);
075                    nonterm = new Nonterminal("complete_sentence");
076                    fm = new FeatureMap();
077                    nonterm.setFeatureMap(fm);
078                    l.add(nonterm);
079                    nonterm = new Nonterminal("text");
080                    fm = new FeatureMap();
081                    nonterm.setFeatureMap(fm);
082                    l.add(nonterm);
083                    addGrammarRule(new GrammarRule(ann, l, false));
084                    
085                    /* A complete sentence is represented by the category 'complete_sentence' and is either
086                    a declarative sentence that ends with a full stop or a question ending with a question mark: */
087                    
088                    // complete_sentence~> //, sentence, ['.']
089                    l.clear();
090                    featureHash.clear();
091                    ann = new Annotation();
092                    nonterm = new Nonterminal("complete_sentence");
093                    fm = new FeatureMap();
094                    nonterm.setFeatureMap(fm);
095                    l.add(nonterm);
096                    nonterm = new Nonterminal("//");
097                    fm = new FeatureMap();
098                    nonterm.setFeatureMap(fm);
099                    l.add(nonterm);
100                    nonterm = new Nonterminal("sentence");
101                    fm = new FeatureMap();
102                    nonterm.setFeatureMap(fm);
103                    l.add(nonterm);
104                    term = new Terminal(".");
105                    l.add(term);
106                    addGrammarRule(new GrammarRule(ann, l, true));
107                    
108                    // complete_sentence~> //, simple_sentence_2(qu:plus, whin:minus, whout:plus), [?]
109                    l.clear();
110                    featureHash.clear();
111                    ann = new Annotation();
112                    nonterm = new Nonterminal("complete_sentence");
113                    fm = new FeatureMap();
114                    nonterm.setFeatureMap(fm);
115                    l.add(nonterm);
116                    nonterm = new Nonterminal("//");
117                    fm = new FeatureMap();
118                    nonterm.setFeatureMap(fm);
119                    l.add(nonterm);
120                    nonterm = new Nonterminal("simple_sentence_2");
121                    fm = new FeatureMap();
122                    fm.setFeature("qu", new StringRef("plus"));
123                    fm.setFeature("whin", new StringRef("minus"));
124                    fm.setFeature("whout", new StringRef("plus"));
125                    nonterm.setFeatureMap(fm);
126                    l.add(nonterm);
127                    term = new Terminal("?");
128                    l.add(term);
129                    addGrammarRule(new GrammarRule(ann, l, true));
130                    
131                    /* General sentences are represented by 'sentence': */
132                    
133                    // sentence=>sentence_coord_1
134                    l.clear();
135                    featureHash.clear();
136                    ann = new Annotation();
137                    nonterm = new Nonterminal("sentence");
138                    fm = new FeatureMap();
139                    nonterm.setFeatureMap(fm);
140                    l.add(nonterm);
141                    nonterm = new Nonterminal("sentence_coord_1");
142                    fm = new FeatureMap();
143                    nonterm.setFeatureMap(fm);
144                    l.add(nonterm);
145                    addGrammarRule(new GrammarRule(ann, l, false));
146                    
147                    // sentence~> //, ['for every'], nc(subj:minus, qu:minus), sentence_coord_1
148                    l.clear();
149                    featureHash.clear();
150                    ann = new Annotation();
151                    nonterm = new Nonterminal("sentence");
152                    fm = new FeatureMap();
153                    nonterm.setFeatureMap(fm);
154                    l.add(nonterm);
155                    nonterm = new Nonterminal("//");
156                    fm = new FeatureMap();
157                    nonterm.setFeatureMap(fm);
158                    l.add(nonterm);
159                    term = new Terminal("for every");
160                    l.add(term);
161                    nonterm = new Nonterminal("nc");
162                    fm = new FeatureMap();
163                    fm.setFeature("subj", new StringRef("minus"));
164                    fm.setFeature("qu", new StringRef("minus"));
165                    nonterm.setFeatureMap(fm);
166                    l.add(nonterm);
167                    nonterm = new Nonterminal("sentence_coord_1");
168                    fm = new FeatureMap();
169                    nonterm.setFeatureMap(fm);
170                    l.add(nonterm);
171                    addGrammarRule(new GrammarRule(ann, l, true));
172                    
173                    // sentence~> //, [if], sentence_coord_1, [then], sentence_coord_1
174                    l.clear();
175                    featureHash.clear();
176                    ann = new Annotation();
177                    nonterm = new Nonterminal("sentence");
178                    fm = new FeatureMap();
179                    nonterm.setFeatureMap(fm);
180                    l.add(nonterm);
181                    nonterm = new Nonterminal("//");
182                    fm = new FeatureMap();
183                    nonterm.setFeatureMap(fm);
184                    l.add(nonterm);
185                    term = new Terminal("if");
186                    l.add(term);
187                    nonterm = new Nonterminal("sentence_coord_1");
188                    fm = new FeatureMap();
189                    nonterm.setFeatureMap(fm);
190                    l.add(nonterm);
191                    term = new Terminal("then");
192                    l.add(term);
193                    nonterm = new Nonterminal("sentence_coord_1");
194                    fm = new FeatureMap();
195                    nonterm.setFeatureMap(fm);
196                    l.add(nonterm);
197                    addGrammarRule(new GrammarRule(ann, l, true));
198                    
199                    /* Sentences can be coordinated using "or" ('sentence_coord_1') and "and"
200                    ('sentence_coord_2'): */
201                    
202                    // sentence_coord_1=>sentence_coord_2
203                    l.clear();
204                    featureHash.clear();
205                    ann = new Annotation();
206                    nonterm = new Nonterminal("sentence_coord_1");
207                    fm = new FeatureMap();
208                    nonterm.setFeatureMap(fm);
209                    l.add(nonterm);
210                    nonterm = new Nonterminal("sentence_coord_2");
211                    fm = new FeatureMap();
212                    nonterm.setFeatureMap(fm);
213                    l.add(nonterm);
214                    addGrammarRule(new GrammarRule(ann, l, false));
215                    
216                    // sentence_coord_1~> //, sentence_coord_2, [or], sentence_coord_1
217                    l.clear();
218                    featureHash.clear();
219                    ann = new Annotation();
220                    nonterm = new Nonterminal("sentence_coord_1");
221                    fm = new FeatureMap();
222                    nonterm.setFeatureMap(fm);
223                    l.add(nonterm);
224                    nonterm = new Nonterminal("//");
225                    fm = new FeatureMap();
226                    nonterm.setFeatureMap(fm);
227                    l.add(nonterm);
228                    nonterm = new Nonterminal("sentence_coord_2");
229                    fm = new FeatureMap();
230                    nonterm.setFeatureMap(fm);
231                    l.add(nonterm);
232                    term = new Terminal("or");
233                    l.add(term);
234                    nonterm = new Nonterminal("sentence_coord_1");
235                    fm = new FeatureMap();
236                    nonterm.setFeatureMap(fm);
237                    l.add(nonterm);
238                    addGrammarRule(new GrammarRule(ann, l, true));
239                    
240                    // sentence_coord_2=>simple_sentence_1
241                    l.clear();
242                    featureHash.clear();
243                    ann = new Annotation();
244                    nonterm = new Nonterminal("sentence_coord_2");
245                    fm = new FeatureMap();
246                    nonterm.setFeatureMap(fm);
247                    l.add(nonterm);
248                    nonterm = new Nonterminal("simple_sentence_1");
249                    fm = new FeatureMap();
250                    nonterm.setFeatureMap(fm);
251                    l.add(nonterm);
252                    addGrammarRule(new GrammarRule(ann, l, false));
253                    
254                    // sentence_coord_2=>simple_sentence_1, [and], sentence_coord_2
255                    l.clear();
256                    featureHash.clear();
257                    ann = new Annotation();
258                    nonterm = new Nonterminal("sentence_coord_2");
259                    fm = new FeatureMap();
260                    nonterm.setFeatureMap(fm);
261                    l.add(nonterm);
262                    nonterm = new Nonterminal("simple_sentence_1");
263                    fm = new FeatureMap();
264                    nonterm.setFeatureMap(fm);
265                    l.add(nonterm);
266                    term = new Terminal("and");
267                    l.add(term);
268                    nonterm = new Nonterminal("sentence_coord_2");
269                    fm = new FeatureMap();
270                    nonterm.setFeatureMap(fm);
271                    l.add(nonterm);
272                    addGrammarRule(new GrammarRule(ann, l, false));
273                    
274                    /* Uncoordinated sentences are represented in two levels by 'simple_sentence_1' and
275                    'simple_sentence_2': */
276                    
277                    // simple_sentence_1~> //, ['it is false that'], simple_sentence_2(qu:minus)
278                    l.clear();
279                    featureHash.clear();
280                    ann = new Annotation();
281                    nonterm = new Nonterminal("simple_sentence_1");
282                    fm = new FeatureMap();
283                    nonterm.setFeatureMap(fm);
284                    l.add(nonterm);
285                    nonterm = new Nonterminal("//");
286                    fm = new FeatureMap();
287                    nonterm.setFeatureMap(fm);
288                    l.add(nonterm);
289                    term = new Terminal("it is false that");
290                    l.add(term);
291                    nonterm = new Nonterminal("simple_sentence_2");
292                    fm = new FeatureMap();
293                    fm.setFeature("qu", new StringRef("minus"));
294                    nonterm.setFeatureMap(fm);
295                    l.add(nonterm);
296                    addGrammarRule(new GrammarRule(ann, l, true));
297                    
298                    // simple_sentence_1=>['there is'], np(subj:minus, exist:plus, def:minus, pl:minus, case:nom, qu:minus)
299                    l.clear();
300                    featureHash.clear();
301                    ann = new Annotation();
302                    nonterm = new Nonterminal("simple_sentence_1");
303                    fm = new FeatureMap();
304                    nonterm.setFeatureMap(fm);
305                    l.add(nonterm);
306                    term = new Terminal("there is");
307                    l.add(term);
308                    nonterm = new Nonterminal("np");
309                    fm = new FeatureMap();
310                    fm.setFeature("subj", new StringRef("minus"));
311                    fm.setFeature("exist", new StringRef("plus"));
312                    fm.setFeature("def", new StringRef("minus"));
313                    fm.setFeature("pl", new StringRef("minus"));
314                    fm.setFeature("case", new StringRef("nom"));
315                    fm.setFeature("qu", new StringRef("minus"));
316                    nonterm.setFeatureMap(fm);
317                    l.add(nonterm);
318                    addGrammarRule(new GrammarRule(ann, l, false));
319                    
320                    // simple_sentence_1=>['there is'], np(subj:minus, exist:plus, def:minus, pl:minus, case:nom, qu:minus), ['such that'], simple_sentence_1
321                    l.clear();
322                    featureHash.clear();
323                    ann = new Annotation();
324                    nonterm = new Nonterminal("simple_sentence_1");
325                    fm = new FeatureMap();
326                    nonterm.setFeatureMap(fm);
327                    l.add(nonterm);
328                    term = new Terminal("there is");
329                    l.add(term);
330                    nonterm = new Nonterminal("np");
331                    fm = new FeatureMap();
332                    fm.setFeature("subj", new StringRef("minus"));
333                    fm.setFeature("exist", new StringRef("plus"));
334                    fm.setFeature("def", new StringRef("minus"));
335                    fm.setFeature("pl", new StringRef("minus"));
336                    fm.setFeature("case", new StringRef("nom"));
337                    fm.setFeature("qu", new StringRef("minus"));
338                    nonterm.setFeatureMap(fm);
339                    l.add(nonterm);
340                    term = new Terminal("such that");
341                    l.add(term);
342                    nonterm = new Nonterminal("simple_sentence_1");
343                    fm = new FeatureMap();
344                    nonterm.setFeatureMap(fm);
345                    l.add(nonterm);
346                    addGrammarRule(new GrammarRule(ann, l, false));
347                    
348                    // simple_sentence_1=>['there are'], np(subj:minus, exist:plus, def:minus, pl:plus, case:nom, qu:minus)
349                    l.clear();
350                    featureHash.clear();
351                    ann = new Annotation();
352                    nonterm = new Nonterminal("simple_sentence_1");
353                    fm = new FeatureMap();
354                    nonterm.setFeatureMap(fm);
355                    l.add(nonterm);
356                    term = new Terminal("there are");
357                    l.add(term);
358                    nonterm = new Nonterminal("np");
359                    fm = new FeatureMap();
360                    fm.setFeature("subj", new StringRef("minus"));
361                    fm.setFeature("exist", new StringRef("plus"));
362                    fm.setFeature("def", new StringRef("minus"));
363                    fm.setFeature("pl", new StringRef("plus"));
364                    fm.setFeature("case", new StringRef("nom"));
365                    fm.setFeature("qu", new StringRef("minus"));
366                    nonterm.setFeatureMap(fm);
367                    l.add(nonterm);
368                    addGrammarRule(new GrammarRule(ann, l, false));
369                    
370                    // simple_sentence_1=>simple_sentence_2(qu:minus)
371                    l.clear();
372                    featureHash.clear();
373                    ann = new Annotation();
374                    nonterm = new Nonterminal("simple_sentence_1");
375                    fm = new FeatureMap();
376                    nonterm.setFeatureMap(fm);
377                    l.add(nonterm);
378                    nonterm = new Nonterminal("simple_sentence_2");
379                    fm = new FeatureMap();
380                    fm.setFeature("qu", new StringRef("minus"));
381                    nonterm.setFeatureMap(fm);
382                    l.add(nonterm);
383                    addGrammarRule(new GrammarRule(ann, l, false));
384                    
385                    // simple_sentence_2(qu:A, whin:B, whout:C)~>np(id:D, subj:minus, pl:E, plquant:F, case:nom, qu:A, whin:B, whout:G), vp_coord_1(subj:D, pl:E, plquant:F, qu:A, whin:G, whout:C)
386                    l.clear();
387                    featureHash.clear();
388                    ann = new Annotation();
389                    nonterm = new Nonterminal("simple_sentence_2");
390                    fm = new FeatureMap();
391                    setFeature(fm, "qu", 0, featureHash);
392                    setFeature(fm, "whin", 1, featureHash);
393                    setFeature(fm, "whout", 2, featureHash);
394                    nonterm.setFeatureMap(fm);
395                    l.add(nonterm);
396                    nonterm = new Nonterminal("np");
397                    fm = new FeatureMap();
398                    setFeature(fm, "id", 3, featureHash);
399                    fm.setFeature("subj", new StringRef("minus"));
400                    setFeature(fm, "pl", 4, featureHash);
401                    setFeature(fm, "plquant", 5, featureHash);
402                    fm.setFeature("case", new StringRef("nom"));
403                    setFeature(fm, "qu", 0, featureHash);
404                    setFeature(fm, "whin", 1, featureHash);
405                    setFeature(fm, "whout", 6, featureHash);
406                    nonterm.setFeatureMap(fm);
407                    l.add(nonterm);
408                    nonterm = new Nonterminal("vp_coord_1");
409                    fm = new FeatureMap();
410                    setFeature(fm, "subj", 3, featureHash);
411                    setFeature(fm, "pl", 4, featureHash);
412                    setFeature(fm, "plquant", 5, featureHash);
413                    setFeature(fm, "qu", 0, featureHash);
414                    setFeature(fm, "whin", 6, featureHash);
415                    setFeature(fm, "whout", 2, featureHash);
416                    nonterm.setFeatureMap(fm);
417                    l.add(nonterm);
418                    addGrammarRule(new GrammarRule(ann, l, true));
419                    
420                    
421                    /* --- Verb Phrases --- */
422                    
423                    /* Like sentences, verb phrases can be coordinated using "or" ('vp_coord_1') and "and"
424                    ('vp_coord_2'): */
425                    
426                    // vp_coord_1(subj:A, pl:B, plquant:C, qu:D, whin:E, whout:F)=>vp_coord_2(subj:A, pl:B, plquant:C, qu:D, whin:E, whout:F)
427                    l.clear();
428                    featureHash.clear();
429                    ann = new Annotation();
430                    nonterm = new Nonterminal("vp_coord_1");
431                    fm = new FeatureMap();
432                    setFeature(fm, "subj", 0, featureHash);
433                    setFeature(fm, "pl", 1, featureHash);
434                    setFeature(fm, "plquant", 2, featureHash);
435                    setFeature(fm, "qu", 3, featureHash);
436                    setFeature(fm, "whin", 4, featureHash);
437                    setFeature(fm, "whout", 5, featureHash);
438                    nonterm.setFeatureMap(fm);
439                    l.add(nonterm);
440                    nonterm = new Nonterminal("vp_coord_2");
441                    fm = new FeatureMap();
442                    setFeature(fm, "subj", 0, featureHash);
443                    setFeature(fm, "pl", 1, featureHash);
444                    setFeature(fm, "plquant", 2, featureHash);
445                    setFeature(fm, "qu", 3, featureHash);
446                    setFeature(fm, "whin", 4, featureHash);
447                    setFeature(fm, "whout", 5, featureHash);
448                    nonterm.setFeatureMap(fm);
449                    l.add(nonterm);
450                    addGrammarRule(new GrammarRule(ann, l, false));
451                    
452                    // vp_coord_1(subj:A, pl:B, plquant:C, qu:D, whin:E, whout:F)~> //, vp_coord_2(subj:A, pl:B, plquant:C, qu:D, whin:E, whout:G), [or], vp_coord_1(subj:A, pl:B, plquant:C, qu:D, whin:G, whout:F)
453                    l.clear();
454                    featureHash.clear();
455                    ann = new Annotation();
456                    nonterm = new Nonterminal("vp_coord_1");
457                    fm = new FeatureMap();
458                    setFeature(fm, "subj", 0, featureHash);
459                    setFeature(fm, "pl", 1, featureHash);
460                    setFeature(fm, "plquant", 2, featureHash);
461                    setFeature(fm, "qu", 3, featureHash);
462                    setFeature(fm, "whin", 4, featureHash);
463                    setFeature(fm, "whout", 5, featureHash);
464                    nonterm.setFeatureMap(fm);
465                    l.add(nonterm);
466                    nonterm = new Nonterminal("//");
467                    fm = new FeatureMap();
468                    nonterm.setFeatureMap(fm);
469                    l.add(nonterm);
470                    nonterm = new Nonterminal("vp_coord_2");
471                    fm = new FeatureMap();
472                    setFeature(fm, "subj", 0, featureHash);
473                    setFeature(fm, "pl", 1, featureHash);
474                    setFeature(fm, "plquant", 2, featureHash);
475                    setFeature(fm, "qu", 3, featureHash);
476                    setFeature(fm, "whin", 4, featureHash);
477                    setFeature(fm, "whout", 6, featureHash);
478                    nonterm.setFeatureMap(fm);
479                    l.add(nonterm);
480                    term = new Terminal("or");
481                    l.add(term);
482                    nonterm = new Nonterminal("vp_coord_1");
483                    fm = new FeatureMap();
484                    setFeature(fm, "subj", 0, featureHash);
485                    setFeature(fm, "pl", 1, featureHash);
486                    setFeature(fm, "plquant", 2, featureHash);
487                    setFeature(fm, "qu", 3, featureHash);
488                    setFeature(fm, "whin", 6, featureHash);
489                    setFeature(fm, "whout", 5, featureHash);
490                    nonterm.setFeatureMap(fm);
491                    l.add(nonterm);
492                    addGrammarRule(new GrammarRule(ann, l, true));
493                    
494                    // vp_coord_2(subj:A, pl:B, plquant:C, qu:D, whin:E, whout:F)=>vp(subj:A, pl:B, plquant:C, qu:D, whin:E, whout:F)
495                    l.clear();
496                    featureHash.clear();
497                    ann = new Annotation();
498                    nonterm = new Nonterminal("vp_coord_2");
499                    fm = new FeatureMap();
500                    setFeature(fm, "subj", 0, featureHash);
501                    setFeature(fm, "pl", 1, featureHash);
502                    setFeature(fm, "plquant", 2, featureHash);
503                    setFeature(fm, "qu", 3, featureHash);
504                    setFeature(fm, "whin", 4, featureHash);
505                    setFeature(fm, "whout", 5, featureHash);
506                    nonterm.setFeatureMap(fm);
507                    l.add(nonterm);
508                    nonterm = new Nonterminal("vp");
509                    fm = new FeatureMap();
510                    setFeature(fm, "subj", 0, featureHash);
511                    setFeature(fm, "pl", 1, featureHash);
512                    setFeature(fm, "plquant", 2, featureHash);
513                    setFeature(fm, "qu", 3, featureHash);
514                    setFeature(fm, "whin", 4, featureHash);
515                    setFeature(fm, "whout", 5, featureHash);
516                    nonterm.setFeatureMap(fm);
517                    l.add(nonterm);
518                    addGrammarRule(new GrammarRule(ann, l, false));
519                    
520                    // vp_coord_2(subj:A, pl:B, plquant:C, qu:D, whin:E, whout:F)=>vp(subj:A, pl:B, plquant:C, qu:D, whin:E, whout:G), [and], vp_coord_2(subj:A, pl:B, plquant:C, qu:D, whin:G, whout:F)
521                    l.clear();
522                    featureHash.clear();
523                    ann = new Annotation();
524                    nonterm = new Nonterminal("vp_coord_2");
525                    fm = new FeatureMap();
526                    setFeature(fm, "subj", 0, featureHash);
527                    setFeature(fm, "pl", 1, featureHash);
528                    setFeature(fm, "plquant", 2, featureHash);
529                    setFeature(fm, "qu", 3, featureHash);
530                    setFeature(fm, "whin", 4, featureHash);
531                    setFeature(fm, "whout", 5, featureHash);
532                    nonterm.setFeatureMap(fm);
533                    l.add(nonterm);
534                    nonterm = new Nonterminal("vp");
535                    fm = new FeatureMap();
536                    setFeature(fm, "subj", 0, featureHash);
537                    setFeature(fm, "pl", 1, featureHash);
538                    setFeature(fm, "plquant", 2, featureHash);
539                    setFeature(fm, "qu", 3, featureHash);
540                    setFeature(fm, "whin", 4, featureHash);
541                    setFeature(fm, "whout", 6, featureHash);
542                    nonterm.setFeatureMap(fm);
543                    l.add(nonterm);
544                    term = new Terminal("and");
545                    l.add(term);
546                    nonterm = new Nonterminal("vp_coord_2");
547                    fm = new FeatureMap();
548                    setFeature(fm, "subj", 0, featureHash);
549                    setFeature(fm, "pl", 1, featureHash);
550                    setFeature(fm, "plquant", 2, featureHash);
551                    setFeature(fm, "qu", 3, featureHash);
552                    setFeature(fm, "whin", 6, featureHash);
553                    setFeature(fm, "whout", 5, featureHash);
554                    nonterm.setFeatureMap(fm);
555                    l.add(nonterm);
556                    addGrammarRule(new GrammarRule(ann, l, false));
557                    
558                    /* Uncoordinated verb phrases represented by 'vp' can use an auxiliary verb: */
559                    
560                    // vp(subj:A, exist:B, rel:C, pl:D, plquant:E, qu:F, whin:G, whout:H)~>aux(be:I, exist:B, pl:D), v(subj:A, be:I, exist:B, pl:D, plquant:E, rel:C, vform:inf, qu:F, whin:G, whout:H)
561                    l.clear();
562                    featureHash.clear();
563                    ann = new Annotation();
564                    nonterm = new Nonterminal("vp");
565                    fm = new FeatureMap();
566                    setFeature(fm, "subj", 0, featureHash);
567                    setFeature(fm, "exist", 1, featureHash);
568                    setFeature(fm, "rel", 2, featureHash);
569                    setFeature(fm, "pl", 3, featureHash);
570                    setFeature(fm, "plquant", 4, featureHash);
571                    setFeature(fm, "qu", 5, featureHash);
572                    setFeature(fm, "whin", 6, featureHash);
573                    setFeature(fm, "whout", 7, featureHash);
574                    nonterm.setFeatureMap(fm);
575                    l.add(nonterm);
576                    nonterm = new Nonterminal("aux");
577                    fm = new FeatureMap();
578                    setFeature(fm, "be", 8, featureHash);
579                    setFeature(fm, "exist", 1, featureHash);
580                    setFeature(fm, "pl", 3, featureHash);
581                    nonterm.setFeatureMap(fm);
582                    l.add(nonterm);
583                    nonterm = new Nonterminal("v");
584                    fm = new FeatureMap();
585                    setFeature(fm, "subj", 0, featureHash);
586                    setFeature(fm, "be", 8, featureHash);
587                    setFeature(fm, "exist", 1, featureHash);
588                    setFeature(fm, "pl", 3, featureHash);
589                    setFeature(fm, "plquant", 4, featureHash);
590                    setFeature(fm, "rel", 2, featureHash);
591                    fm.setFeature("vform", new StringRef("inf"));
592                    setFeature(fm, "qu", 5, featureHash);
593                    setFeature(fm, "whin", 6, featureHash);
594                    setFeature(fm, "whout", 7, featureHash);
595                    nonterm.setFeatureMap(fm);
596                    l.add(nonterm);
597                    addGrammarRule(new GrammarRule(ann, l, true));
598                    
599                    // vp(subj:A, exist:plus, rel:B, pl:C, qu:D, whin:E, whout:F)~>v(subj:A, be:minus, exist:plus, pl:C, rel:B, vform:fin, qu:D, whin:E, whout:F)
600                    l.clear();
601                    featureHash.clear();
602                    ann = new Annotation();
603                    nonterm = new Nonterminal("vp");
604                    fm = new FeatureMap();
605                    setFeature(fm, "subj", 0, featureHash);
606                    fm.setFeature("exist", new StringRef("plus"));
607                    setFeature(fm, "rel", 1, featureHash);
608                    setFeature(fm, "pl", 2, featureHash);
609                    setFeature(fm, "qu", 3, featureHash);
610                    setFeature(fm, "whin", 4, featureHash);
611                    setFeature(fm, "whout", 5, featureHash);
612                    nonterm.setFeatureMap(fm);
613                    l.add(nonterm);
614                    nonterm = new Nonterminal("v");
615                    fm = new FeatureMap();
616                    setFeature(fm, "subj", 0, featureHash);
617                    fm.setFeature("be", new StringRef("minus"));
618                    fm.setFeature("exist", new StringRef("plus"));
619                    setFeature(fm, "pl", 2, featureHash);
620                    setFeature(fm, "rel", 1, featureHash);
621                    fm.setFeature("vform", new StringRef("fin"));
622                    setFeature(fm, "qu", 3, featureHash);
623                    setFeature(fm, "whin", 4, featureHash);
624                    setFeature(fm, "whout", 5, featureHash);
625                    nonterm.setFeatureMap(fm);
626                    l.add(nonterm);
627                    addGrammarRule(new GrammarRule(ann, l, true));
628                    
629                    /* The category 'v' represents the main verb or - if "be" is used as a copula verb - the
630                    complementing noun phrase or adjective complement: */
631                    
632                    // v(be:minus, exist:A, pl:B, vform:C, copula:minus, whin:D, whout:D)=>verb(vcat:itr, be:minus, pl:B, exist:A, vform:C)
633                    l.clear();
634                    featureHash.clear();
635                    ann = new Annotation();
636                    nonterm = new Nonterminal("v");
637                    fm = new FeatureMap();
638                    fm.setFeature("be", new StringRef("minus"));
639                    setFeature(fm, "exist", 0, featureHash);
640                    setFeature(fm, "pl", 1, featureHash);
641                    setFeature(fm, "vform", 2, featureHash);
642                    fm.setFeature("copula", new StringRef("minus"));
643                    setFeature(fm, "whin", 3, featureHash);
644                    setFeature(fm, "whout", 3, featureHash);
645                    nonterm.setFeatureMap(fm);
646                    l.add(nonterm);
647                    nonterm = new Nonterminal("verb");
648                    fm = new FeatureMap();
649                    fm.setFeature("vcat", new StringRef("itr"));
650                    fm.setFeature("be", new StringRef("minus"));
651                    setFeature(fm, "pl", 1, featureHash);
652                    setFeature(fm, "exist", 0, featureHash);
653                    setFeature(fm, "vform", 2, featureHash);
654                    nonterm.setFeatureMap(fm);
655                    l.add(nonterm);
656                    addGrammarRule(new GrammarRule(ann, l, false));
657                    
658                    // v(subj:A, be:minus, exist:B, rel:C, pl:D, vform:E, embv:F, copula:minus, qu:G, whin:H, whout:I)=>verb(vcat:tr, be:minus, pl:D, exist:B, vform:E), np(subj:A, rel:C, vcat:tr, embv:F, case:acc, qu:G, whin:H, whout:I)
659                    l.clear();
660                    featureHash.clear();
661                    ann = new Annotation();
662                    nonterm = new Nonterminal("v");
663                    fm = new FeatureMap();
664                    setFeature(fm, "subj", 0, featureHash);
665                    fm.setFeature("be", new StringRef("minus"));
666                    setFeature(fm, "exist", 1, featureHash);
667                    setFeature(fm, "rel", 2, featureHash);
668                    setFeature(fm, "pl", 3, featureHash);
669                    setFeature(fm, "vform", 4, featureHash);
670                    setFeature(fm, "embv", 5, featureHash);
671                    fm.setFeature("copula", new StringRef("minus"));
672                    setFeature(fm, "qu", 6, featureHash);
673                    setFeature(fm, "whin", 7, featureHash);
674                    setFeature(fm, "whout", 8, featureHash);
675                    nonterm.setFeatureMap(fm);
676                    l.add(nonterm);
677                    nonterm = new Nonterminal("verb");
678                    fm = new FeatureMap();
679                    fm.setFeature("vcat", new StringRef("tr"));
680                    fm.setFeature("be", new StringRef("minus"));
681                    setFeature(fm, "pl", 3, featureHash);
682                    setFeature(fm, "exist", 1, featureHash);
683                    setFeature(fm, "vform", 4, featureHash);
684                    nonterm.setFeatureMap(fm);
685                    l.add(nonterm);
686                    nonterm = new Nonterminal("np");
687                    fm = new FeatureMap();
688                    setFeature(fm, "subj", 0, featureHash);
689                    setFeature(fm, "rel", 2, featureHash);
690                    fm.setFeature("vcat", new StringRef("tr"));
691                    setFeature(fm, "embv", 5, featureHash);
692                    fm.setFeature("case", new StringRef("acc"));
693                    setFeature(fm, "qu", 6, featureHash);
694                    setFeature(fm, "whin", 7, featureHash);
695                    setFeature(fm, "whout", 8, featureHash);
696                    nonterm.setFeatureMap(fm);
697                    l.add(nonterm);
698                    addGrammarRule(new GrammarRule(ann, l, false));
699                    
700                    // v(subj:A, be:plus, rel:B, embv:C, copula:minus, qu:D, whin:E, whout:F)=>verb(vcat:tr, be:plus), np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:F)
701                    l.clear();
702                    featureHash.clear();
703                    ann = new Annotation();
704                    nonterm = new Nonterminal("v");
705                    fm = new FeatureMap();
706                    setFeature(fm, "subj", 0, featureHash);
707                    fm.setFeature("be", new StringRef("plus"));
708                    setFeature(fm, "rel", 1, featureHash);
709                    setFeature(fm, "embv", 2, featureHash);
710                    fm.setFeature("copula", new StringRef("minus"));
711                    setFeature(fm, "qu", 3, featureHash);
712                    setFeature(fm, "whin", 4, featureHash);
713                    setFeature(fm, "whout", 5, featureHash);
714                    nonterm.setFeatureMap(fm);
715                    l.add(nonterm);
716                    nonterm = new Nonterminal("verb");
717                    fm = new FeatureMap();
718                    fm.setFeature("vcat", new StringRef("tr"));
719                    fm.setFeature("be", new StringRef("plus"));
720                    nonterm.setFeatureMap(fm);
721                    l.add(nonterm);
722                    nonterm = new Nonterminal("np");
723                    fm = new FeatureMap();
724                    setFeature(fm, "subj", 0, featureHash);
725                    setFeature(fm, "rel", 1, featureHash);
726                    fm.setFeature("copula", new StringRef("minus"));
727                    setFeature(fm, "embv", 2, featureHash);
728                    fm.setFeature("case", new StringRef("acc"));
729                    setFeature(fm, "qu", 3, featureHash);
730                    setFeature(fm, "whin", 4, featureHash);
731                    setFeature(fm, "whout", 5, featureHash);
732                    nonterm.setFeatureMap(fm);
733                    l.add(nonterm);
734                    addGrammarRule(new GrammarRule(ann, l, false));
735                    
736                    // v(subj:A, be:plus, rel:B, embv:C, copula:plus, qu:D, whin:E, whout:F)=>np(subj:A, of:plus, rel:B, pl:minus, copula:plus, embv:C, case:acc, qu:D, whin:E, whout:F)
737                    l.clear();
738                    featureHash.clear();
739                    ann = new Annotation();
740                    nonterm = new Nonterminal("v");
741                    fm = new FeatureMap();
742                    setFeature(fm, "subj", 0, featureHash);
743                    fm.setFeature("be", new StringRef("plus"));
744                    setFeature(fm, "rel", 1, featureHash);
745                    setFeature(fm, "embv", 2, featureHash);
746                    fm.setFeature("copula", new StringRef("plus"));
747                    setFeature(fm, "qu", 3, featureHash);
748                    setFeature(fm, "whin", 4, featureHash);
749                    setFeature(fm, "whout", 5, featureHash);
750                    nonterm.setFeatureMap(fm);
751                    l.add(nonterm);
752                    nonterm = new Nonterminal("np");
753                    fm = new FeatureMap();
754                    setFeature(fm, "subj", 0, featureHash);
755                    fm.setFeature("of", new StringRef("plus"));
756                    setFeature(fm, "rel", 1, featureHash);
757                    fm.setFeature("pl", new StringRef("minus"));
758                    fm.setFeature("copula", new StringRef("plus"));
759                    setFeature(fm, "embv", 2, featureHash);
760                    fm.setFeature("case", new StringRef("acc"));
761                    setFeature(fm, "qu", 3, featureHash);
762                    setFeature(fm, "whin", 4, featureHash);
763                    setFeature(fm, "whout", 5, featureHash);
764                    nonterm.setFeatureMap(fm);
765                    l.add(nonterm);
766                    addGrammarRule(new GrammarRule(ann, l, false));
767                    
768                    // v(subj:A, be:plus, rel:B, plquant:minus, embv:C, copula:plus, qu:D, whin:E, whout:F)=>np(subj:A, of:minus, rel:B, pl:minus, copula:plus, embv:C, case:acc, qu:D, whin:E, whout:F)
769                    l.clear();
770                    featureHash.clear();
771                    ann = new Annotation();
772                    nonterm = new Nonterminal("v");
773                    fm = new FeatureMap();
774                    setFeature(fm, "subj", 0, featureHash);
775                    fm.setFeature("be", new StringRef("plus"));
776                    setFeature(fm, "rel", 1, featureHash);
777                    fm.setFeature("plquant", new StringRef("minus"));
778                    setFeature(fm, "embv", 2, featureHash);
779                    fm.setFeature("copula", new StringRef("plus"));
780                    setFeature(fm, "qu", 3, featureHash);
781                    setFeature(fm, "whin", 4, featureHash);
782                    setFeature(fm, "whout", 5, featureHash);
783                    nonterm.setFeatureMap(fm);
784                    l.add(nonterm);
785                    nonterm = new Nonterminal("np");
786                    fm = new FeatureMap();
787                    setFeature(fm, "subj", 0, featureHash);
788                    fm.setFeature("of", new StringRef("minus"));
789                    setFeature(fm, "rel", 1, featureHash);
790                    fm.setFeature("pl", new StringRef("minus"));
791                    fm.setFeature("copula", new StringRef("plus"));
792                    setFeature(fm, "embv", 2, featureHash);
793                    fm.setFeature("case", new StringRef("acc"));
794                    setFeature(fm, "qu", 3, featureHash);
795                    setFeature(fm, "whin", 4, featureHash);
796                    setFeature(fm, "whout", 5, featureHash);
797                    nonterm.setFeatureMap(fm);
798                    l.add(nonterm);
799                    addGrammarRule(new GrammarRule(ann, l, false));
800                    
801                    // v(subj:A, be:plus, rel:B, embv:C, copula:plus, qu:D, whin:E, whout:F)=> $tradj, np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:F)
802                    l.clear();
803                    featureHash.clear();
804                    ann = new Annotation();
805                    nonterm = new Nonterminal("v");
806                    fm = new FeatureMap();
807                    setFeature(fm, "subj", 0, featureHash);
808                    fm.setFeature("be", new StringRef("plus"));
809                    setFeature(fm, "rel", 1, featureHash);
810                    setFeature(fm, "embv", 2, featureHash);
811                    fm.setFeature("copula", new StringRef("plus"));
812                    setFeature(fm, "qu", 3, featureHash);
813                    setFeature(fm, "whin", 4, featureHash);
814                    setFeature(fm, "whout", 5, featureHash);
815                    nonterm.setFeatureMap(fm);
816                    l.add(nonterm);
817                    preterm = new Preterminal("tradj");
818                    fm = new FeatureMap();
819                    preterm.setFeatureMap(fm);
820                    l.add(preterm);
821                    nonterm = new Nonterminal("np");
822                    fm = new FeatureMap();
823                    setFeature(fm, "subj", 0, featureHash);
824                    setFeature(fm, "rel", 1, featureHash);
825                    fm.setFeature("copula", new StringRef("minus"));
826                    setFeature(fm, "embv", 2, featureHash);
827                    fm.setFeature("case", new StringRef("acc"));
828                    setFeature(fm, "qu", 3, featureHash);
829                    setFeature(fm, "whin", 4, featureHash);
830                    setFeature(fm, "whout", 5, featureHash);
831                    nonterm.setFeatureMap(fm);
832                    l.add(nonterm);
833                    addGrammarRule(new GrammarRule(ann, l, false));
834                    
835                    
836                    /* --- Noun Phrases --- */
837                    
838                    /* Noun phrases are represented by 'np' and can consist of proper names, variables,
839                    pronouns, and different noun constructs: */
840                    
841                    // np(id:A, exist:plus, rel:B, of:minus, def:plus, pl:minus, embv:C, qu:D, whin:E, whout:F)=> $propername(human:G, gender:H, text:A), >>(id:A, human:G, gender:H, type:prop, hasvar:minus), relcl(subj:A, rel:B, embv:C, human:G, qu:D, whin:E, whout:F)
842                    l.clear();
843                    featureHash.clear();
844                    ann = new Annotation();
845                    nonterm = new Nonterminal("np");
846                    fm = new FeatureMap();
847                    setFeature(fm, "id", 0, featureHash);
848                    fm.setFeature("exist", new StringRef("plus"));
849                    setFeature(fm, "rel", 1, featureHash);
850                    fm.setFeature("of", new StringRef("minus"));
851                    fm.setFeature("def", new StringRef("plus"));
852                    fm.setFeature("pl", new StringRef("minus"));
853                    setFeature(fm, "embv", 2, featureHash);
854                    setFeature(fm, "qu", 3, featureHash);
855                    setFeature(fm, "whin", 4, featureHash);
856                    setFeature(fm, "whout", 5, featureHash);
857                    nonterm.setFeatureMap(fm);
858                    l.add(nonterm);
859                    preterm = new Preterminal("propername");
860                    fm = new FeatureMap();
861                    setFeature(fm, "human", 6, featureHash);
862                    setFeature(fm, "gender", 7, featureHash);
863                    setFeature(fm, "text", 0, featureHash);
864                    preterm.setFeatureMap(fm);
865                    l.add(preterm);
866                    nonterm = new Nonterminal(">>");
867                    fm = new FeatureMap();
868                    setFeature(fm, "id", 0, featureHash);
869                    setFeature(fm, "human", 6, featureHash);
870                    setFeature(fm, "gender", 7, featureHash);
871                    fm.setFeature("type", new StringRef("prop"));
872                    fm.setFeature("hasvar", new StringRef("minus"));
873                    nonterm.setFeatureMap(fm);
874                    l.add(nonterm);
875                    nonterm = new Nonterminal("relcl");
876                    fm = new FeatureMap();
877                    setFeature(fm, "subj", 0, featureHash);
878                    setFeature(fm, "rel", 1, featureHash);
879                    setFeature(fm, "embv", 2, featureHash);
880                    setFeature(fm, "human", 6, featureHash);
881                    setFeature(fm, "qu", 3, featureHash);
882                    setFeature(fm, "whin", 4, featureHash);
883                    setFeature(fm, "whout", 5, featureHash);
884                    nonterm.setFeatureMap(fm);
885                    l.add(nonterm);
886                    addGrammarRule(new GrammarRule(ann, l, false));
887                    
888                    // np(id:A, exist:plus, of:minus, def:plus, pl:minus, whin:B, whout:B)=> #A, newvar(var:C), >(id:A, type:var, hasvar:plus, var:C)
889                    l.clear();
890                    featureHash.clear();
891                    ann = new Annotation();
892                    nonterm = new Nonterminal("np");
893                    fm = new FeatureMap();
894                    setFeature(fm, "id", 0, featureHash);
895                    fm.setFeature("exist", new StringRef("plus"));
896                    fm.setFeature("of", new StringRef("minus"));
897                    fm.setFeature("def", new StringRef("plus"));
898                    fm.setFeature("pl", new StringRef("minus"));
899                    setFeature(fm, "whin", 1, featureHash);
900                    setFeature(fm, "whout", 1, featureHash);
901                    nonterm.setFeatureMap(fm);
902                    l.add(nonterm);
903                    nonterm = new Nonterminal("#");
904                    fm = new FeatureMap();
905                    setFeature(fm, "pos", 0, featureHash);
906                    nonterm.setFeatureMap(fm);
907                    l.add(nonterm);
908                    nonterm = new Nonterminal("newvar");
909                    fm = new FeatureMap();
910                    setFeature(fm, "var", 2, featureHash);
911                    nonterm.setFeatureMap(fm);
912                    l.add(nonterm);
913                    nonterm = new Nonterminal(">");
914                    fm = new FeatureMap();
915                    setFeature(fm, "id", 0, featureHash);
916                    fm.setFeature("type", new StringRef("var"));
917                    fm.setFeature("hasvar", new StringRef("plus"));
918                    setFeature(fm, "var", 2, featureHash);
919                    nonterm.setFeatureMap(fm);
920                    l.add(nonterm);
921                    addGrammarRule(new GrammarRule(ann, l, false));
922                    
923                    // np(id:A, exist:plus, of:minus, def:plus, pl:minus, whin:B, whout:B)=> $defnoun(noun:C), $reference(text:D), <(id:A, type:noun, hasvar:plus, noun:C, var:D, human:E, gender:F), >(id:A, human:E, gender:F, type:ref, hasvar:minus)
924                    l.clear();
925                    featureHash.clear();
926                    ann = new Annotation();
927                    nonterm = new Nonterminal("np");
928                    fm = new FeatureMap();
929                    setFeature(fm, "id", 0, featureHash);
930                    fm.setFeature("exist", new StringRef("plus"));
931                    fm.setFeature("of", new StringRef("minus"));
932                    fm.setFeature("def", new StringRef("plus"));
933                    fm.setFeature("pl", new StringRef("minus"));
934                    setFeature(fm, "whin", 1, featureHash);
935                    setFeature(fm, "whout", 1, featureHash);
936                    nonterm.setFeatureMap(fm);
937                    l.add(nonterm);
938                    preterm = new Preterminal("defnoun");
939                    fm = new FeatureMap();
940                    setFeature(fm, "noun", 2, featureHash);
941                    preterm.setFeatureMap(fm);
942                    l.add(preterm);
943                    preterm = new Preterminal("reference");
944                    fm = new FeatureMap();
945                    setFeature(fm, "text", 3, featureHash);
946                    preterm.setFeatureMap(fm);
947                    l.add(preterm);
948                    brefcat = new BackrefCategory();
949                    fm = new FeatureMap();
950                    setFeature(fm, "id", 0, featureHash);
951                    fm.setFeature("type", new StringRef("noun"));
952                    fm.setFeature("hasvar", new StringRef("plus"));
953                    setFeature(fm, "noun", 2, featureHash);
954                    setFeature(fm, "var", 3, featureHash);
955                    setFeature(fm, "human", 4, featureHash);
956                    setFeature(fm, "gender", 5, featureHash);
957                    brefcat.addPosFeatureMap(fm);
958                    l.add(brefcat);
959                    nonterm = new Nonterminal(">");
960                    fm = new FeatureMap();
961                    setFeature(fm, "id", 0, featureHash);
962                    setFeature(fm, "human", 4, featureHash);
963                    setFeature(fm, "gender", 5, featureHash);
964                    fm.setFeature("type", new StringRef("ref"));
965                    fm.setFeature("hasvar", new StringRef("minus"));
966                    nonterm.setFeatureMap(fm);
967                    l.add(nonterm);
968                    addGrammarRule(new GrammarRule(ann, l, false));
969                    
970                    // np(id:A, exist:plus, of:minus, def:plus, pl:minus, whin:B, whout:B)=> $defnoun(noun:C), <(id:A, type:noun, noun:C, human:D, gender:E), >(id:A, human:D, gender:E, type:ref, hasvar:minus)
971                    l.clear();
972                    featureHash.clear();
973                    ann = new Annotation();
974                    nonterm = new Nonterminal("np");
975                    fm = new FeatureMap();
976                    setFeature(fm, "id", 0, featureHash);
977                    fm.setFeature("exist", new StringRef("plus"));
978                    fm.setFeature("of", new StringRef("minus"));
979                    fm.setFeature("def", new StringRef("plus"));
980                    fm.setFeature("pl", new StringRef("minus"));
981                    setFeature(fm, "whin", 1, featureHash);
982                    setFeature(fm, "whout", 1, featureHash);
983                    nonterm.setFeatureMap(fm);
984                    l.add(nonterm);
985                    preterm = new Preterminal("defnoun");
986                    fm = new FeatureMap();
987                    setFeature(fm, "noun", 2, featureHash);
988                    preterm.setFeatureMap(fm);
989                    l.add(preterm);
990                    brefcat = new BackrefCategory();
991                    fm = new FeatureMap();
992                    setFeature(fm, "id", 0, featureHash);
993                    fm.setFeature("type", new StringRef("noun"));
994                    setFeature(fm, "noun", 2, featureHash);
995                    setFeature(fm, "human", 3, featureHash);
996                    setFeature(fm, "gender", 4, featureHash);
997                    brefcat.addPosFeatureMap(fm);
998                    l.add(brefcat);
999                    nonterm = new Nonterminal(">");
1000                    fm = new FeatureMap();
1001                    setFeature(fm, "id", 0, featureHash);
1002                    setFeature(fm, "human", 3, featureHash);
1003                    setFeature(fm, "gender", 4, featureHash);
1004                    fm.setFeature("type", new StringRef("ref"));
1005                    fm.setFeature("hasvar", new StringRef("minus"));
1006                    nonterm.setFeatureMap(fm);
1007                    l.add(nonterm);
1008                    addGrammarRule(new GrammarRule(ann, l, false));
1009                    
1010                    // np(id:A, exist:plus, of:minus, def:plus, pl:minus, whin:B, whout:B)=> $reference(text:C), <(id:A, hasvar:plus, var:C, human:D, gender:E), >(id:A, human:D, gender:E, type:ref, hasvar:minus)
1011                    l.clear();
1012                    featureHash.clear();
1013                    ann = new Annotation();
1014                    nonterm = new Nonterminal("np");
1015                    fm = new FeatureMap();
1016                    setFeature(fm, "id", 0, featureHash);
1017                    fm.setFeature("exist", new StringRef("plus"));
1018                    fm.setFeature("of", new StringRef("minus"));
1019                    fm.setFeature("def", new StringRef("plus"));
1020                    fm.setFeature("pl", new StringRef("minus"));
1021                    setFeature(fm, "whin", 1, featureHash);
1022                    setFeature(fm, "whout", 1, featureHash);
1023                    nonterm.setFeatureMap(fm);
1024                    l.add(nonterm);
1025                    preterm = new Preterminal("reference");
1026                    fm = new FeatureMap();
1027                    setFeature(fm, "text", 2, featureHash);
1028                    preterm.setFeatureMap(fm);
1029                    l.add(preterm);
1030                    brefcat = new BackrefCategory();
1031                    fm = new FeatureMap();
1032                    setFeature(fm, "id", 0, featureHash);
1033                    fm.setFeature("hasvar", new StringRef("plus"));
1034                    setFeature(fm, "var", 2, featureHash);
1035                    setFeature(fm, "human", 3, featureHash);
1036                    setFeature(fm, "gender", 4, featureHash);
1037                    brefcat.addPosFeatureMap(fm);
1038                    l.add(brefcat);
1039                    nonterm = new Nonterminal(">");
1040                    fm = new FeatureMap();
1041                    setFeature(fm, "id", 0, featureHash);
1042                    setFeature(fm, "human", 3, featureHash);
1043                    setFeature(fm, "gender", 4, featureHash);
1044                    fm.setFeature("type", new StringRef("ref"));
1045                    fm.setFeature("hasvar", new StringRef("minus"));
1046                    nonterm.setFeatureMap(fm);
1047                    l.add(nonterm);
1048                    addGrammarRule(new GrammarRule(ann, l, false));
1049                    
1050                    // np(id:A, subj:B, exist:C, rel:D, of:E, pl:minus, embv:F, qu:G, whin:H, whout:I)=>quant(exist:C, qu:G), nc(id:A, subj:B, rel:D, of:E, embv:F, qu:G, whin:H, whout:I)
1051                    l.clear();
1052                    featureHash.clear();
1053                    ann = new Annotation();
1054                    nonterm = new Nonterminal("np");
1055                    fm = new FeatureMap();
1056                    setFeature(fm, "id", 0, featureHash);
1057                    setFeature(fm, "subj", 1, featureHash);
1058                    setFeature(fm, "exist", 2, featureHash);
1059                    setFeature(fm, "rel", 3, featureHash);
1060                    setFeature(fm, "of", 4, featureHash);
1061                    fm.setFeature("pl", new StringRef("minus"));
1062                    setFeature(fm, "embv", 5, featureHash);
1063                    setFeature(fm, "qu", 6, featureHash);
1064                    setFeature(fm, "whin", 7, featureHash);
1065                    setFeature(fm, "whout", 8, featureHash);
1066                    nonterm.setFeatureMap(fm);
1067                    l.add(nonterm);
1068                    nonterm = new Nonterminal("quant");
1069                    fm = new FeatureMap();
1070                    setFeature(fm, "exist", 2, featureHash);
1071                    setFeature(fm, "qu", 6, featureHash);
1072                    nonterm.setFeatureMap(fm);
1073                    l.add(nonterm);
1074                    nonterm = new Nonterminal("nc");
1075                    fm = new FeatureMap();
1076                    setFeature(fm, "id", 0, featureHash);
1077                    setFeature(fm, "subj", 1, featureHash);
1078                    setFeature(fm, "rel", 3, featureHash);
1079                    setFeature(fm, "of", 4, featureHash);
1080                    setFeature(fm, "embv", 5, featureHash);
1081                    setFeature(fm, "qu", 6, featureHash);
1082                    setFeature(fm, "whin", 7, featureHash);
1083                    setFeature(fm, "whout", 8, featureHash);
1084                    nonterm.setFeatureMap(fm);
1085                    l.add(nonterm);
1086                    addGrammarRule(new GrammarRule(ann, l, false));
1087                    
1088                    // np(id:A, exist:B, rel:C, of:minus, pl:minus, embv:D, qu:E, whin:F, whout:G)=> #A, ipron(exist:B, human:H, qu:E), opt_newvar(hasvar:I, var:J), >(id:A, human:H, type:ipron, hasvar:I, var:J), relcl(subj:A, rel:C, embv:D, human:H, qu:E, whin:F, whout:G)
1089                    l.clear();
1090                    featureHash.clear();
1091                    ann = new Annotation();
1092                    nonterm = new Nonterminal("np");
1093                    fm = new FeatureMap();
1094                    setFeature(fm, "id", 0, featureHash);
1095                    setFeature(fm, "exist", 1, featureHash);
1096                    setFeature(fm, "rel", 2, featureHash);
1097                    fm.setFeature("of", new StringRef("minus"));
1098                    fm.setFeature("pl", new StringRef("minus"));
1099                    setFeature(fm, "embv", 3, featureHash);
1100                    setFeature(fm, "qu", 4, featureHash);
1101                    setFeature(fm, "whin", 5, featureHash);
1102                    setFeature(fm, "whout", 6, featureHash);
1103                    nonterm.setFeatureMap(fm);
1104                    l.add(nonterm);
1105                    nonterm = new Nonterminal("#");
1106                    fm = new FeatureMap();
1107                    setFeature(fm, "pos", 0, featureHash);
1108                    nonterm.setFeatureMap(fm);
1109                    l.add(nonterm);
1110                    nonterm = new Nonterminal("ipron");
1111                    fm = new FeatureMap();
1112                    setFeature(fm, "exist", 1, featureHash);
1113                    setFeature(fm, "human", 7, featureHash);
1114                    setFeature(fm, "qu", 4, featureHash);
1115                    nonterm.setFeatureMap(fm);
1116                    l.add(nonterm);
1117                    nonterm = new Nonterminal("opt_newvar");
1118                    fm = new FeatureMap();
1119                    setFeature(fm, "hasvar", 8, featureHash);
1120                    setFeature(fm, "var", 9, featureHash);
1121                    nonterm.setFeatureMap(fm);
1122                    l.add(nonterm);
1123                    nonterm = new Nonterminal(">");
1124                    fm = new FeatureMap();
1125                    setFeature(fm, "id", 0, featureHash);
1126                    setFeature(fm, "human", 7, featureHash);
1127                    fm.setFeature("type", new StringRef("ipron"));
1128                    setFeature(fm, "hasvar", 8, featureHash);
1129                    setFeature(fm, "var", 9, featureHash);
1130                    nonterm.setFeatureMap(fm);
1131                    l.add(nonterm);
1132                    nonterm = new Nonterminal("relcl");
1133                    fm = new FeatureMap();
1134                    setFeature(fm, "subj", 0, featureHash);
1135                    setFeature(fm, "rel", 2, featureHash);
1136                    setFeature(fm, "embv", 3, featureHash);
1137                    setFeature(fm, "human", 7, featureHash);
1138                    setFeature(fm, "qu", 4, featureHash);
1139                    setFeature(fm, "whin", 5, featureHash);
1140                    setFeature(fm, "whout", 6, featureHash);
1141                    nonterm.setFeatureMap(fm);
1142                    l.add(nonterm);
1143                    addGrammarRule(new GrammarRule(ann, l, false));
1144                    
1145                    // np(id:A, exist:plus, of:minus, pl:plus, plquant:plus, copula:minus, whin:B, whout:B)=>num_quant, $number, #A, $nounpl
1146                    l.clear();
1147                    featureHash.clear();
1148                    ann = new Annotation();
1149                    nonterm = new Nonterminal("np");
1150                    fm = new FeatureMap();
1151                    setFeature(fm, "id", 0, featureHash);
1152                    fm.setFeature("exist", new StringRef("plus"));
1153                    fm.setFeature("of", new StringRef("minus"));
1154                    fm.setFeature("pl", new StringRef("plus"));
1155                    fm.setFeature("plquant", new StringRef("plus"));
1156                    fm.setFeature("copula", new StringRef("minus"));
1157                    setFeature(fm, "whin", 1, featureHash);
1158                    setFeature(fm, "whout", 1, featureHash);
1159                    nonterm.setFeatureMap(fm);
1160                    l.add(nonterm);
1161                    nonterm = new Nonterminal("num_quant");
1162                    fm = new FeatureMap();
1163                    nonterm.setFeatureMap(fm);
1164                    l.add(nonterm);
1165                    preterm = new Preterminal("number");
1166                    fm = new FeatureMap();
1167                    preterm.setFeatureMap(fm);
1168                    l.add(preterm);
1169                    nonterm = new Nonterminal("#");
1170                    fm = new FeatureMap();
1171                    setFeature(fm, "pos", 0, featureHash);
1172                    nonterm.setFeatureMap(fm);
1173                    l.add(nonterm);
1174                    preterm = new Preterminal("nounpl");
1175                    fm = new FeatureMap();
1176                    preterm.setFeatureMap(fm);
1177                    l.add(preterm);
1178                    addGrammarRule(new GrammarRule(ann, l, false));
1179                    
1180                    // np(id:A, exist:plus, of:minus, pl:minus, copula:minus, whin:B, whout:B)=>num_quant, ['1'], #A, $noun(human:C, gender:D, text:E), >(id:A, human:C, gender:D, type:noun, hasvar:minus, noun:E)
1181                    l.clear();
1182                    featureHash.clear();
1183                    ann = new Annotation();
1184                    nonterm = new Nonterminal("np");
1185                    fm = new FeatureMap();
1186                    setFeature(fm, "id", 0, featureHash);
1187                    fm.setFeature("exist", new StringRef("plus"));
1188                    fm.setFeature("of", new StringRef("minus"));
1189                    fm.setFeature("pl", new StringRef("minus"));
1190                    fm.setFeature("copula", new StringRef("minus"));
1191                    setFeature(fm, "whin", 1, featureHash);
1192                    setFeature(fm, "whout", 1, featureHash);
1193                    nonterm.setFeatureMap(fm);
1194                    l.add(nonterm);
1195                    nonterm = new Nonterminal("num_quant");
1196                    fm = new FeatureMap();
1197                    nonterm.setFeatureMap(fm);
1198                    l.add(nonterm);
1199                    term = new Terminal("1");
1200                    l.add(term);
1201                    nonterm = new Nonterminal("#");
1202                    fm = new FeatureMap();
1203                    setFeature(fm, "pos", 0, featureHash);
1204                    nonterm.setFeatureMap(fm);
1205                    l.add(nonterm);
1206                    preterm = new Preterminal("noun");
1207                    fm = new FeatureMap();
1208                    setFeature(fm, "human", 2, featureHash);
1209                    setFeature(fm, "gender", 3, featureHash);
1210                    setFeature(fm, "text", 4, featureHash);
1211                    preterm.setFeatureMap(fm);
1212                    l.add(preterm);
1213                    nonterm = new Nonterminal(">");
1214                    fm = new FeatureMap();
1215                    setFeature(fm, "id", 0, featureHash);
1216                    setFeature(fm, "human", 2, featureHash);
1217                    setFeature(fm, "gender", 3, featureHash);
1218                    fm.setFeature("type", new StringRef("noun"));
1219                    fm.setFeature("hasvar", new StringRef("minus"));
1220                    setFeature(fm, "noun", 4, featureHash);
1221                    nonterm.setFeatureMap(fm);
1222                    l.add(nonterm);
1223                    addGrammarRule(new GrammarRule(ann, l, false));
1224                    
1225                    // np(id:A, exist:plus, of:minus, pl:minus, qu:plus, whin:minus, whout:plus)=> #A, [what], >(id:A, human:minus, type:wh, hasvar:minus)
1226                    l.clear();
1227                    featureHash.clear();
1228                    ann = new Annotation();
1229                    nonterm = new Nonterminal("np");
1230                    fm = new FeatureMap();
1231                    setFeature(fm, "id", 0, featureHash);
1232                    fm.setFeature("exist", new StringRef("plus"));
1233                    fm.setFeature("of", new StringRef("minus"));
1234                    fm.setFeature("pl", new StringRef("minus"));
1235                    fm.setFeature("qu", new StringRef("plus"));
1236                    fm.setFeature("whin", new StringRef("minus"));
1237                    fm.setFeature("whout", new StringRef("plus"));
1238                    nonterm.setFeatureMap(fm);
1239                    l.add(nonterm);
1240                    nonterm = new Nonterminal("#");
1241                    fm = new FeatureMap();
1242                    setFeature(fm, "pos", 0, featureHash);
1243                    nonterm.setFeatureMap(fm);
1244                    l.add(nonterm);
1245                    term = new Terminal("what");
1246                    l.add(term);
1247                    nonterm = new Nonterminal(">");
1248                    fm = new FeatureMap();
1249                    setFeature(fm, "id", 0, featureHash);
1250                    fm.setFeature("human", new StringRef("minus"));
1251                    fm.setFeature("type", new StringRef("wh"));
1252                    fm.setFeature("hasvar", new StringRef("minus"));
1253                    nonterm.setFeatureMap(fm);
1254                    l.add(nonterm);
1255                    addGrammarRule(new GrammarRule(ann, l, false));
1256                    
1257                    // np(id:A, exist:plus, of:minus, pl:minus, qu:plus, whin:minus, whout:plus)=> #A, [who], >(id:A, human:plus, type:wh, hasvar:minus)
1258                    l.clear();
1259                    featureHash.clear();
1260                    ann = new Annotation();
1261                    nonterm = new Nonterminal("np");
1262                    fm = new FeatureMap();
1263                    setFeature(fm, "id", 0, featureHash);
1264                    fm.setFeature("exist", new StringRef("plus"));
1265                    fm.setFeature("of", new StringRef("minus"));
1266                    fm.setFeature("pl", new StringRef("minus"));
1267                    fm.setFeature("qu", new StringRef("plus"));
1268                    fm.setFeature("whin", new StringRef("minus"));
1269                    fm.setFeature("whout", new StringRef("plus"));
1270                    nonterm.setFeatureMap(fm);
1271                    l.add(nonterm);
1272                    nonterm = new Nonterminal("#");
1273                    fm = new FeatureMap();
1274                    setFeature(fm, "pos", 0, featureHash);
1275                    nonterm.setFeatureMap(fm);
1276                    l.add(nonterm);
1277                    term = new Terminal("who");
1278                    l.add(term);
1279                    nonterm = new Nonterminal(">");
1280                    fm = new FeatureMap();
1281                    setFeature(fm, "id", 0, featureHash);
1282                    fm.setFeature("human", new StringRef("plus"));
1283                    fm.setFeature("type", new StringRef("wh"));
1284                    fm.setFeature("hasvar", new StringRef("minus"));
1285                    nonterm.setFeatureMap(fm);
1286                    l.add(nonterm);
1287                    addGrammarRule(new GrammarRule(ann, l, false));
1288                    
1289                    // np(id:A, subj:B, exist:plus, rel:C, of:D, embv:E, pl:minus, qu:plus, whin:minus, whout:plus)=>[which], nc(id:A, subj:B, rel:C, of:D, embv:E, qu:plus, whin:plus, whout:plus)
1290                    l.clear();
1291                    featureHash.clear();
1292                    ann = new Annotation();
1293                    nonterm = new Nonterminal("np");
1294                    fm = new FeatureMap();
1295                    setFeature(fm, "id", 0, featureHash);
1296                    setFeature(fm, "subj", 1, featureHash);
1297                    fm.setFeature("exist", new StringRef("plus"));
1298                    setFeature(fm, "rel", 2, featureHash);
1299                    setFeature(fm, "of", 3, featureHash);
1300                    setFeature(fm, "embv", 4, featureHash);
1301                    fm.setFeature("pl", new StringRef("minus"));
1302                    fm.setFeature("qu", new StringRef("plus"));
1303                    fm.setFeature("whin", new StringRef("minus"));
1304                    fm.setFeature("whout", new StringRef("plus"));
1305                    nonterm.setFeatureMap(fm);
1306                    l.add(nonterm);
1307                    term = new Terminal("which");
1308                    l.add(term);
1309                    nonterm = new Nonterminal("nc");
1310                    fm = new FeatureMap();
1311                    setFeature(fm, "id", 0, featureHash);
1312                    setFeature(fm, "subj", 1, featureHash);
1313                    setFeature(fm, "rel", 2, featureHash);
1314                    setFeature(fm, "of", 3, featureHash);
1315                    setFeature(fm, "embv", 4, featureHash);
1316                    fm.setFeature("qu", new StringRef("plus"));
1317                    fm.setFeature("whin", new StringRef("plus"));
1318                    fm.setFeature("whout", new StringRef("plus"));
1319                    nonterm.setFeatureMap(fm);
1320                    l.add(nonterm);
1321                    addGrammarRule(new GrammarRule(ann, l, false));
1322                    
1323                    // np(id:A, exist:plus, of:minus, pl:plus, plquant:minus, qu:plus, whin:minus, whout:plus)=>[which], #A, $nounpl
1324                    l.clear();
1325                    featureHash.clear();
1326                    ann = new Annotation();
1327                    nonterm = new Nonterminal("np");
1328                    fm = new FeatureMap();
1329                    setFeature(fm, "id", 0, featureHash);
1330                    fm.setFeature("exist", new StringRef("plus"));
1331                    fm.setFeature("of", new StringRef("minus"));
1332                    fm.setFeature("pl", new StringRef("plus"));
1333                    fm.setFeature("plquant", new StringRef("minus"));
1334                    fm.setFeature("qu", new StringRef("plus"));
1335                    fm.setFeature("whin", new StringRef("minus"));
1336                    fm.setFeature("whout", new StringRef("plus"));
1337                    nonterm.setFeatureMap(fm);
1338                    l.add(nonterm);
1339                    term = new Terminal("which");
1340                    l.add(term);
1341                    nonterm = new Nonterminal("#");
1342                    fm = new FeatureMap();
1343                    setFeature(fm, "pos", 0, featureHash);
1344                    nonterm.setFeatureMap(fm);
1345                    l.add(nonterm);
1346                    preterm = new Preterminal("nounpl");
1347                    fm = new FeatureMap();
1348                    preterm.setFeatureMap(fm);
1349                    l.add(preterm);
1350                    addGrammarRule(new GrammarRule(ann, l, false));
1351                    
1352                    /* The category 'nc' represents nouns optionally followed by variables, relative clauses,
1353                    and of-constructs: */
1354                    
1355                    // nc(id:A, rel:B, of:minus, embv:C, qu:D, whin:E, whout:F)=>n(id:A, human:G, gender:H, text:I), opt_newvar(hasvar:J, var:K), >(id:A, human:G, gender:H, type:noun, hasvar:J, noun:I, var:K), relcl(subj:A, rel:B, embv:C, human:G, qu:D, whin:E, whout:F)
1356                    l.clear();
1357                    featureHash.clear();
1358                    ann = new Annotation();
1359                    nonterm = new Nonterminal("nc");
1360                    fm = new FeatureMap();
1361                    setFeature(fm, "id", 0, featureHash);
1362                    setFeature(fm, "rel", 1, featureHash);
1363                    fm.setFeature("of", new StringRef("minus"));
1364                    setFeature(fm, "embv", 2, featureHash);
1365                    setFeature(fm, "qu", 3, featureHash);
1366                    setFeature(fm, "whin", 4, featureHash);
1367                    setFeature(fm, "whout", 5, featureHash);
1368                    nonterm.setFeatureMap(fm);
1369                    l.add(nonterm);
1370                    nonterm = new Nonterminal("n");
1371                    fm = new FeatureMap();
1372                    setFeature(fm, "id", 0, featureHash);
1373                    setFeature(fm, "human", 6, featureHash);
1374                    setFeature(fm, "gender", 7, featureHash);
1375                    setFeature(fm, "text", 8, featureHash);
1376                    nonterm.setFeatureMap(fm);
1377                    l.add(nonterm);
1378                    nonterm = new Nonterminal("opt_newvar");
1379                    fm = new FeatureMap();
1380                    setFeature(fm, "hasvar", 9, featureHash);
1381                    setFeature(fm, "var", 10, featureHash);
1382                    nonterm.setFeatureMap(fm);
1383                    l.add(nonterm);
1384                    nonterm = new Nonterminal(">");
1385                    fm = new FeatureMap();
1386                    setFeature(fm, "id", 0, featureHash);
1387                    setFeature(fm, "human", 6, featureHash);
1388                    setFeature(fm, "gender", 7, featureHash);
1389                    fm.setFeature("type", new StringRef("noun"));
1390                    setFeature(fm, "hasvar", 9, featureHash);
1391                    setFeature(fm, "noun", 8, featureHash);
1392                    setFeature(fm, "var", 10, featureHash);
1393                    nonterm.setFeatureMap(fm);
1394                    l.add(nonterm);
1395                    nonterm = new Nonterminal("relcl");
1396                    fm = new FeatureMap();
1397                    setFeature(fm, "subj", 0, featureHash);
1398                    setFeature(fm, "rel", 1, featureHash);
1399                    setFeature(fm, "embv", 2, featureHash);
1400                    setFeature(fm, "human", 6, featureHash);
1401                    setFeature(fm, "qu", 3, featureHash);
1402                    setFeature(fm, "whin", 4, featureHash);
1403                    setFeature(fm, "whout", 5, featureHash);
1404                    nonterm.setFeatureMap(fm);
1405                    l.add(nonterm);
1406                    addGrammarRule(new GrammarRule(ann, l, false));
1407                    
1408                    // nc(subj:A, rel:B, of:plus, embv:C, qu:D, whin:E, whout:F)~> $nounof, np(subj:A, rel:B, embv:C, case:acc, qu:D, whin:E, whout:F)
1409                    l.clear();
1410                    featureHash.clear();
1411                    ann = new Annotation();
1412                    nonterm = new Nonterminal("nc");
1413                    fm = new FeatureMap();
1414                    setFeature(fm, "subj", 0, featureHash);
1415                    setFeature(fm, "rel", 1, featureHash);
1416                    fm.setFeature("of", new StringRef("plus"));
1417                    setFeature(fm, "embv", 2, featureHash);
1418                    setFeature(fm, "qu", 3, featureHash);
1419                    setFeature(fm, "whin", 4, featureHash);
1420                    setFeature(fm, "whout", 5, featureHash);
1421                    nonterm.setFeatureMap(fm);
1422                    l.add(nonterm);
1423                    preterm = new Preterminal("nounof");
1424                    fm = new FeatureMap();
1425                    preterm.setFeatureMap(fm);
1426                    l.add(preterm);
1427                    nonterm = new Nonterminal("np");
1428                    fm = new FeatureMap();
1429                    setFeature(fm, "subj", 0, featureHash);
1430                    setFeature(fm, "rel", 1, featureHash);
1431                    setFeature(fm, "embv", 2, featureHash);
1432                    fm.setFeature("case", new StringRef("acc"));
1433                    setFeature(fm, "qu", 3, featureHash);
1434                    setFeature(fm, "whin", 4, featureHash);
1435                    setFeature(fm, "whout", 5, featureHash);
1436                    nonterm.setFeatureMap(fm);
1437                    l.add(nonterm);
1438                    addGrammarRule(new GrammarRule(ann, l, true));
1439                    
1440                    /* The category 'n' stands for nouns: */
1441                    
1442                    // n(id:A, human:B, gender:C, text:D)=> #A, $noun(human:B, gender:C, text:D)
1443                    l.clear();
1444                    featureHash.clear();
1445                    ann = new Annotation();
1446                    nonterm = new Nonterminal("n");
1447                    fm = new FeatureMap();
1448                    setFeature(fm, "id", 0, featureHash);
1449                    setFeature(fm, "human", 1, featureHash);
1450                    setFeature(fm, "gender", 2, featureHash);
1451                    setFeature(fm, "text", 3, featureHash);
1452                    nonterm.setFeatureMap(fm);
1453                    l.add(nonterm);
1454                    nonterm = new Nonterminal("#");
1455                    fm = new FeatureMap();
1456                    setFeature(fm, "pos", 0, featureHash);
1457                    nonterm.setFeatureMap(fm);
1458                    l.add(nonterm);
1459                    preterm = new Preterminal("noun");
1460                    fm = new FeatureMap();
1461                    setFeature(fm, "human", 1, featureHash);
1462                    setFeature(fm, "gender", 2, featureHash);
1463                    setFeature(fm, "text", 3, featureHash);
1464                    preterm.setFeatureMap(fm);
1465                    l.add(preterm);
1466                    addGrammarRule(new GrammarRule(ann, l, false));
1467                    
1468                    /* New variables, optional and mandatory, are represented by 'opt_newvar' and 'newvar',
1469                    respectively: */
1470                    
1471                    // opt_newvar(hasvar:minus)=>[]
1472                    l.clear();
1473                    featureHash.clear();
1474                    ann = new Annotation();
1475                    nonterm = new Nonterminal("opt_newvar");
1476                    fm = new FeatureMap();
1477                    fm.setFeature("hasvar", new StringRef("minus"));
1478                    nonterm.setFeatureMap(fm);
1479                    l.add(nonterm);
1480                    addGrammarRule(new GrammarRule(ann, l, false));
1481                    
1482                    // opt_newvar(hasvar:plus, var:A)=>newvar(var:A)
1483                    l.clear();
1484                    featureHash.clear();
1485                    ann = new Annotation();
1486                    nonterm = new Nonterminal("opt_newvar");
1487                    fm = new FeatureMap();
1488                    fm.setFeature("hasvar", new StringRef("plus"));
1489                    setFeature(fm, "var", 0, featureHash);
1490                    nonterm.setFeatureMap(fm);
1491                    l.add(nonterm);
1492                    nonterm = new Nonterminal("newvar");
1493                    fm = new FeatureMap();
1494                    setFeature(fm, "var", 0, featureHash);
1495                    nonterm.setFeatureMap(fm);
1496                    l.add(nonterm);
1497                    addGrammarRule(new GrammarRule(ann, l, false));
1498                    
1499                    // newvar(var:A)=> $variable(text:A), /<(hasvar:plus, var:A)
1500                    l.clear();
1501                    featureHash.clear();
1502                    ann = new Annotation();
1503                    nonterm = new Nonterminal("newvar");
1504                    fm = new FeatureMap();
1505                    setFeature(fm, "var", 0, featureHash);
1506                    nonterm.setFeatureMap(fm);
1507                    l.add(nonterm);
1508                    preterm = new Preterminal("variable");
1509                    fm = new FeatureMap();
1510                    setFeature(fm, "text", 0, featureHash);
1511                    preterm.setFeatureMap(fm);
1512                    l.add(preterm);
1513                    nonterm = new Nonterminal("/<");
1514                    fm = new FeatureMap();
1515                    fm.setFeature("hasvar", new StringRef("plus"));
1516                    setFeature(fm, "var", 0, featureHash);
1517                    nonterm.setFeatureMap(fm);
1518                    l.add(nonterm);
1519                    addGrammarRule(new GrammarRule(ann, l, false));
1520                    
1521                    
1522                    /* --- Relative Clauses --- */
1523                    
1524                    /* Relative clauses are represented by 'relcl'. They start with a relative pronoun and
1525                    are always optional: */
1526                    
1527                    // relcl(whin:A, whout:A)=>[]
1528                    l.clear();
1529                    featureHash.clear();
1530                    ann = new Annotation();
1531                    nonterm = new Nonterminal("relcl");
1532                    fm = new FeatureMap();
1533                    setFeature(fm, "whin", 0, featureHash);
1534                    setFeature(fm, "whout", 0, featureHash);
1535                    nonterm.setFeatureMap(fm);
1536                    l.add(nonterm);
1537                    addGrammarRule(new GrammarRule(ann, l, false));
1538                    
1539                    // relcl(subj:A, rel:plus, embv:plus, human:B, qu:C, whin:D, whout:E)=>relpron(human:B, relpron:F), relcl1(subj:A, human:B, relpron:F, qu:C, whin:D, whout:E)
1540                    l.clear();
1541                    featureHash.clear();
1542                    ann = new Annotation();
1543                    nonterm = new Nonterminal("relcl");
1544                    fm = new FeatureMap();
1545                    setFeature(fm, "subj", 0, featureHash);
1546                    fm.setFeature("rel", new StringRef("plus"));
1547                    fm.setFeature("embv", new StringRef("plus"));
1548                    setFeature(fm, "human", 1, featureHash);
1549                    setFeature(fm, "qu", 2, featureHash);
1550                    setFeature(fm, "whin", 3, featureHash);
1551                    setFeature(fm, "whout", 4, featureHash);
1552                    nonterm.setFeatureMap(fm);
1553                    l.add(nonterm);
1554                    nonterm = new Nonterminal("relpron");
1555                    fm = new FeatureMap();
1556                    setFeature(fm, "human", 1, featureHash);
1557                    setFeature(fm, "relpron", 5, featureHash);
1558                    nonterm.setFeatureMap(fm);
1559                    l.add(nonterm);
1560                    nonterm = new Nonterminal("relcl1");
1561                    fm = new FeatureMap();
1562                    setFeature(fm, "subj", 0, featureHash);
1563                    setFeature(fm, "human", 1, featureHash);
1564                    setFeature(fm, "relpron", 5, featureHash);
1565                    setFeature(fm, "qu", 2, featureHash);
1566                    setFeature(fm, "whin", 3, featureHash);
1567                    setFeature(fm, "whout", 4, featureHash);
1568                    nonterm.setFeatureMap(fm);
1569                    l.add(nonterm);
1570                    addGrammarRule(new GrammarRule(ann, l, false));
1571                    
1572                    /* Like sentences and verb phrases, relative clauses can be coordinated by "or"
1573                    ('relcl1') and "and" ('relcl2'): */
1574                    
1575                    // relcl1(subj:A, human:B, relpron:C, qu:D, whin:E, whout:F)~> //, relcl2(subj:A, human:B, rel:minus, relpron:C, qu:D, whin:E, whout:G), or_relpron(human:B, relpron:C), relcl1(subj:A, human:B, relpron:C, qu:D, whin:G, whout:F)
1576                    l.clear();
1577                    featureHash.clear();
1578                    ann = new Annotation();
1579                    nonterm = new Nonterminal("relcl1");
1580                    fm = new FeatureMap();
1581                    setFeature(fm, "subj", 0, featureHash);
1582                    setFeature(fm, "human", 1, featureHash);
1583                    setFeature(fm, "relpron", 2, featureHash);
1584                    setFeature(fm, "qu", 3, featureHash);
1585                    setFeature(fm, "whin", 4, featureHash);
1586                    setFeature(fm, "whout", 5, featureHash);
1587                    nonterm.setFeatureMap(fm);
1588                    l.add(nonterm);
1589                    nonterm = new Nonterminal("//");
1590                    fm = new FeatureMap();
1591                    nonterm.setFeatureMap(fm);
1592                    l.add(nonterm);
1593                    nonterm = new Nonterminal("relcl2");
1594                    fm = new FeatureMap();
1595                    setFeature(fm, "subj", 0, featureHash);
1596                    setFeature(fm, "human", 1, featureHash);
1597                    fm.setFeature("rel", new StringRef("minus"));
1598                    setFeature(fm, "relpron", 2, featureHash);
1599                    setFeature(fm, "qu", 3, featureHash);
1600                    setFeature(fm, "whin", 4, featureHash);
1601                    setFeature(fm, "whout", 6, featureHash);
1602                    nonterm.setFeatureMap(fm);
1603                    l.add(nonterm);
1604                    nonterm = new Nonterminal("or_relpron");
1605                    fm = new FeatureMap();
1606                    setFeature(fm, "human", 1, featureHash);
1607                    setFeature(fm, "relpron", 2, featureHash);
1608                    nonterm.setFeatureMap(fm);
1609                    l.add(nonterm);
1610                    nonterm = new Nonterminal("relcl1");
1611                    fm = new FeatureMap();
1612                    setFeature(fm, "subj", 0, featureHash);
1613                    setFeature(fm, "human", 1, featureHash);
1614                    setFeature(fm, "relpron", 2, featureHash);
1615                    setFeature(fm, "qu", 3, featureHash);
1616                    setFeature(fm, "whin", 6, featureHash);
1617                    setFeature(fm, "whout", 5, featureHash);
1618                    nonterm.setFeatureMap(fm);
1619                    l.add(nonterm);
1620                    addGrammarRule(new GrammarRule(ann, l, true));
1621                    
1622                    // relcl1(subj:A, human:B, relpron:C, qu:D, whin:E, whout:F)=>relcl2(subj:A, human:B, relpron:C, qu:D, whin:E, whout:F)
1623                    l.clear();
1624                    featureHash.clear();
1625                    ann = new Annotation();
1626                    nonterm = new Nonterminal("relcl1");
1627                    fm = new FeatureMap();
1628                    setFeature(fm, "subj", 0, featureHash);
1629                    setFeature(fm, "human", 1, featureHash);
1630                    setFeature(fm, "relpron", 2, featureHash);
1631                    setFeature(fm, "qu", 3, featureHash);
1632                    setFeature(fm, "whin", 4, featureHash);
1633                    setFeature(fm, "whout", 5, featureHash);
1634                    nonterm.setFeatureMap(fm);
1635                    l.add(nonterm);
1636                    nonterm = new Nonterminal("relcl2");
1637                    fm = new FeatureMap();
1638                    setFeature(fm, "subj", 0, featureHash);
1639                    setFeature(fm, "human", 1, featureHash);
1640                    setFeature(fm, "relpron", 2, featureHash);
1641                    setFeature(fm, "qu", 3, featureHash);
1642                    setFeature(fm, "whin", 4, featureHash);
1643                    setFeature(fm, "whout", 5, featureHash);
1644                    nonterm.setFeatureMap(fm);
1645                    l.add(nonterm);
1646                    addGrammarRule(new GrammarRule(ann, l, false));
1647                    
1648                    // relcl2(subj:A, rel:B, relpron:C, human:D, qu:E, whin:F, whout:G)=>vp(subj:A, rel:minus, pl:minus, qu:E, whin:F, whout:H), and_relpron(human:D, relpron:C), relcl2(subj:A, rel:B, relpron:C, human:D, qu:E, whin:H, whout:G)
1649                    l.clear();
1650                    featureHash.clear();
1651                    ann = new Annotation();
1652                    nonterm = new Nonterminal("relcl2");
1653                    fm = new FeatureMap();
1654                    setFeature(fm, "subj", 0, featureHash);
1655                    setFeature(fm, "rel", 1, featureHash);
1656                    setFeature(fm, "relpron", 2, featureHash);
1657                    setFeature(fm, "human", 3, featureHash);
1658                    setFeature(fm, "qu", 4, featureHash);
1659                    setFeature(fm, "whin", 5, featureHash);
1660                    setFeature(fm, "whout", 6, featureHash);
1661                    nonterm.setFeatureMap(fm);
1662                    l.add(nonterm);
1663                    nonterm = new Nonterminal("vp");
1664                    fm = new FeatureMap();
1665                    setFeature(fm, "subj", 0, featureHash);
1666                    fm.setFeature("rel", new StringRef("minus"));
1667                    fm.setFeature("pl", new StringRef("minus"));
1668                    setFeature(fm, "qu", 4, featureHash);
1669                    setFeature(fm, "whin", 5, featureHash);
1670                    setFeature(fm, "whout", 7, featureHash);
1671                    nonterm.setFeatureMap(fm);
1672                    l.add(nonterm);
1673                    nonterm = new Nonterminal("and_relpron");
1674                    fm = new FeatureMap();
1675                    setFeature(fm, "human", 3, featureHash);
1676                    setFeature(fm, "relpron", 2, featureHash);
1677                    nonterm.setFeatureMap(fm);
1678                    l.add(nonterm);
1679                    nonterm = new Nonterminal("relcl2");
1680                    fm = new FeatureMap();
1681                    setFeature(fm, "subj", 0, featureHash);
1682                    setFeature(fm, "rel", 1, featureHash);
1683                    setFeature(fm, "relpron", 2, featureHash);
1684                    setFeature(fm, "human", 3, featureHash);
1685                    setFeature(fm, "qu", 4, featureHash);
1686                    setFeature(fm, "whin", 7, featureHash);
1687                    setFeature(fm, "whout", 6, featureHash);
1688                    nonterm.setFeatureMap(fm);
1689                    l.add(nonterm);
1690                    addGrammarRule(new GrammarRule(ann, l, false));
1691                    
1692                    // relcl2(subj:A, rel:B, qu:C, whin:D, whout:E)=>vp(subj:A, rel:B, pl:minus, qu:C, whin:D, whout:E)
1693                    l.clear();
1694                    featureHash.clear();
1695                    ann = new Annotation();
1696                    nonterm = new Nonterminal("relcl2");
1697                    fm = new FeatureMap();
1698                    setFeature(fm, "subj", 0, featureHash);
1699                    setFeature(fm, "rel", 1, featureHash);
1700                    setFeature(fm, "qu", 2, featureHash);
1701                    setFeature(fm, "whin", 3, featureHash);
1702                    setFeature(fm, "whout", 4, featureHash);
1703                    nonterm.setFeatureMap(fm);
1704                    l.add(nonterm);
1705                    nonterm = new Nonterminal("vp");
1706                    fm = new FeatureMap();
1707                    setFeature(fm, "subj", 0, featureHash);
1708                    setFeature(fm, "rel", 1, featureHash);
1709                    fm.setFeature("pl", new StringRef("minus"));
1710                    setFeature(fm, "qu", 2, featureHash);
1711                    setFeature(fm, "whin", 3, featureHash);
1712                    setFeature(fm, "whout", 4, featureHash);
1713                    nonterm.setFeatureMap(fm);
1714                    l.add(nonterm);
1715                    addGrammarRule(new GrammarRule(ann, l, false));
1716                    
1717                    // relcl2(subj:A, qu:B, whin:C, whout:D)~>np(subj:A, rel:minus, copula:minus, pl:E, case:nom, refl:minus, qu:B, whin:C, whout:D), aux(be:minus, exist:F, pl:E), verb(vcat:tr, be:minus, exist:F, pl:E, vform:inf)
1718                    l.clear();
1719                    featureHash.clear();
1720                    ann = new Annotation();
1721                    nonterm = new Nonterminal("relcl2");
1722                    fm = new FeatureMap();
1723                    setFeature(fm, "subj", 0, featureHash);
1724                    setFeature(fm, "qu", 1, featureHash);
1725                    setFeature(fm, "whin", 2, featureHash);
1726                    setFeature(fm, "whout", 3, featureHash);
1727                    nonterm.setFeatureMap(fm);
1728                    l.add(nonterm);
1729                    nonterm = new Nonterminal("np");
1730                    fm = new FeatureMap();
1731                    setFeature(fm, "subj", 0, featureHash);
1732                    fm.setFeature("rel", new StringRef("minus"));
1733                    fm.setFeature("copula", new StringRef("minus"));
1734                    setFeature(fm, "pl", 4, featureHash);
1735                    fm.setFeature("case", new StringRef("nom"));
1736                    fm.setFeature("refl", new StringRef("minus"));
1737                    setFeature(fm, "qu", 1, featureHash);
1738                    setFeature(fm, "whin", 2, featureHash);
1739                    setFeature(fm, "whout", 3, featureHash);
1740                    nonterm.setFeatureMap(fm);
1741                    l.add(nonterm);
1742                    nonterm = new Nonterminal("aux");
1743                    fm = new FeatureMap();
1744                    fm.setFeature("be", new StringRef("minus"));
1745                    setFeature(fm, "exist", 5, featureHash);
1746                    setFeature(fm, "pl", 4, featureHash);
1747                    nonterm.setFeatureMap(fm);
1748                    l.add(nonterm);
1749                    nonterm = new Nonterminal("verb");
1750                    fm = new FeatureMap();
1751                    fm.setFeature("vcat", new StringRef("tr"));
1752                    fm.setFeature("be", new StringRef("minus"));
1753                    setFeature(fm, "exist", 5, featureHash);
1754                    setFeature(fm, "pl", 4, featureHash);
1755                    fm.setFeature("vform", new StringRef("inf"));
1756                    nonterm.setFeatureMap(fm);
1757                    l.add(nonterm);
1758                    addGrammarRule(new GrammarRule(ann, l, true));
1759                    
1760                    // relcl2(subj:A, qu:B, whin:C, whout:D)~>np(subj:A, rel:minus, copula:minus, pl:E, case:nom, refl:minus, qu:B, whin:C, whout:D), verb(vcat:tr, be:minus, exist:plus, pl:E, vform:fin)
1761                    l.clear();
1762                    featureHash.clear();
1763                    ann = new Annotation();
1764                    nonterm = new Nonterminal("relcl2");
1765                    fm = new FeatureMap();
1766                    setFeature(fm, "subj", 0, featureHash);
1767                    setFeature(fm, "qu", 1, featureHash);
1768                    setFeature(fm, "whin", 2, featureHash);
1769                    setFeature(fm, "whout", 3, featureHash);
1770                    nonterm.setFeatureMap(fm);
1771                    l.add(nonterm);
1772                    nonterm = new Nonterminal("np");
1773                    fm = new FeatureMap();
1774                    setFeature(fm, "subj", 0, featureHash);
1775                    fm.setFeature("rel", new StringRef("minus"));
1776                    fm.setFeature("copula", new StringRef("minus"));
1777                    setFeature(fm, "pl", 4, featureHash);
1778                    fm.setFeature("case", new StringRef("nom"));
1779                    fm.setFeature("refl", new StringRef("minus"));
1780                    setFeature(fm, "qu", 1, featureHash);
1781                    setFeature(fm, "whin", 2, featureHash);
1782                    setFeature(fm, "whout", 3, featureHash);
1783                    nonterm.setFeatureMap(fm);
1784                    l.add(nonterm);
1785                    nonterm = new Nonterminal("verb");
1786                    fm = new FeatureMap();
1787                    fm.setFeature("vcat", new StringRef("tr"));
1788                    fm.setFeature("be", new StringRef("minus"));
1789                    fm.setFeature("exist", new StringRef("plus"));
1790                    setFeature(fm, "pl", 4, featureHash);
1791                    fm.setFeature("vform", new StringRef("fin"));
1792                    nonterm.setFeatureMap(fm);
1793                    l.add(nonterm);
1794                    addGrammarRule(new GrammarRule(ann, l, true));
1795                    
1796                    /* Relative pronouns are represented by 'relpron' and can be either "that", "who" or
1797                    "which": */
1798                    
1799                    // relpron(relpron:that)=>[that]
1800                    l.clear();
1801                    featureHash.clear();
1802                    ann = new Annotation();
1803                    nonterm = new Nonterminal("relpron");
1804                    fm = new FeatureMap();
1805                    fm.setFeature("relpron", new StringRef("that"));
1806                    nonterm.setFeatureMap(fm);
1807                    l.add(nonterm);
1808                    term = new Terminal("that");
1809                    l.add(term);
1810                    addGrammarRule(new GrammarRule(ann, l, false));
1811                    
1812                    // relpron(human:plus, relpron:who)=>[who]
1813                    l.clear();
1814                    featureHash.clear();
1815                    ann = new Annotation();
1816                    nonterm = new Nonterminal("relpron");
1817                    fm = new FeatureMap();
1818                    fm.setFeature("human", new StringRef("plus"));
1819                    fm.setFeature("relpron", new StringRef("who"));
1820                    nonterm.setFeatureMap(fm);
1821                    l.add(nonterm);
1822                    term = new Terminal("who");
1823                    l.add(term);
1824                    addGrammarRule(new GrammarRule(ann, l, false));
1825                    
1826                    // relpron(human:minus, relpron:which)=>[which]
1827                    l.clear();
1828                    featureHash.clear();
1829                    ann = new Annotation();
1830                    nonterm = new Nonterminal("relpron");
1831                    fm = new FeatureMap();
1832                    fm.setFeature("human", new StringRef("minus"));
1833                    fm.setFeature("relpron", new StringRef("which"));
1834                    nonterm.setFeatureMap(fm);
1835                    l.add(nonterm);
1836                    term = new Terminal("which");
1837                    l.add(term);
1838                    addGrammarRule(new GrammarRule(ann, l, false));
1839                    
1840                    /* The categories 'or_relpron' and 'and_relpron' define shortcuts - like "or that" as
1841                    one token - for better usability inside of the predictive editor: */
1842                    
1843                    // or_relpron(human:A, relpron:B)=>[or], relpron(human:A, relpron:B)
1844                    l.clear();
1845                    featureHash.clear();
1846                    ann = new Annotation();
1847                    nonterm = new Nonterminal("or_relpron");
1848                    fm = new FeatureMap();
1849                    setFeature(fm, "human", 0, featureHash);
1850                    setFeature(fm, "relpron", 1, featureHash);
1851                    nonterm.setFeatureMap(fm);
1852                    l.add(nonterm);
1853                    term = new Terminal("or");
1854                    l.add(term);
1855                    nonterm = new Nonterminal("relpron");
1856                    fm = new FeatureMap();
1857                    setFeature(fm, "human", 0, featureHash);
1858                    setFeature(fm, "relpron", 1, featureHash);
1859                    nonterm.setFeatureMap(fm);
1860                    l.add(nonterm);
1861                    addGrammarRule(new GrammarRule(ann, l, false));
1862                    
1863                    // or_relpron(relpron:that)=>['or that']
1864                    l.clear();
1865                    featureHash.clear();
1866                    ann = new Annotation();
1867                    nonterm = new Nonterminal("or_relpron");
1868                    fm = new FeatureMap();
1869                    fm.setFeature("relpron", new StringRef("that"));
1870                    nonterm.setFeatureMap(fm);
1871                    l.add(nonterm);
1872                    term = new Terminal("or that");
1873                    l.add(term);
1874                    addGrammarRule(new GrammarRule(ann, l, false));
1875                    
1876                    // or_relpron(human:plus, relpron:who)=>['or who']
1877                    l.clear();
1878                    featureHash.clear();
1879                    ann = new Annotation();
1880                    nonterm = new Nonterminal("or_relpron");
1881                    fm = new FeatureMap();
1882                    fm.setFeature("human", new StringRef("plus"));
1883                    fm.setFeature("relpron", new StringRef("who"));
1884                    nonterm.setFeatureMap(fm);
1885                    l.add(nonterm);
1886                    term = new Terminal("or who");
1887                    l.add(term);
1888                    addGrammarRule(new GrammarRule(ann, l, false));
1889                    
1890                    // or_relpron(human:minus, relpron:which)=>['or which']
1891                    l.clear();
1892                    featureHash.clear();
1893                    ann = new Annotation();
1894                    nonterm = new Nonterminal("or_relpron");
1895                    fm = new FeatureMap();
1896                    fm.setFeature("human", new StringRef("minus"));
1897                    fm.setFeature("relpron", new StringRef("which"));
1898                    nonterm.setFeatureMap(fm);
1899                    l.add(nonterm);
1900                    term = new Terminal("or which");
1901                    l.add(term);
1902                    addGrammarRule(new GrammarRule(ann, l, false));
1903                    
1904                    // and_relpron(human:A, relpron:B)=>[and], relpron(human:A, relpron:B)
1905                    l.clear();
1906                    featureHash.clear();
1907                    ann = new Annotation();
1908                    nonterm = new Nonterminal("and_relpron");
1909                    fm = new FeatureMap();
1910                    setFeature(fm, "human", 0, featureHash);
1911                    setFeature(fm, "relpron", 1, featureHash);
1912                    nonterm.setFeatureMap(fm);
1913                    l.add(nonterm);
1914                    term = new Terminal("and");
1915                    l.add(term);
1916                    nonterm = new Nonterminal("relpron");
1917                    fm = new FeatureMap();
1918                    setFeature(fm, "human", 0, featureHash);
1919                    setFeature(fm, "relpron", 1, featureHash);
1920                    nonterm.setFeatureMap(fm);
1921                    l.add(nonterm);
1922                    addGrammarRule(new GrammarRule(ann, l, false));
1923                    
1924                    // and_relpron(relpron:that)=>['and that']
1925                    l.clear();
1926                    featureHash.clear();
1927                    ann = new Annotation();
1928                    nonterm = new Nonterminal("and_relpron");
1929                    fm = new FeatureMap();
1930                    fm.setFeature("relpron", new StringRef("that"));
1931                    nonterm.setFeatureMap(fm);
1932                    l.add(nonterm);
1933                    term = new Terminal("and that");
1934                    l.add(term);
1935                    addGrammarRule(new GrammarRule(ann, l, false));
1936                    
1937                    // and_relpron(human:plus, relpron:who)=>['and who']
1938                    l.clear();
1939                    featureHash.clear();
1940                    ann = new Annotation();
1941                    nonterm = new Nonterminal("and_relpron");
1942                    fm = new FeatureMap();
1943                    fm.setFeature("human", new StringRef("plus"));
1944                    fm.setFeature("relpron", new StringRef("who"));
1945                    nonterm.setFeatureMap(fm);
1946                    l.add(nonterm);
1947                    term = new Terminal("and who");
1948                    l.add(term);
1949                    addGrammarRule(new GrammarRule(ann, l, false));
1950                    
1951                    // and_relpron(human:minus, relpron:which)=>['and which']
1952                    l.clear();
1953                    featureHash.clear();
1954                    ann = new Annotation();
1955                    nonterm = new Nonterminal("and_relpron");
1956                    fm = new FeatureMap();
1957                    fm.setFeature("human", new StringRef("minus"));
1958                    fm.setFeature("relpron", new StringRef("which"));
1959                    nonterm.setFeatureMap(fm);
1960                    l.add(nonterm);
1961                    term = new Terminal("and which");
1962                    l.add(term);
1963                    addGrammarRule(new GrammarRule(ann, l, false));
1964                    
1965                    
1966                    /* --- Verbs --- */
1967                    
1968                    /* The category 'verb' represents main verbs: */
1969                    
1970                    // verb(be:minus, vcat:tr, pl:minus, vform:fin)=> $verbsg
1971                    l.clear();
1972                    featureHash.clear();
1973                    ann = new Annotation();
1974                    nonterm = new Nonterminal("verb");
1975                    fm = new FeatureMap();
1976                    fm.setFeature("be", new StringRef("minus"));
1977                    fm.setFeature("vcat", new StringRef("tr"));
1978                    fm.setFeature("pl", new StringRef("minus"));
1979                    fm.setFeature("vform", new StringRef("fin"));
1980                    nonterm.setFeatureMap(fm);
1981                    l.add(nonterm);
1982                    preterm = new Preterminal("verbsg");
1983                    fm = new FeatureMap();
1984                    preterm.setFeatureMap(fm);
1985                    l.add(preterm);
1986                    addGrammarRule(new GrammarRule(ann, l, false));
1987                    
1988                    // verb(be:minus, vcat:tr, pl:plus, vform:fin)=> $verbinf
1989                    l.clear();
1990                    featureHash.clear();
1991                    ann = new Annotation();
1992                    nonterm = new Nonterminal("verb");
1993                    fm = new FeatureMap();
1994                    fm.setFeature("be", new StringRef("minus"));
1995                    fm.setFeature("vcat", new StringRef("tr"));
1996                    fm.setFeature("pl", new StringRef("plus"));
1997                    fm.setFeature("vform", new StringRef("fin"));
1998                    nonterm.setFeatureMap(fm);
1999                    l.add(nonterm);
2000                    preterm = new Preterminal("verbinf");
2001                    fm = new FeatureMap();
2002                    preterm.setFeatureMap(fm);
2003                    l.add(preterm);
2004                    addGrammarRule(new GrammarRule(ann, l, false));
2005                    
2006                    // verb(be:minus, vcat:tr, vform:inf)=> $verbinf
2007                    l.clear();
2008                    featureHash.clear();
2009                    ann = new Annotation();
2010                    nonterm = new Nonterminal("verb");
2011                    fm = new FeatureMap();
2012                    fm.setFeature("be", new StringRef("minus"));
2013                    fm.setFeature("vcat", new StringRef("tr"));
2014                    fm.setFeature("vform", new StringRef("inf"));
2015                    nonterm.setFeatureMap(fm);
2016                    l.add(nonterm);
2017                    preterm = new Preterminal("verbinf");
2018                    fm = new FeatureMap();
2019                    preterm.setFeatureMap(fm);
2020                    l.add(preterm);
2021                    addGrammarRule(new GrammarRule(ann, l, false));
2022                    
2023                    // verb(be:plus, vcat:tr)=> $pverb
2024                    l.clear();
2025                    featureHash.clear();
2026                    ann = new Annotation();
2027                    nonterm = new Nonterminal("verb");
2028                    fm = new FeatureMap();
2029                    fm.setFeature("be", new StringRef("plus"));
2030                    fm.setFeature("vcat", new StringRef("tr"));
2031                    nonterm.setFeatureMap(fm);
2032                    l.add(nonterm);
2033                    preterm = new Preterminal("pverb");
2034                    fm = new FeatureMap();
2035                    preterm.setFeatureMap(fm);
2036                    l.add(preterm);
2037                    addGrammarRule(new GrammarRule(ann, l, false));
2038                    
2039                    /* Auxiliary verbs are represented by 'aux', which includes negation markers: */
2040                    
2041                    // aux(be:plus, exist:plus, pl:minus)=>[is]
2042                    l.clear();
2043                    featureHash.clear();
2044                    ann = new Annotation();
2045                    nonterm = new Nonterminal("aux");
2046                    fm = new FeatureMap();
2047                    fm.setFeature("be", new StringRef("plus"));
2048                    fm.setFeature("exist", new StringRef("plus"));
2049                    fm.setFeature("pl", new StringRef("minus"));
2050                    nonterm.setFeatureMap(fm);
2051                    l.add(nonterm);
2052                    term = new Terminal("is");
2053                    l.add(term);
2054                    addGrammarRule(new GrammarRule(ann, l, false));
2055                    
2056                    // aux(be:plus, exist:minus, pl:minus)=> //, ['is not']
2057                    l.clear();
2058                    featureHash.clear();
2059                    ann = new Annotation();
2060                    nonterm = new Nonterminal("aux");
2061                    fm = new FeatureMap();
2062                    fm.setFeature("be", new StringRef("plus"));
2063                    fm.setFeature("exist", new StringRef("minus"));
2064                    fm.setFeature("pl", new StringRef("minus"));
2065                    nonterm.setFeatureMap(fm);
2066                    l.add(nonterm);
2067                    nonterm = new Nonterminal("//");
2068                    fm = new FeatureMap();
2069                    nonterm.setFeatureMap(fm);
2070                    l.add(nonterm);
2071                    term = new Terminal("is not");
2072                    l.add(term);
2073                    addGrammarRule(new GrammarRule(ann, l, false));
2074                    
2075                    // aux(be:plus, exist:minus, pl:minus)=> //, [is, not]
2076                    l.clear();
2077                    featureHash.clear();
2078                    ann = new Annotation();
2079                    nonterm = new Nonterminal("aux");
2080                    fm = new FeatureMap();
2081                    fm.setFeature("be", new StringRef("plus"));
2082                    fm.setFeature("exist", new StringRef("minus"));
2083                    fm.setFeature("pl", new StringRef("minus"));
2084                    nonterm.setFeatureMap(fm);
2085                    l.add(nonterm);
2086                    nonterm = new Nonterminal("//");
2087                    fm = new FeatureMap();
2088                    nonterm.setFeatureMap(fm);
2089                    l.add(nonterm);
2090                    term = new Terminal("is");
2091                    l.add(term);
2092                    term = new Terminal("not");
2093                    l.add(term);
2094                    addGrammarRule(new GrammarRule(ann, l, false));
2095                    
2096                    // aux(be:plus, exist:plus, pl:plus)=>[are]
2097                    l.clear();
2098                    featureHash.clear();
2099                    ann = new Annotation();
2100                    nonterm = new Nonterminal("aux");
2101                    fm = new FeatureMap();
2102                    fm.setFeature("be", new StringRef("plus"));
2103                    fm.setFeature("exist", new StringRef("plus"));
2104                    fm.setFeature("pl", new StringRef("plus"));
2105                    nonterm.setFeatureMap(fm);
2106                    l.add(nonterm);
2107                    term = new Terminal("are");
2108                    l.add(term);
2109                    addGrammarRule(new GrammarRule(ann, l, false));
2110                    
2111                    // aux(be:plus, exist:minus, pl:plus)=> //, ['are not']
2112                    l.clear();
2113                    featureHash.clear();
2114                    ann = new Annotation();
2115                    nonterm = new Nonterminal("aux");
2116                    fm = new FeatureMap();
2117                    fm.setFeature("be", new StringRef("plus"));
2118                    fm.setFeature("exist", new StringRef("minus"));
2119                    fm.setFeature("pl", new StringRef("plus"));
2120                    nonterm.setFeatureMap(fm);
2121                    l.add(nonterm);
2122                    nonterm = new Nonterminal("//");
2123                    fm = new FeatureMap();
2124                    nonterm.setFeatureMap(fm);
2125                    l.add(nonterm);
2126                    term = new Terminal("are not");
2127                    l.add(term);
2128                    addGrammarRule(new GrammarRule(ann, l, false));
2129                    
2130                    // aux(be:plus, exist:minus, pl:plus)=> //, [are, not]
2131                    l.clear();
2132                    featureHash.clear();
2133                    ann = new Annotation();
2134                    nonterm = new Nonterminal("aux");
2135                    fm = new FeatureMap();
2136                    fm.setFeature("be", new StringRef("plus"));
2137                    fm.setFeature("exist", new StringRef("minus"));
2138                    fm.setFeature("pl", new StringRef("plus"));
2139                    nonterm.setFeatureMap(fm);
2140                    l.add(nonterm);
2141                    nonterm = new Nonterminal("//");
2142                    fm = new FeatureMap();
2143                    nonterm.setFeatureMap(fm);
2144                    l.add(nonterm);
2145                    term = new Terminal("are");
2146                    l.add(term);
2147                    term = new Terminal("not");
2148                    l.add(term);
2149                    addGrammarRule(new GrammarRule(ann, l, false));
2150                    
2151                    // aux(be:minus, exist:minus, pl:minus)=> //, ['does not']
2152                    l.clear();
2153                    featureHash.clear();
2154                    ann = new Annotation();
2155                    nonterm = new Nonterminal("aux");
2156                    fm = new FeatureMap();
2157                    fm.setFeature("be", new StringRef("minus"));
2158                    fm.setFeature("exist", new StringRef("minus"));
2159                    fm.setFeature("pl", new StringRef("minus"));
2160                    nonterm.setFeatureMap(fm);
2161                    l.add(nonterm);
2162                    nonterm = new Nonterminal("//");
2163                    fm = new FeatureMap();
2164                    nonterm.setFeatureMap(fm);
2165                    l.add(nonterm);
2166                    term = new Terminal("does not");
2167                    l.add(term);
2168                    addGrammarRule(new GrammarRule(ann, l, false));
2169                    
2170                    // aux(be:minus, exist:minus, pl:plus)=> //, ['do not']
2171                    l.clear();
2172                    featureHash.clear();
2173                    ann = new Annotation();
2174                    nonterm = new Nonterminal("aux");
2175                    fm = new FeatureMap();
2176                    fm.setFeature("be", new StringRef("minus"));
2177                    fm.setFeature("exist", new StringRef("minus"));
2178                    fm.setFeature("pl", new StringRef("plus"));
2179                    nonterm.setFeatureMap(fm);
2180                    l.add(nonterm);
2181                    nonterm = new Nonterminal("//");
2182                    fm = new FeatureMap();
2183                    nonterm.setFeatureMap(fm);
2184                    l.add(nonterm);
2185                    term = new Terminal("do not");
2186                    l.add(term);
2187                    addGrammarRule(new GrammarRule(ann, l, false));
2188                    
2189                    
2190                    /* --- Quantifiers --- */
2191                    
2192                    /* Existential and universal quantifiers are represented by 'quant': */
2193                    
2194                    // quant(exist:plus)=>[a]
2195                    l.clear();
2196                    featureHash.clear();
2197                    ann = new Annotation();
2198                    nonterm = new Nonterminal("quant");
2199                    fm = new FeatureMap();
2200                    fm.setFeature("exist", new StringRef("plus"));
2201                    nonterm.setFeatureMap(fm);
2202                    l.add(nonterm);
2203                    term = new Terminal("a");
2204                    l.add(term);
2205                    addGrammarRule(new GrammarRule(ann, l, false));
2206                    
2207                    // quant(exist:plus)=>[an]
2208                    l.clear();
2209                    featureHash.clear();
2210                    ann = new Annotation();
2211                    nonterm = new Nonterminal("quant");
2212                    fm = new FeatureMap();
2213                    fm.setFeature("exist", new StringRef("plus"));
2214                    nonterm.setFeatureMap(fm);
2215                    l.add(nonterm);
2216                    term = new Terminal("an");
2217                    l.add(term);
2218                    addGrammarRule(new GrammarRule(ann, l, false));
2219                    
2220                    // quant(exist:minus, qu:minus)=> //, [every]
2221                    l.clear();
2222                    featureHash.clear();
2223                    ann = new Annotation();
2224                    nonterm = new Nonterminal("quant");
2225                    fm = new FeatureMap();
2226                    fm.setFeature("exist", new StringRef("minus"));
2227                    fm.setFeature("qu", new StringRef("minus"));
2228                    nonterm.setFeatureMap(fm);
2229                    l.add(nonterm);
2230                    nonterm = new Nonterminal("//");
2231                    fm = new FeatureMap();
2232                    nonterm.setFeatureMap(fm);
2233                    l.add(nonterm);
2234                    term = new Terminal("every");
2235                    l.add(term);
2236                    addGrammarRule(new GrammarRule(ann, l, false));
2237                    
2238                    // quant(exist:minus)=> //, [no]
2239                    l.clear();
2240                    featureHash.clear();
2241                    ann = new Annotation();
2242                    nonterm = new Nonterminal("quant");
2243                    fm = new FeatureMap();
2244                    fm.setFeature("exist", new StringRef("minus"));
2245                    nonterm.setFeatureMap(fm);
2246                    l.add(nonterm);
2247                    nonterm = new Nonterminal("//");
2248                    fm = new FeatureMap();
2249                    nonterm.setFeatureMap(fm);
2250                    l.add(nonterm);
2251                    term = new Terminal("no");
2252                    l.add(term);
2253                    addGrammarRule(new GrammarRule(ann, l, false));
2254                    
2255                    /* The category 'num_quant' stands for numerical quantifiers: */
2256                    
2257                    // num_quant=>['at least']
2258                    l.clear();
2259                    featureHash.clear();
2260                    ann = new Annotation();
2261                    nonterm = new Nonterminal("num_quant");
2262                    fm = new FeatureMap();
2263                    nonterm.setFeatureMap(fm);
2264                    l.add(nonterm);
2265                    term = new Terminal("at least");
2266                    l.add(term);
2267                    addGrammarRule(new GrammarRule(ann, l, false));
2268                    
2269                    // num_quant=>['at most']
2270                    l.clear();
2271                    featureHash.clear();
2272                    ann = new Annotation();
2273                    nonterm = new Nonterminal("num_quant");
2274                    fm = new FeatureMap();
2275                    nonterm.setFeatureMap(fm);
2276                    l.add(nonterm);
2277                    term = new Terminal("at most");
2278                    l.add(term);
2279                    addGrammarRule(new GrammarRule(ann, l, false));
2280                    
2281                    // num_quant=>['less than']
2282                    l.clear();
2283                    featureHash.clear();
2284                    ann = new Annotation();
2285                    nonterm = new Nonterminal("num_quant");
2286                    fm = new FeatureMap();
2287                    nonterm.setFeatureMap(fm);
2288                    l.add(nonterm);
2289                    term = new Terminal("less than");
2290                    l.add(term);
2291                    addGrammarRule(new GrammarRule(ann, l, false));
2292                    
2293                    // num_quant=>['more than']
2294                    l.clear();
2295                    featureHash.clear();
2296                    ann = new Annotation();
2297                    nonterm = new Nonterminal("num_quant");
2298                    fm = new FeatureMap();
2299                    nonterm.setFeatureMap(fm);
2300                    l.add(nonterm);
2301                    term = new Terminal("more than");
2302                    l.add(term);
2303                    addGrammarRule(new GrammarRule(ann, l, false));
2304                    
2305                    // num_quant=>[exactly]
2306                    l.clear();
2307                    featureHash.clear();
2308                    ann = new Annotation();
2309                    nonterm = new Nonterminal("num_quant");
2310                    fm = new FeatureMap();
2311                    nonterm.setFeatureMap(fm);
2312                    l.add(nonterm);
2313                    term = new Terminal("exactly");
2314                    l.add(term);
2315                    addGrammarRule(new GrammarRule(ann, l, false));
2316                    
2317                    
2318                    /* --- Indefinite Pronouns --- */
2319                    
2320                    /* Indefinite pronouns are represented by 'ipron': */
2321                    
2322                    // ipron(exist:plus, human:minus)=>[something]
2323                    l.clear();
2324                    featureHash.clear();
2325                    ann = new Annotation();
2326                    nonterm = new Nonterminal("ipron");
2327                    fm = new FeatureMap();
2328                    fm.setFeature("exist", new StringRef("plus"));
2329                    fm.setFeature("human", new StringRef("minus"));
2330                    nonterm.setFeatureMap(fm);
2331                    l.add(nonterm);
2332                    term = new Terminal("something");
2333                    l.add(term);
2334                    addGrammarRule(new GrammarRule(ann, l, false));
2335                    
2336                    // ipron(exist:plus, human:plus)=>[somebody]
2337                    l.clear();
2338                    featureHash.clear();
2339                    ann = new Annotation();
2340                    nonterm = new Nonterminal("ipron");
2341                    fm = new FeatureMap();
2342                    fm.setFeature("exist", new StringRef("plus"));
2343                    fm.setFeature("human", new StringRef("plus"));
2344                    nonterm.setFeatureMap(fm);
2345                    l.add(nonterm);
2346                    term = new Terminal("somebody");
2347                    l.add(term);
2348                    addGrammarRule(new GrammarRule(ann, l, false));
2349                    
2350                    // ipron(exist:minus, human:minus, qu:minus)=> //, [everything]
2351                    l.clear();
2352                    featureHash.clear();
2353                    ann = new Annotation();
2354                    nonterm = new Nonterminal("ipron");
2355                    fm = new FeatureMap();
2356                    fm.setFeature("exist", new StringRef("minus"));
2357                    fm.setFeature("human", new StringRef("minus"));
2358                    fm.setFeature("qu", new StringRef("minus"));
2359                    nonterm.setFeatureMap(fm);
2360                    l.add(nonterm);
2361                    nonterm = new Nonterminal("//");
2362                    fm = new FeatureMap();
2363                    nonterm.setFeatureMap(fm);
2364                    l.add(nonterm);
2365                    term = new Terminal("everything");
2366                    l.add(term);
2367                    addGrammarRule(new GrammarRule(ann, l, false));
2368                    
2369                    // ipron(exist:minus, human:plus, qu:minus)=> //, [everybody]
2370                    l.clear();
2371                    featureHash.clear();
2372                    ann = new Annotation();
2373                    nonterm = new Nonterminal("ipron");
2374                    fm = new FeatureMap();
2375                    fm.setFeature("exist", new StringRef("minus"));
2376                    fm.setFeature("human", new StringRef("plus"));
2377                    fm.setFeature("qu", new StringRef("minus"));
2378                    nonterm.setFeatureMap(fm);
2379                    l.add(nonterm);
2380                    nonterm = new Nonterminal("//");
2381                    fm = new FeatureMap();
2382                    nonterm.setFeatureMap(fm);
2383                    l.add(nonterm);
2384                    term = new Terminal("everybody");
2385                    l.add(term);
2386                    addGrammarRule(new GrammarRule(ann, l, false));
2387                    
2388                    // ipron(exist:minus, human:minus)=> //, [nothing]
2389                    l.clear();
2390                    featureHash.clear();
2391                    ann = new Annotation();
2392                    nonterm = new Nonterminal("ipron");
2393                    fm = new FeatureMap();
2394                    fm.setFeature("exist", new StringRef("minus"));
2395                    fm.setFeature("human", new StringRef("minus"));
2396                    nonterm.setFeatureMap(fm);
2397                    l.add(nonterm);
2398                    nonterm = new Nonterminal("//");
2399                    fm = new FeatureMap();
2400                    nonterm.setFeatureMap(fm);
2401                    l.add(nonterm);
2402                    term = new Terminal("nothing");
2403                    l.add(term);
2404                    addGrammarRule(new GrammarRule(ann, l, false));
2405                    
2406                    // ipron(exist:minus, human:plus)=> //, [nobody]
2407                    l.clear();
2408                    featureHash.clear();
2409                    ann = new Annotation();
2410                    nonterm = new Nonterminal("ipron");
2411                    fm = new FeatureMap();
2412                    fm.setFeature("exist", new StringRef("minus"));
2413                    fm.setFeature("human", new StringRef("plus"));
2414                    nonterm.setFeatureMap(fm);
2415                    l.add(nonterm);
2416                    nonterm = new Nonterminal("//");
2417                    fm = new FeatureMap();
2418                    nonterm.setFeatureMap(fm);
2419                    l.add(nonterm);
2420                    term = new Terminal("nobody");
2421                    l.add(term);
2422                    addGrammarRule(new GrammarRule(ann, l, false));
2423    
2424            }
2425    }