001 package ch.uzh.ifi.attempto.aceeditor; 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 ACEEditorGrammar extends ch.uzh.ifi.attempto.chartparser.Grammar { 028 029 public static final ACEEditorGrammar grammar = new ACEEditorGrammar(); 030 031 /** 032 * Creates a new grammar object. 033 */ 034 public ACEEditorGrammar() { 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 /* === ACE Editor Grammar === */ 046 047 /* - Tobias Kuhn, 26 November 2010 - */ 048 049 /* Below, the grammar rules of the ACE Editor 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("sentence"); 097 fm = new FeatureMap(); 098 nonterm.setFeatureMap(fm); 099 l.add(nonterm); 100 term = new Terminal("."); 101 l.add(term); 102 addGrammarRule(new GrammarRule(ann, l, false)); 103 104 // complete_sentence~> //, simple_sentence_2(qu:plus, whin:minus, whout:plus), [?] 105 l.clear(); 106 featureHash.clear(); 107 ann = new Annotation(); 108 nonterm = new Nonterminal("complete_sentence"); 109 fm = new FeatureMap(); 110 nonterm.setFeatureMap(fm); 111 l.add(nonterm); 112 nonterm = new Nonterminal("//"); 113 fm = new FeatureMap(); 114 nonterm.setFeatureMap(fm); 115 l.add(nonterm); 116 nonterm = new Nonterminal("simple_sentence_2"); 117 fm = new FeatureMap(); 118 fm.setFeature("qu", new StringRef("plus")); 119 fm.setFeature("whin", new StringRef("minus")); 120 fm.setFeature("whout", new StringRef("plus")); 121 nonterm.setFeatureMap(fm); 122 l.add(nonterm); 123 term = new Terminal("?"); 124 l.add(term); 125 addGrammarRule(new GrammarRule(ann, l, true)); 126 127 /* General sentences are represented by 'sentence': */ 128 129 // sentence=>sentence_coord_1 130 l.clear(); 131 featureHash.clear(); 132 ann = new Annotation(); 133 nonterm = new Nonterminal("sentence"); 134 fm = new FeatureMap(); 135 nonterm.setFeatureMap(fm); 136 l.add(nonterm); 137 nonterm = new Nonterminal("sentence_coord_1"); 138 fm = new FeatureMap(); 139 nonterm.setFeatureMap(fm); 140 l.add(nonterm); 141 addGrammarRule(new GrammarRule(ann, l, false)); 142 143 // sentence~> //, ['for every'], nc(subj:minus, qu:minus), sentence_coord_1 144 l.clear(); 145 featureHash.clear(); 146 ann = new Annotation(); 147 nonterm = new Nonterminal("sentence"); 148 fm = new FeatureMap(); 149 nonterm.setFeatureMap(fm); 150 l.add(nonterm); 151 nonterm = new Nonterminal("//"); 152 fm = new FeatureMap(); 153 nonterm.setFeatureMap(fm); 154 l.add(nonterm); 155 term = new Terminal("for every"); 156 l.add(term); 157 nonterm = new Nonterminal("nc"); 158 fm = new FeatureMap(); 159 fm.setFeature("subj", new StringRef("minus")); 160 fm.setFeature("qu", new StringRef("minus")); 161 nonterm.setFeatureMap(fm); 162 l.add(nonterm); 163 nonterm = new Nonterminal("sentence_coord_1"); 164 fm = new FeatureMap(); 165 nonterm.setFeatureMap(fm); 166 l.add(nonterm); 167 addGrammarRule(new GrammarRule(ann, l, true)); 168 169 // sentence~> //, [if], sentence_coord_1, [then], sentence_coord_1 170 l.clear(); 171 featureHash.clear(); 172 ann = new Annotation(); 173 nonterm = new Nonterminal("sentence"); 174 fm = new FeatureMap(); 175 nonterm.setFeatureMap(fm); 176 l.add(nonterm); 177 nonterm = new Nonterminal("//"); 178 fm = new FeatureMap(); 179 nonterm.setFeatureMap(fm); 180 l.add(nonterm); 181 term = new Terminal("if"); 182 l.add(term); 183 nonterm = new Nonterminal("sentence_coord_1"); 184 fm = new FeatureMap(); 185 nonterm.setFeatureMap(fm); 186 l.add(nonterm); 187 term = new Terminal("then"); 188 l.add(term); 189 nonterm = new Nonterminal("sentence_coord_1"); 190 fm = new FeatureMap(); 191 nonterm.setFeatureMap(fm); 192 l.add(nonterm); 193 addGrammarRule(new GrammarRule(ann, l, true)); 194 195 /* Sentences can be coordinated using "or" ('sentence_coord_1') and "and" 196 ('sentence_coord_2'): */ 197 198 // sentence_coord_1=>sentence_coord_2 199 l.clear(); 200 featureHash.clear(); 201 ann = new Annotation(); 202 nonterm = new Nonterminal("sentence_coord_1"); 203 fm = new FeatureMap(); 204 nonterm.setFeatureMap(fm); 205 l.add(nonterm); 206 nonterm = new Nonterminal("sentence_coord_2"); 207 fm = new FeatureMap(); 208 nonterm.setFeatureMap(fm); 209 l.add(nonterm); 210 addGrammarRule(new GrammarRule(ann, l, false)); 211 212 // sentence_coord_1~> //, sentence_coord_2, [or], sentence_coord_1 213 l.clear(); 214 featureHash.clear(); 215 ann = new Annotation(); 216 nonterm = new Nonterminal("sentence_coord_1"); 217 fm = new FeatureMap(); 218 nonterm.setFeatureMap(fm); 219 l.add(nonterm); 220 nonterm = new Nonterminal("//"); 221 fm = new FeatureMap(); 222 nonterm.setFeatureMap(fm); 223 l.add(nonterm); 224 nonterm = new Nonterminal("sentence_coord_2"); 225 fm = new FeatureMap(); 226 nonterm.setFeatureMap(fm); 227 l.add(nonterm); 228 term = new Terminal("or"); 229 l.add(term); 230 nonterm = new Nonterminal("sentence_coord_1"); 231 fm = new FeatureMap(); 232 nonterm.setFeatureMap(fm); 233 l.add(nonterm); 234 addGrammarRule(new GrammarRule(ann, l, true)); 235 236 // sentence_coord_2=>simple_sentence_1 237 l.clear(); 238 featureHash.clear(); 239 ann = new Annotation(); 240 nonterm = new Nonterminal("sentence_coord_2"); 241 fm = new FeatureMap(); 242 nonterm.setFeatureMap(fm); 243 l.add(nonterm); 244 nonterm = new Nonterminal("simple_sentence_1"); 245 fm = new FeatureMap(); 246 nonterm.setFeatureMap(fm); 247 l.add(nonterm); 248 addGrammarRule(new GrammarRule(ann, l, false)); 249 250 // sentence_coord_2=>simple_sentence_1, [and], sentence_coord_2 251 l.clear(); 252 featureHash.clear(); 253 ann = new Annotation(); 254 nonterm = new Nonterminal("sentence_coord_2"); 255 fm = new FeatureMap(); 256 nonterm.setFeatureMap(fm); 257 l.add(nonterm); 258 nonterm = new Nonterminal("simple_sentence_1"); 259 fm = new FeatureMap(); 260 nonterm.setFeatureMap(fm); 261 l.add(nonterm); 262 term = new Terminal("and"); 263 l.add(term); 264 nonterm = new Nonterminal("sentence_coord_2"); 265 fm = new FeatureMap(); 266 nonterm.setFeatureMap(fm); 267 l.add(nonterm); 268 addGrammarRule(new GrammarRule(ann, l, false)); 269 270 /* Uncoordinated sentences are represented in two levels by 'simple_sentence_1' and 271 'simple_sentence_2': */ 272 273 // simple_sentence_1~> //, ['it is false that'], simple_sentence_2(qu:minus) 274 l.clear(); 275 featureHash.clear(); 276 ann = new Annotation(); 277 nonterm = new Nonterminal("simple_sentence_1"); 278 fm = new FeatureMap(); 279 nonterm.setFeatureMap(fm); 280 l.add(nonterm); 281 nonterm = new Nonterminal("//"); 282 fm = new FeatureMap(); 283 nonterm.setFeatureMap(fm); 284 l.add(nonterm); 285 term = new Terminal("it is false that"); 286 l.add(term); 287 nonterm = new Nonterminal("simple_sentence_2"); 288 fm = new FeatureMap(); 289 fm.setFeature("qu", new StringRef("minus")); 290 nonterm.setFeatureMap(fm); 291 l.add(nonterm); 292 addGrammarRule(new GrammarRule(ann, l, true)); 293 294 // simple_sentence_1=>['there is'], np(subj:minus, exist:plus, def:minus, pl:minus, case:nom, qu:minus) 295 l.clear(); 296 featureHash.clear(); 297 ann = new Annotation(); 298 nonterm = new Nonterminal("simple_sentence_1"); 299 fm = new FeatureMap(); 300 nonterm.setFeatureMap(fm); 301 l.add(nonterm); 302 term = new Terminal("there is"); 303 l.add(term); 304 nonterm = new Nonterminal("np"); 305 fm = new FeatureMap(); 306 fm.setFeature("subj", new StringRef("minus")); 307 fm.setFeature("exist", new StringRef("plus")); 308 fm.setFeature("def", new StringRef("minus")); 309 fm.setFeature("pl", new StringRef("minus")); 310 fm.setFeature("case", new StringRef("nom")); 311 fm.setFeature("qu", new StringRef("minus")); 312 nonterm.setFeatureMap(fm); 313 l.add(nonterm); 314 addGrammarRule(new GrammarRule(ann, l, false)); 315 316 // simple_sentence_1=>['there is'], np(subj:minus, exist:plus, def:minus, pl:minus, case:nom, qu:minus), ['such that'], simple_sentence_1 317 l.clear(); 318 featureHash.clear(); 319 ann = new Annotation(); 320 nonterm = new Nonterminal("simple_sentence_1"); 321 fm = new FeatureMap(); 322 nonterm.setFeatureMap(fm); 323 l.add(nonterm); 324 term = new Terminal("there is"); 325 l.add(term); 326 nonterm = new Nonterminal("np"); 327 fm = new FeatureMap(); 328 fm.setFeature("subj", new StringRef("minus")); 329 fm.setFeature("exist", new StringRef("plus")); 330 fm.setFeature("def", new StringRef("minus")); 331 fm.setFeature("pl", new StringRef("minus")); 332 fm.setFeature("case", new StringRef("nom")); 333 fm.setFeature("qu", new StringRef("minus")); 334 nonterm.setFeatureMap(fm); 335 l.add(nonterm); 336 term = new Terminal("such that"); 337 l.add(term); 338 nonterm = new Nonterminal("simple_sentence_1"); 339 fm = new FeatureMap(); 340 nonterm.setFeatureMap(fm); 341 l.add(nonterm); 342 addGrammarRule(new GrammarRule(ann, l, false)); 343 344 // simple_sentence_1=>['there are'], np(subj:minus, exist:plus, def:minus, pl:plus, case:nom, qu:minus) 345 l.clear(); 346 featureHash.clear(); 347 ann = new Annotation(); 348 nonterm = new Nonterminal("simple_sentence_1"); 349 fm = new FeatureMap(); 350 nonterm.setFeatureMap(fm); 351 l.add(nonterm); 352 term = new Terminal("there are"); 353 l.add(term); 354 nonterm = new Nonterminal("np"); 355 fm = new FeatureMap(); 356 fm.setFeature("subj", new StringRef("minus")); 357 fm.setFeature("exist", new StringRef("plus")); 358 fm.setFeature("def", new StringRef("minus")); 359 fm.setFeature("pl", new StringRef("plus")); 360 fm.setFeature("case", new StringRef("nom")); 361 fm.setFeature("qu", new StringRef("minus")); 362 nonterm.setFeatureMap(fm); 363 l.add(nonterm); 364 addGrammarRule(new GrammarRule(ann, l, false)); 365 366 // simple_sentence_1=>simple_sentence_2(qu:minus) 367 l.clear(); 368 featureHash.clear(); 369 ann = new Annotation(); 370 nonterm = new Nonterminal("simple_sentence_1"); 371 fm = new FeatureMap(); 372 nonterm.setFeatureMap(fm); 373 l.add(nonterm); 374 nonterm = new Nonterminal("simple_sentence_2"); 375 fm = new FeatureMap(); 376 fm.setFeature("qu", new StringRef("minus")); 377 nonterm.setFeatureMap(fm); 378 l.add(nonterm); 379 addGrammarRule(new GrammarRule(ann, l, false)); 380 381 // simple_sentence_2(qu:A, whin:B, whout:C)~>np(id:D, subj:minus, pl:E, case:nom, qu:A, whin:B, whout:F), vp_coord_1(subj:D, pl:E, qu:A, whin:F, whout:C) 382 l.clear(); 383 featureHash.clear(); 384 ann = new Annotation(); 385 nonterm = new Nonterminal("simple_sentence_2"); 386 fm = new FeatureMap(); 387 setFeature(fm, "qu", 0, featureHash); 388 setFeature(fm, "whin", 1, featureHash); 389 setFeature(fm, "whout", 2, featureHash); 390 nonterm.setFeatureMap(fm); 391 l.add(nonterm); 392 nonterm = new Nonterminal("np"); 393 fm = new FeatureMap(); 394 setFeature(fm, "id", 3, featureHash); 395 fm.setFeature("subj", new StringRef("minus")); 396 setFeature(fm, "pl", 4, featureHash); 397 fm.setFeature("case", new StringRef("nom")); 398 setFeature(fm, "qu", 0, featureHash); 399 setFeature(fm, "whin", 1, featureHash); 400 setFeature(fm, "whout", 5, featureHash); 401 nonterm.setFeatureMap(fm); 402 l.add(nonterm); 403 nonterm = new Nonterminal("vp_coord_1"); 404 fm = new FeatureMap(); 405 setFeature(fm, "subj", 3, featureHash); 406 setFeature(fm, "pl", 4, featureHash); 407 setFeature(fm, "qu", 0, featureHash); 408 setFeature(fm, "whin", 5, featureHash); 409 setFeature(fm, "whout", 2, featureHash); 410 nonterm.setFeatureMap(fm); 411 l.add(nonterm); 412 addGrammarRule(new GrammarRule(ann, l, true)); 413 414 415 /* --- Verb Phrases --- */ 416 417 /* Like sentences, verb phrases can be coordinated using "or" ('vp_coord_1') and "and" 418 ('vp_coord_2'): */ 419 420 // vp_coord_1(subj:A, pl:B, qu:C, whin:D, whout:E)=>vp_coord_2(subj:A, pl:B, qu:C, whin:D, whout:E) 421 l.clear(); 422 featureHash.clear(); 423 ann = new Annotation(); 424 nonterm = new Nonterminal("vp_coord_1"); 425 fm = new FeatureMap(); 426 setFeature(fm, "subj", 0, featureHash); 427 setFeature(fm, "pl", 1, featureHash); 428 setFeature(fm, "qu", 2, featureHash); 429 setFeature(fm, "whin", 3, featureHash); 430 setFeature(fm, "whout", 4, featureHash); 431 nonterm.setFeatureMap(fm); 432 l.add(nonterm); 433 nonterm = new Nonterminal("vp_coord_2"); 434 fm = new FeatureMap(); 435 setFeature(fm, "subj", 0, featureHash); 436 setFeature(fm, "pl", 1, featureHash); 437 setFeature(fm, "qu", 2, featureHash); 438 setFeature(fm, "whin", 3, featureHash); 439 setFeature(fm, "whout", 4, featureHash); 440 nonterm.setFeatureMap(fm); 441 l.add(nonterm); 442 addGrammarRule(new GrammarRule(ann, l, false)); 443 444 // vp_coord_1(subj:A, pl:B, qu:C, whin:D, whout:E)~> //, vp_coord_2(subj:A, pl:B, qu:C, whin:D, whout:F), [or], vp_coord_1(subj:A, pl:B, qu:C, whin:F, whout:E) 445 l.clear(); 446 featureHash.clear(); 447 ann = new Annotation(); 448 nonterm = new Nonterminal("vp_coord_1"); 449 fm = new FeatureMap(); 450 setFeature(fm, "subj", 0, featureHash); 451 setFeature(fm, "pl", 1, featureHash); 452 setFeature(fm, "qu", 2, featureHash); 453 setFeature(fm, "whin", 3, featureHash); 454 setFeature(fm, "whout", 4, featureHash); 455 nonterm.setFeatureMap(fm); 456 l.add(nonterm); 457 nonterm = new Nonterminal("//"); 458 fm = new FeatureMap(); 459 nonterm.setFeatureMap(fm); 460 l.add(nonterm); 461 nonterm = new Nonterminal("vp_coord_2"); 462 fm = new FeatureMap(); 463 setFeature(fm, "subj", 0, featureHash); 464 setFeature(fm, "pl", 1, featureHash); 465 setFeature(fm, "qu", 2, featureHash); 466 setFeature(fm, "whin", 3, featureHash); 467 setFeature(fm, "whout", 5, featureHash); 468 nonterm.setFeatureMap(fm); 469 l.add(nonterm); 470 term = new Terminal("or"); 471 l.add(term); 472 nonterm = new Nonterminal("vp_coord_1"); 473 fm = new FeatureMap(); 474 setFeature(fm, "subj", 0, featureHash); 475 setFeature(fm, "pl", 1, featureHash); 476 setFeature(fm, "qu", 2, featureHash); 477 setFeature(fm, "whin", 5, featureHash); 478 setFeature(fm, "whout", 4, featureHash); 479 nonterm.setFeatureMap(fm); 480 l.add(nonterm); 481 addGrammarRule(new GrammarRule(ann, l, true)); 482 483 // vp_coord_2(subj:A, pl:B, qu:C, whin:D, whout:E)=>vp(subj:A, pl:B, qu:C, whin:D, whout:E) 484 l.clear(); 485 featureHash.clear(); 486 ann = new Annotation(); 487 nonterm = new Nonterminal("vp_coord_2"); 488 fm = new FeatureMap(); 489 setFeature(fm, "subj", 0, featureHash); 490 setFeature(fm, "pl", 1, featureHash); 491 setFeature(fm, "qu", 2, featureHash); 492 setFeature(fm, "whin", 3, featureHash); 493 setFeature(fm, "whout", 4, featureHash); 494 nonterm.setFeatureMap(fm); 495 l.add(nonterm); 496 nonterm = new Nonterminal("vp"); 497 fm = new FeatureMap(); 498 setFeature(fm, "subj", 0, featureHash); 499 setFeature(fm, "pl", 1, featureHash); 500 setFeature(fm, "qu", 2, featureHash); 501 setFeature(fm, "whin", 3, featureHash); 502 setFeature(fm, "whout", 4, featureHash); 503 nonterm.setFeatureMap(fm); 504 l.add(nonterm); 505 addGrammarRule(new GrammarRule(ann, l, false)); 506 507 // vp_coord_2(subj:A, pl:B, qu:C, whin:D, whout:E)=>vp(subj:A, pl:B, qu:C, whin:D, whout:F), [and], vp_coord_2(subj:A, pl:B, qu:C, whin:F, whout:E) 508 l.clear(); 509 featureHash.clear(); 510 ann = new Annotation(); 511 nonterm = new Nonterminal("vp_coord_2"); 512 fm = new FeatureMap(); 513 setFeature(fm, "subj", 0, featureHash); 514 setFeature(fm, "pl", 1, featureHash); 515 setFeature(fm, "qu", 2, featureHash); 516 setFeature(fm, "whin", 3, featureHash); 517 setFeature(fm, "whout", 4, featureHash); 518 nonterm.setFeatureMap(fm); 519 l.add(nonterm); 520 nonterm = new Nonterminal("vp"); 521 fm = new FeatureMap(); 522 setFeature(fm, "subj", 0, featureHash); 523 setFeature(fm, "pl", 1, featureHash); 524 setFeature(fm, "qu", 2, featureHash); 525 setFeature(fm, "whin", 3, featureHash); 526 setFeature(fm, "whout", 5, featureHash); 527 nonterm.setFeatureMap(fm); 528 l.add(nonterm); 529 term = new Terminal("and"); 530 l.add(term); 531 nonterm = new Nonterminal("vp_coord_2"); 532 fm = new FeatureMap(); 533 setFeature(fm, "subj", 0, featureHash); 534 setFeature(fm, "pl", 1, featureHash); 535 setFeature(fm, "qu", 2, featureHash); 536 setFeature(fm, "whin", 5, featureHash); 537 setFeature(fm, "whout", 4, featureHash); 538 nonterm.setFeatureMap(fm); 539 l.add(nonterm); 540 addGrammarRule(new GrammarRule(ann, l, false)); 541 542 /* Uncoordinated verb phrases represented by 'vp' can use an auxiliary verb and can have 543 verb phrase modifiers: */ 544 545 // vp(subj:A, exist:B, rel:C, pl:D, qu:E, whin:F, whout:G)~>aux(be:H, exist:B, pl:D), v(subj:A, be:H, exist:B, pl:D, rel:C, vform:inf, embv:I, copula:J, qu:E, whin:F, whout:K), vmod(subj:A, embv:I, copula:J, qu:E, whin:K, whout:G) 546 l.clear(); 547 featureHash.clear(); 548 ann = new Annotation(); 549 nonterm = new Nonterminal("vp"); 550 fm = new FeatureMap(); 551 setFeature(fm, "subj", 0, featureHash); 552 setFeature(fm, "exist", 1, featureHash); 553 setFeature(fm, "rel", 2, featureHash); 554 setFeature(fm, "pl", 3, featureHash); 555 setFeature(fm, "qu", 4, featureHash); 556 setFeature(fm, "whin", 5, featureHash); 557 setFeature(fm, "whout", 6, featureHash); 558 nonterm.setFeatureMap(fm); 559 l.add(nonterm); 560 nonterm = new Nonterminal("aux"); 561 fm = new FeatureMap(); 562 setFeature(fm, "be", 7, featureHash); 563 setFeature(fm, "exist", 1, featureHash); 564 setFeature(fm, "pl", 3, featureHash); 565 nonterm.setFeatureMap(fm); 566 l.add(nonterm); 567 nonterm = new Nonterminal("v"); 568 fm = new FeatureMap(); 569 setFeature(fm, "subj", 0, featureHash); 570 setFeature(fm, "be", 7, featureHash); 571 setFeature(fm, "exist", 1, featureHash); 572 setFeature(fm, "pl", 3, featureHash); 573 setFeature(fm, "rel", 2, featureHash); 574 fm.setFeature("vform", new StringRef("inf")); 575 setFeature(fm, "embv", 8, featureHash); 576 setFeature(fm, "copula", 9, featureHash); 577 setFeature(fm, "qu", 4, featureHash); 578 setFeature(fm, "whin", 5, featureHash); 579 setFeature(fm, "whout", 10, featureHash); 580 nonterm.setFeatureMap(fm); 581 l.add(nonterm); 582 nonterm = new Nonterminal("vmod"); 583 fm = new FeatureMap(); 584 setFeature(fm, "subj", 0, featureHash); 585 setFeature(fm, "embv", 8, featureHash); 586 setFeature(fm, "copula", 9, featureHash); 587 setFeature(fm, "qu", 4, featureHash); 588 setFeature(fm, "whin", 10, featureHash); 589 setFeature(fm, "whout", 6, featureHash); 590 nonterm.setFeatureMap(fm); 591 l.add(nonterm); 592 addGrammarRule(new GrammarRule(ann, l, true)); 593 594 // 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, embv:G, copula:H, qu:D, whin:E, whout:I), vmod(subj:A, embv:G, copula:H, qu:D, whin:I, whout:F) 595 l.clear(); 596 featureHash.clear(); 597 ann = new Annotation(); 598 nonterm = new Nonterminal("vp"); 599 fm = new FeatureMap(); 600 setFeature(fm, "subj", 0, featureHash); 601 fm.setFeature("exist", new StringRef("plus")); 602 setFeature(fm, "rel", 1, featureHash); 603 setFeature(fm, "pl", 2, featureHash); 604 setFeature(fm, "qu", 3, featureHash); 605 setFeature(fm, "whin", 4, featureHash); 606 setFeature(fm, "whout", 5, featureHash); 607 nonterm.setFeatureMap(fm); 608 l.add(nonterm); 609 nonterm = new Nonterminal("v"); 610 fm = new FeatureMap(); 611 setFeature(fm, "subj", 0, featureHash); 612 fm.setFeature("be", new StringRef("minus")); 613 fm.setFeature("exist", new StringRef("plus")); 614 setFeature(fm, "pl", 2, featureHash); 615 setFeature(fm, "rel", 1, featureHash); 616 fm.setFeature("vform", new StringRef("fin")); 617 setFeature(fm, "embv", 6, featureHash); 618 setFeature(fm, "copula", 7, featureHash); 619 setFeature(fm, "qu", 3, featureHash); 620 setFeature(fm, "whin", 4, featureHash); 621 setFeature(fm, "whout", 8, featureHash); 622 nonterm.setFeatureMap(fm); 623 l.add(nonterm); 624 nonterm = new Nonterminal("vmod"); 625 fm = new FeatureMap(); 626 setFeature(fm, "subj", 0, featureHash); 627 setFeature(fm, "embv", 6, featureHash); 628 setFeature(fm, "copula", 7, featureHash); 629 setFeature(fm, "qu", 3, featureHash); 630 setFeature(fm, "whin", 8, featureHash); 631 setFeature(fm, "whout", 5, featureHash); 632 nonterm.setFeatureMap(fm); 633 l.add(nonterm); 634 addGrammarRule(new GrammarRule(ann, l, true)); 635 636 /* The category 'v' represents the main verb or - if "be" is used as a copula verb - the 637 complementing noun phrase or adjective complement: */ 638 639 // v(be:minus, pl:A, vform:B, copula:minus, whin:C, whout:C)=>verb(vcat:itr, be:minus, pl:A, vform:B) 640 l.clear(); 641 featureHash.clear(); 642 ann = new Annotation(); 643 nonterm = new Nonterminal("v"); 644 fm = new FeatureMap(); 645 fm.setFeature("be", new StringRef("minus")); 646 setFeature(fm, "pl", 0, featureHash); 647 setFeature(fm, "vform", 1, featureHash); 648 fm.setFeature("copula", new StringRef("minus")); 649 setFeature(fm, "whin", 2, featureHash); 650 setFeature(fm, "whout", 2, featureHash); 651 nonterm.setFeatureMap(fm); 652 l.add(nonterm); 653 nonterm = new Nonterminal("verb"); 654 fm = new FeatureMap(); 655 fm.setFeature("vcat", new StringRef("itr")); 656 fm.setFeature("be", new StringRef("minus")); 657 setFeature(fm, "pl", 0, featureHash); 658 setFeature(fm, "vform", 1, featureHash); 659 nonterm.setFeatureMap(fm); 660 l.add(nonterm); 661 addGrammarRule(new GrammarRule(ann, l, false)); 662 663 // v(subj:A, be:minus, rel:B, pl:C, vform:D, embv:E, copula:minus, qu:F, whin:G, whout:H)=>verb(vcat:tr, be:minus, pl:C, vform:D), np(subj:A, rel:B, vcat:tr, embv:E, case:acc, qu:F, whin:G, whout:H) 664 l.clear(); 665 featureHash.clear(); 666 ann = new Annotation(); 667 nonterm = new Nonterminal("v"); 668 fm = new FeatureMap(); 669 setFeature(fm, "subj", 0, featureHash); 670 fm.setFeature("be", new StringRef("minus")); 671 setFeature(fm, "rel", 1, featureHash); 672 setFeature(fm, "pl", 2, featureHash); 673 setFeature(fm, "vform", 3, featureHash); 674 setFeature(fm, "embv", 4, featureHash); 675 fm.setFeature("copula", new StringRef("minus")); 676 setFeature(fm, "qu", 5, featureHash); 677 setFeature(fm, "whin", 6, featureHash); 678 setFeature(fm, "whout", 7, featureHash); 679 nonterm.setFeatureMap(fm); 680 l.add(nonterm); 681 nonterm = new Nonterminal("verb"); 682 fm = new FeatureMap(); 683 fm.setFeature("vcat", new StringRef("tr")); 684 fm.setFeature("be", new StringRef("minus")); 685 setFeature(fm, "pl", 2, featureHash); 686 setFeature(fm, "vform", 3, featureHash); 687 nonterm.setFeatureMap(fm); 688 l.add(nonterm); 689 nonterm = new Nonterminal("np"); 690 fm = new FeatureMap(); 691 setFeature(fm, "subj", 0, featureHash); 692 setFeature(fm, "rel", 1, featureHash); 693 fm.setFeature("vcat", new StringRef("tr")); 694 setFeature(fm, "embv", 4, featureHash); 695 fm.setFeature("case", new StringRef("acc")); 696 setFeature(fm, "qu", 5, featureHash); 697 setFeature(fm, "whin", 6, featureHash); 698 setFeature(fm, "whout", 7, featureHash); 699 nonterm.setFeatureMap(fm); 700 l.add(nonterm); 701 addGrammarRule(new GrammarRule(ann, l, false)); 702 703 // v(subj:A, be:plus, rel:B, embv:C, copula:minus, qu:D, whin:E, whout:F)=>verb(vcat:tr, be:plus), [by], np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:F) 704 l.clear(); 705 featureHash.clear(); 706 ann = new Annotation(); 707 nonterm = new Nonterminal("v"); 708 fm = new FeatureMap(); 709 setFeature(fm, "subj", 0, featureHash); 710 fm.setFeature("be", new StringRef("plus")); 711 setFeature(fm, "rel", 1, featureHash); 712 setFeature(fm, "embv", 2, featureHash); 713 fm.setFeature("copula", new StringRef("minus")); 714 setFeature(fm, "qu", 3, featureHash); 715 setFeature(fm, "whin", 4, featureHash); 716 setFeature(fm, "whout", 5, featureHash); 717 nonterm.setFeatureMap(fm); 718 l.add(nonterm); 719 nonterm = new Nonterminal("verb"); 720 fm = new FeatureMap(); 721 fm.setFeature("vcat", new StringRef("tr")); 722 fm.setFeature("be", new StringRef("plus")); 723 nonterm.setFeatureMap(fm); 724 l.add(nonterm); 725 term = new Terminal("by"); 726 l.add(term); 727 nonterm = new Nonterminal("np"); 728 fm = new FeatureMap(); 729 setFeature(fm, "subj", 0, featureHash); 730 setFeature(fm, "rel", 1, featureHash); 731 fm.setFeature("copula", new StringRef("minus")); 732 setFeature(fm, "embv", 2, featureHash); 733 fm.setFeature("case", new StringRef("acc")); 734 setFeature(fm, "qu", 3, featureHash); 735 setFeature(fm, "whin", 4, featureHash); 736 setFeature(fm, "whout", 5, featureHash); 737 nonterm.setFeatureMap(fm); 738 l.add(nonterm); 739 addGrammarRule(new GrammarRule(ann, l, false)); 740 741 // 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) 742 l.clear(); 743 featureHash.clear(); 744 ann = new Annotation(); 745 nonterm = new Nonterminal("v"); 746 fm = new FeatureMap(); 747 setFeature(fm, "subj", 0, featureHash); 748 fm.setFeature("be", new StringRef("plus")); 749 setFeature(fm, "rel", 1, featureHash); 750 setFeature(fm, "embv", 2, featureHash); 751 fm.setFeature("copula", new StringRef("plus")); 752 setFeature(fm, "qu", 3, featureHash); 753 setFeature(fm, "whin", 4, featureHash); 754 setFeature(fm, "whout", 5, featureHash); 755 nonterm.setFeatureMap(fm); 756 l.add(nonterm); 757 nonterm = new Nonterminal("np"); 758 fm = new FeatureMap(); 759 setFeature(fm, "subj", 0, featureHash); 760 fm.setFeature("of", new StringRef("plus")); 761 setFeature(fm, "rel", 1, featureHash); 762 fm.setFeature("pl", new StringRef("minus")); 763 fm.setFeature("copula", new StringRef("plus")); 764 setFeature(fm, "embv", 2, featureHash); 765 fm.setFeature("case", new StringRef("acc")); 766 setFeature(fm, "qu", 3, featureHash); 767 setFeature(fm, "whin", 4, featureHash); 768 setFeature(fm, "whout", 5, featureHash); 769 nonterm.setFeatureMap(fm); 770 l.add(nonterm); 771 addGrammarRule(new GrammarRule(ann, l, false)); 772 773 // v(subj:A, be:plus, rel:B, pl: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) 774 l.clear(); 775 featureHash.clear(); 776 ann = new Annotation(); 777 nonterm = new Nonterminal("v"); 778 fm = new FeatureMap(); 779 setFeature(fm, "subj", 0, featureHash); 780 fm.setFeature("be", new StringRef("plus")); 781 setFeature(fm, "rel", 1, featureHash); 782 fm.setFeature("pl", new StringRef("minus")); 783 setFeature(fm, "embv", 2, featureHash); 784 fm.setFeature("copula", new StringRef("plus")); 785 setFeature(fm, "qu", 3, featureHash); 786 setFeature(fm, "whin", 4, featureHash); 787 setFeature(fm, "whout", 5, featureHash); 788 nonterm.setFeatureMap(fm); 789 l.add(nonterm); 790 nonterm = new Nonterminal("np"); 791 fm = new FeatureMap(); 792 setFeature(fm, "subj", 0, featureHash); 793 fm.setFeature("of", new StringRef("minus")); 794 setFeature(fm, "rel", 1, featureHash); 795 fm.setFeature("pl", new StringRef("minus")); 796 fm.setFeature("copula", new StringRef("plus")); 797 setFeature(fm, "embv", 2, featureHash); 798 fm.setFeature("case", new StringRef("acc")); 799 setFeature(fm, "qu", 3, featureHash); 800 setFeature(fm, "whin", 4, featureHash); 801 setFeature(fm, "whout", 5, featureHash); 802 nonterm.setFeatureMap(fm); 803 l.add(nonterm); 804 addGrammarRule(new GrammarRule(ann, l, false)); 805 806 // v(be:plus, copula:plus, whin:A, whout:A)=>adj_coord 807 l.clear(); 808 featureHash.clear(); 809 ann = new Annotation(); 810 nonterm = new Nonterminal("v"); 811 fm = new FeatureMap(); 812 fm.setFeature("be", new StringRef("plus")); 813 fm.setFeature("copula", new StringRef("plus")); 814 setFeature(fm, "whin", 0, featureHash); 815 setFeature(fm, "whout", 0, featureHash); 816 nonterm.setFeatureMap(fm); 817 l.add(nonterm); 818 nonterm = new Nonterminal("adj_coord"); 819 fm = new FeatureMap(); 820 nonterm.setFeatureMap(fm); 821 l.add(nonterm); 822 addGrammarRule(new GrammarRule(ann, l, false)); 823 824 // v(subj:A, be:plus, rel:B, embv:C, copula:plus, qu:D, whin:E, whout:F)=>adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F) 825 l.clear(); 826 featureHash.clear(); 827 ann = new Annotation(); 828 nonterm = new Nonterminal("v"); 829 fm = new FeatureMap(); 830 setFeature(fm, "subj", 0, featureHash); 831 fm.setFeature("be", new StringRef("plus")); 832 setFeature(fm, "rel", 1, featureHash); 833 setFeature(fm, "embv", 2, featureHash); 834 fm.setFeature("copula", new StringRef("plus")); 835 setFeature(fm, "qu", 3, featureHash); 836 setFeature(fm, "whin", 4, featureHash); 837 setFeature(fm, "whout", 5, featureHash); 838 nonterm.setFeatureMap(fm); 839 l.add(nonterm); 840 nonterm = new Nonterminal("adjc"); 841 fm = new FeatureMap(); 842 setFeature(fm, "subj", 0, featureHash); 843 setFeature(fm, "rel", 1, featureHash); 844 setFeature(fm, "embv", 2, featureHash); 845 setFeature(fm, "qu", 3, featureHash); 846 setFeature(fm, "whin", 4, featureHash); 847 setFeature(fm, "whout", 5, featureHash); 848 nonterm.setFeatureMap(fm); 849 l.add(nonterm); 850 addGrammarRule(new GrammarRule(ann, l, false)); 851 852 853 /* --- Noun Phrases --- */ 854 855 /* Noun phrases are represented by 'np' and can consist of proper names, variables, 856 pronouns, and different noun constructs: */ 857 858 // np(id:A, exist:plus, rel:B, of:minus, def:plus, pl:minus, embv:C, qu:D, whin:E, whout:F)=>prop(id:A, human:G, gender:H), >>(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) 859 l.clear(); 860 featureHash.clear(); 861 ann = new Annotation(); 862 nonterm = new Nonterminal("np"); 863 fm = new FeatureMap(); 864 setFeature(fm, "id", 0, featureHash); 865 fm.setFeature("exist", new StringRef("plus")); 866 setFeature(fm, "rel", 1, featureHash); 867 fm.setFeature("of", new StringRef("minus")); 868 fm.setFeature("def", new StringRef("plus")); 869 fm.setFeature("pl", new StringRef("minus")); 870 setFeature(fm, "embv", 2, featureHash); 871 setFeature(fm, "qu", 3, featureHash); 872 setFeature(fm, "whin", 4, featureHash); 873 setFeature(fm, "whout", 5, featureHash); 874 nonterm.setFeatureMap(fm); 875 l.add(nonterm); 876 nonterm = new Nonterminal("prop"); 877 fm = new FeatureMap(); 878 setFeature(fm, "id", 0, featureHash); 879 setFeature(fm, "human", 6, featureHash); 880 setFeature(fm, "gender", 7, featureHash); 881 nonterm.setFeatureMap(fm); 882 l.add(nonterm); 883 nonterm = new Nonterminal(">>"); 884 fm = new FeatureMap(); 885 setFeature(fm, "id", 0, featureHash); 886 setFeature(fm, "human", 6, featureHash); 887 setFeature(fm, "gender", 7, featureHash); 888 fm.setFeature("type", new StringRef("prop")); 889 fm.setFeature("hasvar", new StringRef("minus")); 890 nonterm.setFeatureMap(fm); 891 l.add(nonterm); 892 nonterm = new Nonterminal("relcl"); 893 fm = new FeatureMap(); 894 setFeature(fm, "subj", 0, featureHash); 895 setFeature(fm, "rel", 1, featureHash); 896 setFeature(fm, "embv", 2, featureHash); 897 setFeature(fm, "human", 6, featureHash); 898 setFeature(fm, "qu", 3, featureHash); 899 setFeature(fm, "whin", 4, featureHash); 900 setFeature(fm, "whout", 5, featureHash); 901 nonterm.setFeatureMap(fm); 902 l.add(nonterm); 903 addGrammarRule(new GrammarRule(ann, l, false)); 904 905 // 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) 906 l.clear(); 907 featureHash.clear(); 908 ann = new Annotation(); 909 nonterm = new Nonterminal("np"); 910 fm = new FeatureMap(); 911 setFeature(fm, "id", 0, featureHash); 912 fm.setFeature("exist", new StringRef("plus")); 913 fm.setFeature("of", new StringRef("minus")); 914 fm.setFeature("def", new StringRef("plus")); 915 fm.setFeature("pl", new StringRef("minus")); 916 setFeature(fm, "whin", 1, featureHash); 917 setFeature(fm, "whout", 1, featureHash); 918 nonterm.setFeatureMap(fm); 919 l.add(nonterm); 920 nonterm = new Nonterminal("#"); 921 fm = new FeatureMap(); 922 setFeature(fm, "pos", 0, featureHash); 923 nonterm.setFeatureMap(fm); 924 l.add(nonterm); 925 nonterm = new Nonterminal("newvar"); 926 fm = new FeatureMap(); 927 setFeature(fm, "var", 2, featureHash); 928 nonterm.setFeatureMap(fm); 929 l.add(nonterm); 930 nonterm = new Nonterminal(">"); 931 fm = new FeatureMap(); 932 setFeature(fm, "id", 0, featureHash); 933 fm.setFeature("type", new StringRef("var")); 934 fm.setFeature("hasvar", new StringRef("plus")); 935 setFeature(fm, "var", 2, featureHash); 936 nonterm.setFeatureMap(fm); 937 l.add(nonterm); 938 addGrammarRule(new GrammarRule(ann, l, false)); 939 940 // np(id:A, exist:plus, of:minus, def:plus, pl:minus, whin:B, whout:B)=> $def_noun_sg(noun:C), $ref(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) 941 l.clear(); 942 featureHash.clear(); 943 ann = new Annotation(); 944 nonterm = new Nonterminal("np"); 945 fm = new FeatureMap(); 946 setFeature(fm, "id", 0, featureHash); 947 fm.setFeature("exist", new StringRef("plus")); 948 fm.setFeature("of", new StringRef("minus")); 949 fm.setFeature("def", new StringRef("plus")); 950 fm.setFeature("pl", new StringRef("minus")); 951 setFeature(fm, "whin", 1, featureHash); 952 setFeature(fm, "whout", 1, featureHash); 953 nonterm.setFeatureMap(fm); 954 l.add(nonterm); 955 preterm = new Preterminal("def_noun_sg"); 956 fm = new FeatureMap(); 957 setFeature(fm, "noun", 2, featureHash); 958 preterm.setFeatureMap(fm); 959 l.add(preterm); 960 preterm = new Preterminal("ref"); 961 fm = new FeatureMap(); 962 setFeature(fm, "text", 3, featureHash); 963 preterm.setFeatureMap(fm); 964 l.add(preterm); 965 brefcat = new BackrefCategory(); 966 fm = new FeatureMap(); 967 setFeature(fm, "id", 0, featureHash); 968 fm.setFeature("type", new StringRef("noun")); 969 fm.setFeature("hasvar", new StringRef("plus")); 970 setFeature(fm, "noun", 2, featureHash); 971 setFeature(fm, "var", 3, featureHash); 972 setFeature(fm, "human", 4, featureHash); 973 setFeature(fm, "gender", 5, featureHash); 974 brefcat.addPosFeatureMap(fm); 975 l.add(brefcat); 976 nonterm = new Nonterminal(">"); 977 fm = new FeatureMap(); 978 setFeature(fm, "id", 0, featureHash); 979 setFeature(fm, "human", 4, featureHash); 980 setFeature(fm, "gender", 5, featureHash); 981 fm.setFeature("type", new StringRef("ref")); 982 fm.setFeature("hasvar", new StringRef("minus")); 983 nonterm.setFeatureMap(fm); 984 l.add(nonterm); 985 addGrammarRule(new GrammarRule(ann, l, false)); 986 987 // np(id:A, exist:plus, of:minus, def:plus, pl:minus, whin:B, whout:B)=> $def_noun_sg(noun:C), <(id:A, type:noun, noun:C, human:D, gender:E), >(id:A, human:D, gender:E, type:ref, hasvar:minus) 988 l.clear(); 989 featureHash.clear(); 990 ann = new Annotation(); 991 nonterm = new Nonterminal("np"); 992 fm = new FeatureMap(); 993 setFeature(fm, "id", 0, featureHash); 994 fm.setFeature("exist", new StringRef("plus")); 995 fm.setFeature("of", new StringRef("minus")); 996 fm.setFeature("def", new StringRef("plus")); 997 fm.setFeature("pl", new StringRef("minus")); 998 setFeature(fm, "whin", 1, featureHash); 999 setFeature(fm, "whout", 1, featureHash); 1000 nonterm.setFeatureMap(fm); 1001 l.add(nonterm); 1002 preterm = new Preterminal("def_noun_sg"); 1003 fm = new FeatureMap(); 1004 setFeature(fm, "noun", 2, featureHash); 1005 preterm.setFeatureMap(fm); 1006 l.add(preterm); 1007 brefcat = new BackrefCategory(); 1008 fm = new FeatureMap(); 1009 setFeature(fm, "id", 0, featureHash); 1010 fm.setFeature("type", new StringRef("noun")); 1011 setFeature(fm, "noun", 2, featureHash); 1012 setFeature(fm, "human", 3, featureHash); 1013 setFeature(fm, "gender", 4, featureHash); 1014 brefcat.addPosFeatureMap(fm); 1015 l.add(brefcat); 1016 nonterm = new Nonterminal(">"); 1017 fm = new FeatureMap(); 1018 setFeature(fm, "id", 0, featureHash); 1019 setFeature(fm, "human", 3, featureHash); 1020 setFeature(fm, "gender", 4, featureHash); 1021 fm.setFeature("type", new StringRef("ref")); 1022 fm.setFeature("hasvar", new StringRef("minus")); 1023 nonterm.setFeatureMap(fm); 1024 l.add(nonterm); 1025 addGrammarRule(new GrammarRule(ann, l, false)); 1026 1027 // np(id:A, exist:plus, of:minus, def:plus, pl:minus, whin:B, whout:B)=> $ref(text:C), <(id:A, hasvar:plus, var:C, human:D, gender:E), >(id:A, human:D, gender:E, type:ref, hasvar:minus) 1028 l.clear(); 1029 featureHash.clear(); 1030 ann = new Annotation(); 1031 nonterm = new Nonterminal("np"); 1032 fm = new FeatureMap(); 1033 setFeature(fm, "id", 0, featureHash); 1034 fm.setFeature("exist", new StringRef("plus")); 1035 fm.setFeature("of", new StringRef("minus")); 1036 fm.setFeature("def", new StringRef("plus")); 1037 fm.setFeature("pl", new StringRef("minus")); 1038 setFeature(fm, "whin", 1, featureHash); 1039 setFeature(fm, "whout", 1, featureHash); 1040 nonterm.setFeatureMap(fm); 1041 l.add(nonterm); 1042 preterm = new Preterminal("ref"); 1043 fm = new FeatureMap(); 1044 setFeature(fm, "text", 2, featureHash); 1045 preterm.setFeatureMap(fm); 1046 l.add(preterm); 1047 brefcat = new BackrefCategory(); 1048 fm = new FeatureMap(); 1049 setFeature(fm, "id", 0, featureHash); 1050 fm.setFeature("hasvar", new StringRef("plus")); 1051 setFeature(fm, "var", 2, featureHash); 1052 setFeature(fm, "human", 3, featureHash); 1053 setFeature(fm, "gender", 4, featureHash); 1054 brefcat.addPosFeatureMap(fm); 1055 l.add(brefcat); 1056 nonterm = new Nonterminal(">"); 1057 fm = new FeatureMap(); 1058 setFeature(fm, "id", 0, featureHash); 1059 setFeature(fm, "human", 3, featureHash); 1060 setFeature(fm, "gender", 4, featureHash); 1061 fm.setFeature("type", new StringRef("ref")); 1062 fm.setFeature("hasvar", new StringRef("minus")); 1063 nonterm.setFeatureMap(fm); 1064 l.add(nonterm); 1065 addGrammarRule(new GrammarRule(ann, l, false)); 1066 1067 // np(id:A, subj:A, exist:plus, of:minus, def:plus, pl:minus, refl:plus, whin:B, whout:B)=> $pron(refl:plus, human:C, gender:D), <(id:A, human:C, gender:D) 1068 l.clear(); 1069 featureHash.clear(); 1070 ann = new Annotation(); 1071 nonterm = new Nonterminal("np"); 1072 fm = new FeatureMap(); 1073 setFeature(fm, "id", 0, featureHash); 1074 setFeature(fm, "subj", 0, featureHash); 1075 fm.setFeature("exist", new StringRef("plus")); 1076 fm.setFeature("of", new StringRef("minus")); 1077 fm.setFeature("def", new StringRef("plus")); 1078 fm.setFeature("pl", new StringRef("minus")); 1079 fm.setFeature("refl", new StringRef("plus")); 1080 setFeature(fm, "whin", 1, featureHash); 1081 setFeature(fm, "whout", 1, featureHash); 1082 nonterm.setFeatureMap(fm); 1083 l.add(nonterm); 1084 preterm = new Preterminal("pron"); 1085 fm = new FeatureMap(); 1086 fm.setFeature("refl", new StringRef("plus")); 1087 setFeature(fm, "human", 2, featureHash); 1088 setFeature(fm, "gender", 3, featureHash); 1089 preterm.setFeatureMap(fm); 1090 l.add(preterm); 1091 brefcat = new BackrefCategory(); 1092 fm = new FeatureMap(); 1093 setFeature(fm, "id", 0, featureHash); 1094 setFeature(fm, "human", 2, featureHash); 1095 setFeature(fm, "gender", 3, featureHash); 1096 brefcat.addPosFeatureMap(fm); 1097 l.add(brefcat); 1098 addGrammarRule(new GrammarRule(ann, l, false)); 1099 1100 // np(id:A, subj:B, exist:plus, of:minus, def:plus, pl:minus, refl:minus, case:C, whin:D, whout:D)=> $pron(refl:minus, case:C, human:E, gender:F), <(+(id:A, human:E, gender:F), - (id:B)), >(id:A, human:E, gender:F, type:pron, hasvar:minus) 1101 l.clear(); 1102 featureHash.clear(); 1103 ann = new Annotation(); 1104 nonterm = new Nonterminal("np"); 1105 fm = new FeatureMap(); 1106 setFeature(fm, "id", 0, featureHash); 1107 setFeature(fm, "subj", 1, featureHash); 1108 fm.setFeature("exist", new StringRef("plus")); 1109 fm.setFeature("of", new StringRef("minus")); 1110 fm.setFeature("def", new StringRef("plus")); 1111 fm.setFeature("pl", new StringRef("minus")); 1112 fm.setFeature("refl", new StringRef("minus")); 1113 setFeature(fm, "case", 2, featureHash); 1114 setFeature(fm, "whin", 3, featureHash); 1115 setFeature(fm, "whout", 3, featureHash); 1116 nonterm.setFeatureMap(fm); 1117 l.add(nonterm); 1118 preterm = new Preterminal("pron"); 1119 fm = new FeatureMap(); 1120 fm.setFeature("refl", new StringRef("minus")); 1121 setFeature(fm, "case", 2, featureHash); 1122 setFeature(fm, "human", 4, featureHash); 1123 setFeature(fm, "gender", 5, featureHash); 1124 preterm.setFeatureMap(fm); 1125 l.add(preterm); 1126 brefcat = new BackrefCategory(); 1127 fm = new FeatureMap(); 1128 setFeature(fm, "id", 0, featureHash); 1129 setFeature(fm, "human", 4, featureHash); 1130 setFeature(fm, "gender", 5, featureHash); 1131 brefcat.addPosFeatureMap(fm); 1132 fm = new FeatureMap(); 1133 setFeature(fm, "id", 1, featureHash); 1134 brefcat.addNegFeatureMap(fm); 1135 l.add(brefcat); 1136 nonterm = new Nonterminal(">"); 1137 fm = new FeatureMap(); 1138 setFeature(fm, "id", 0, featureHash); 1139 setFeature(fm, "human", 4, featureHash); 1140 setFeature(fm, "gender", 5, featureHash); 1141 fm.setFeature("type", new StringRef("pron")); 1142 fm.setFeature("hasvar", new StringRef("minus")); 1143 nonterm.setFeatureMap(fm); 1144 l.add(nonterm); 1145 addGrammarRule(new GrammarRule(ann, l, false)); 1146 1147 // np(id:A, subj:B, exist:C, rel:D, of:E, pl:minus, embv:F, qu:G, whin:H, whout:I)=>quant(exist:C), nc(id:A, subj:B, rel:D, of:E, embv:F, qu:G, whin:H, whout:I) 1148 l.clear(); 1149 featureHash.clear(); 1150 ann = new Annotation(); 1151 nonterm = new Nonterminal("np"); 1152 fm = new FeatureMap(); 1153 setFeature(fm, "id", 0, featureHash); 1154 setFeature(fm, "subj", 1, featureHash); 1155 setFeature(fm, "exist", 2, featureHash); 1156 setFeature(fm, "rel", 3, featureHash); 1157 setFeature(fm, "of", 4, featureHash); 1158 fm.setFeature("pl", new StringRef("minus")); 1159 setFeature(fm, "embv", 5, featureHash); 1160 setFeature(fm, "qu", 6, featureHash); 1161 setFeature(fm, "whin", 7, featureHash); 1162 setFeature(fm, "whout", 8, featureHash); 1163 nonterm.setFeatureMap(fm); 1164 l.add(nonterm); 1165 nonterm = new Nonterminal("quant"); 1166 fm = new FeatureMap(); 1167 setFeature(fm, "exist", 2, featureHash); 1168 nonterm.setFeatureMap(fm); 1169 l.add(nonterm); 1170 nonterm = new Nonterminal("nc"); 1171 fm = new FeatureMap(); 1172 setFeature(fm, "id", 0, featureHash); 1173 setFeature(fm, "subj", 1, featureHash); 1174 setFeature(fm, "rel", 3, featureHash); 1175 setFeature(fm, "of", 4, featureHash); 1176 setFeature(fm, "embv", 5, featureHash); 1177 setFeature(fm, "qu", 6, featureHash); 1178 setFeature(fm, "whin", 7, featureHash); 1179 setFeature(fm, "whout", 8, featureHash); 1180 nonterm.setFeatureMap(fm); 1181 l.add(nonterm); 1182 addGrammarRule(new GrammarRule(ann, l, false)); 1183 1184 // 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), 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) 1185 l.clear(); 1186 featureHash.clear(); 1187 ann = new Annotation(); 1188 nonterm = new Nonterminal("np"); 1189 fm = new FeatureMap(); 1190 setFeature(fm, "id", 0, featureHash); 1191 setFeature(fm, "exist", 1, featureHash); 1192 setFeature(fm, "rel", 2, featureHash); 1193 fm.setFeature("of", new StringRef("minus")); 1194 fm.setFeature("pl", new StringRef("minus")); 1195 setFeature(fm, "embv", 3, featureHash); 1196 setFeature(fm, "qu", 4, featureHash); 1197 setFeature(fm, "whin", 5, featureHash); 1198 setFeature(fm, "whout", 6, featureHash); 1199 nonterm.setFeatureMap(fm); 1200 l.add(nonterm); 1201 nonterm = new Nonterminal("#"); 1202 fm = new FeatureMap(); 1203 setFeature(fm, "pos", 0, featureHash); 1204 nonterm.setFeatureMap(fm); 1205 l.add(nonterm); 1206 nonterm = new Nonterminal("ipron"); 1207 fm = new FeatureMap(); 1208 setFeature(fm, "exist", 1, featureHash); 1209 setFeature(fm, "human", 7, featureHash); 1210 nonterm.setFeatureMap(fm); 1211 l.add(nonterm); 1212 nonterm = new Nonterminal("opt_newvar"); 1213 fm = new FeatureMap(); 1214 setFeature(fm, "hasvar", 8, featureHash); 1215 setFeature(fm, "var", 9, featureHash); 1216 nonterm.setFeatureMap(fm); 1217 l.add(nonterm); 1218 nonterm = new Nonterminal(">"); 1219 fm = new FeatureMap(); 1220 setFeature(fm, "id", 0, featureHash); 1221 setFeature(fm, "human", 7, featureHash); 1222 fm.setFeature("type", new StringRef("ipron")); 1223 setFeature(fm, "hasvar", 8, featureHash); 1224 setFeature(fm, "var", 9, featureHash); 1225 nonterm.setFeatureMap(fm); 1226 l.add(nonterm); 1227 nonterm = new Nonterminal("relcl"); 1228 fm = new FeatureMap(); 1229 setFeature(fm, "subj", 0, featureHash); 1230 setFeature(fm, "rel", 2, featureHash); 1231 setFeature(fm, "embv", 3, featureHash); 1232 setFeature(fm, "human", 7, featureHash); 1233 setFeature(fm, "qu", 4, featureHash); 1234 setFeature(fm, "whin", 5, featureHash); 1235 setFeature(fm, "whout", 6, featureHash); 1236 nonterm.setFeatureMap(fm); 1237 l.add(nonterm); 1238 addGrammarRule(new GrammarRule(ann, l, false)); 1239 1240 // np(id:A, exist:plus, of:minus, pl:plus, copula:minus, whin:B, whout:B)=>num_quant, $num, opt_adj_coord, #A, $noun_pl 1241 l.clear(); 1242 featureHash.clear(); 1243 ann = new Annotation(); 1244 nonterm = new Nonterminal("np"); 1245 fm = new FeatureMap(); 1246 setFeature(fm, "id", 0, featureHash); 1247 fm.setFeature("exist", new StringRef("plus")); 1248 fm.setFeature("of", new StringRef("minus")); 1249 fm.setFeature("pl", new StringRef("plus")); 1250 fm.setFeature("copula", new StringRef("minus")); 1251 setFeature(fm, "whin", 1, featureHash); 1252 setFeature(fm, "whout", 1, featureHash); 1253 nonterm.setFeatureMap(fm); 1254 l.add(nonterm); 1255 nonterm = new Nonterminal("num_quant"); 1256 fm = new FeatureMap(); 1257 nonterm.setFeatureMap(fm); 1258 l.add(nonterm); 1259 preterm = new Preterminal("num"); 1260 fm = new FeatureMap(); 1261 preterm.setFeatureMap(fm); 1262 l.add(preterm); 1263 nonterm = new Nonterminal("opt_adj_coord"); 1264 fm = new FeatureMap(); 1265 nonterm.setFeatureMap(fm); 1266 l.add(nonterm); 1267 nonterm = new Nonterminal("#"); 1268 fm = new FeatureMap(); 1269 setFeature(fm, "pos", 0, featureHash); 1270 nonterm.setFeatureMap(fm); 1271 l.add(nonterm); 1272 preterm = new Preterminal("noun_pl"); 1273 fm = new FeatureMap(); 1274 preterm.setFeatureMap(fm); 1275 l.add(preterm); 1276 addGrammarRule(new GrammarRule(ann, l, false)); 1277 1278 // np(id:A, exist:plus, of:minus, pl:minus, copula:minus, whin:B, whout:B)=>num_quant, ['1'], #A, opt_adj_coord, $noun_sg(human:C, gender:D, text:E), >(id:A, human:C, gender:D, type:noun, hasvar:minus, noun:E) 1279 l.clear(); 1280 featureHash.clear(); 1281 ann = new Annotation(); 1282 nonterm = new Nonterminal("np"); 1283 fm = new FeatureMap(); 1284 setFeature(fm, "id", 0, featureHash); 1285 fm.setFeature("exist", new StringRef("plus")); 1286 fm.setFeature("of", new StringRef("minus")); 1287 fm.setFeature("pl", new StringRef("minus")); 1288 fm.setFeature("copula", new StringRef("minus")); 1289 setFeature(fm, "whin", 1, featureHash); 1290 setFeature(fm, "whout", 1, featureHash); 1291 nonterm.setFeatureMap(fm); 1292 l.add(nonterm); 1293 nonterm = new Nonterminal("num_quant"); 1294 fm = new FeatureMap(); 1295 nonterm.setFeatureMap(fm); 1296 l.add(nonterm); 1297 term = new Terminal("1"); 1298 l.add(term); 1299 nonterm = new Nonterminal("#"); 1300 fm = new FeatureMap(); 1301 setFeature(fm, "pos", 0, featureHash); 1302 nonterm.setFeatureMap(fm); 1303 l.add(nonterm); 1304 nonterm = new Nonterminal("opt_adj_coord"); 1305 fm = new FeatureMap(); 1306 nonterm.setFeatureMap(fm); 1307 l.add(nonterm); 1308 preterm = new Preterminal("noun_sg"); 1309 fm = new FeatureMap(); 1310 setFeature(fm, "human", 2, featureHash); 1311 setFeature(fm, "gender", 3, featureHash); 1312 setFeature(fm, "text", 4, featureHash); 1313 preterm.setFeatureMap(fm); 1314 l.add(preterm); 1315 nonterm = new Nonterminal(">"); 1316 fm = new FeatureMap(); 1317 setFeature(fm, "id", 0, featureHash); 1318 setFeature(fm, "human", 2, featureHash); 1319 setFeature(fm, "gender", 3, featureHash); 1320 fm.setFeature("type", new StringRef("noun")); 1321 fm.setFeature("hasvar", new StringRef("minus")); 1322 setFeature(fm, "noun", 4, featureHash); 1323 nonterm.setFeatureMap(fm); 1324 l.add(nonterm); 1325 addGrammarRule(new GrammarRule(ann, l, false)); 1326 1327 // np(id:A, exist:plus, of:minus, pl:minus, qu:plus, whout:plus)=> #A, [what], >(id:A, human:minus, type:wh, hasvar:minus) 1328 l.clear(); 1329 featureHash.clear(); 1330 ann = new Annotation(); 1331 nonterm = new Nonterminal("np"); 1332 fm = new FeatureMap(); 1333 setFeature(fm, "id", 0, featureHash); 1334 fm.setFeature("exist", new StringRef("plus")); 1335 fm.setFeature("of", new StringRef("minus")); 1336 fm.setFeature("pl", new StringRef("minus")); 1337 fm.setFeature("qu", new StringRef("plus")); 1338 fm.setFeature("whout", new StringRef("plus")); 1339 nonterm.setFeatureMap(fm); 1340 l.add(nonterm); 1341 nonterm = new Nonterminal("#"); 1342 fm = new FeatureMap(); 1343 setFeature(fm, "pos", 0, featureHash); 1344 nonterm.setFeatureMap(fm); 1345 l.add(nonterm); 1346 term = new Terminal("what"); 1347 l.add(term); 1348 nonterm = new Nonterminal(">"); 1349 fm = new FeatureMap(); 1350 setFeature(fm, "id", 0, featureHash); 1351 fm.setFeature("human", new StringRef("minus")); 1352 fm.setFeature("type", new StringRef("wh")); 1353 fm.setFeature("hasvar", new StringRef("minus")); 1354 nonterm.setFeatureMap(fm); 1355 l.add(nonterm); 1356 addGrammarRule(new GrammarRule(ann, l, false)); 1357 1358 // np(id:A, exist:plus, of:minus, pl:minus, qu:plus, whout:plus)=> #A, [who], >(id:A, human:plus, type:wh, hasvar:minus) 1359 l.clear(); 1360 featureHash.clear(); 1361 ann = new Annotation(); 1362 nonterm = new Nonterminal("np"); 1363 fm = new FeatureMap(); 1364 setFeature(fm, "id", 0, featureHash); 1365 fm.setFeature("exist", new StringRef("plus")); 1366 fm.setFeature("of", new StringRef("minus")); 1367 fm.setFeature("pl", new StringRef("minus")); 1368 fm.setFeature("qu", new StringRef("plus")); 1369 fm.setFeature("whout", new StringRef("plus")); 1370 nonterm.setFeatureMap(fm); 1371 l.add(nonterm); 1372 nonterm = new Nonterminal("#"); 1373 fm = new FeatureMap(); 1374 setFeature(fm, "pos", 0, featureHash); 1375 nonterm.setFeatureMap(fm); 1376 l.add(nonterm); 1377 term = new Terminal("who"); 1378 l.add(term); 1379 nonterm = new Nonterminal(">"); 1380 fm = new FeatureMap(); 1381 setFeature(fm, "id", 0, featureHash); 1382 fm.setFeature("human", new StringRef("plus")); 1383 fm.setFeature("type", new StringRef("wh")); 1384 fm.setFeature("hasvar", new StringRef("minus")); 1385 nonterm.setFeatureMap(fm); 1386 l.add(nonterm); 1387 addGrammarRule(new GrammarRule(ann, l, false)); 1388 1389 // np(id:A, subj:B, exist:plus, rel:C, of:D, embv:E, pl:minus, qu:plus, whout:plus)=>[which], nc(id:A, subj:B, rel:C, of:D, embv:E, qu:plus, whin:plus, whout:plus) 1390 l.clear(); 1391 featureHash.clear(); 1392 ann = new Annotation(); 1393 nonterm = new Nonterminal("np"); 1394 fm = new FeatureMap(); 1395 setFeature(fm, "id", 0, featureHash); 1396 setFeature(fm, "subj", 1, featureHash); 1397 fm.setFeature("exist", new StringRef("plus")); 1398 setFeature(fm, "rel", 2, featureHash); 1399 setFeature(fm, "of", 3, featureHash); 1400 setFeature(fm, "embv", 4, featureHash); 1401 fm.setFeature("pl", new StringRef("minus")); 1402 fm.setFeature("qu", new StringRef("plus")); 1403 fm.setFeature("whout", new StringRef("plus")); 1404 nonterm.setFeatureMap(fm); 1405 l.add(nonterm); 1406 term = new Terminal("which"); 1407 l.add(term); 1408 nonterm = new Nonterminal("nc"); 1409 fm = new FeatureMap(); 1410 setFeature(fm, "id", 0, featureHash); 1411 setFeature(fm, "subj", 1, featureHash); 1412 setFeature(fm, "rel", 2, featureHash); 1413 setFeature(fm, "of", 3, featureHash); 1414 setFeature(fm, "embv", 4, featureHash); 1415 fm.setFeature("qu", new StringRef("plus")); 1416 fm.setFeature("whin", new StringRef("plus")); 1417 fm.setFeature("whout", new StringRef("plus")); 1418 nonterm.setFeatureMap(fm); 1419 l.add(nonterm); 1420 addGrammarRule(new GrammarRule(ann, l, false)); 1421 1422 // np(id:A, exist:plus, of:minus, pl:plus, qu:plus, whout:plus)=>[which], opt_adj_coord, #A, $noun_pl 1423 l.clear(); 1424 featureHash.clear(); 1425 ann = new Annotation(); 1426 nonterm = new Nonterminal("np"); 1427 fm = new FeatureMap(); 1428 setFeature(fm, "id", 0, featureHash); 1429 fm.setFeature("exist", new StringRef("plus")); 1430 fm.setFeature("of", new StringRef("minus")); 1431 fm.setFeature("pl", new StringRef("plus")); 1432 fm.setFeature("qu", new StringRef("plus")); 1433 fm.setFeature("whout", new StringRef("plus")); 1434 nonterm.setFeatureMap(fm); 1435 l.add(nonterm); 1436 term = new Terminal("which"); 1437 l.add(term); 1438 nonterm = new Nonterminal("opt_adj_coord"); 1439 fm = new FeatureMap(); 1440 nonterm.setFeatureMap(fm); 1441 l.add(nonterm); 1442 nonterm = new Nonterminal("#"); 1443 fm = new FeatureMap(); 1444 setFeature(fm, "pos", 0, featureHash); 1445 nonterm.setFeatureMap(fm); 1446 l.add(nonterm); 1447 preterm = new Preterminal("noun_pl"); 1448 fm = new FeatureMap(); 1449 preterm.setFeatureMap(fm); 1450 l.add(preterm); 1451 addGrammarRule(new GrammarRule(ann, l, false)); 1452 1453 /* The category 'nc' represents nouns optionally followed by variables, relative clauses, 1454 and prepositional phrases using "of": */ 1455 1456 // 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) 1457 l.clear(); 1458 featureHash.clear(); 1459 ann = new Annotation(); 1460 nonterm = new Nonterminal("nc"); 1461 fm = new FeatureMap(); 1462 setFeature(fm, "id", 0, featureHash); 1463 setFeature(fm, "rel", 1, featureHash); 1464 fm.setFeature("of", new StringRef("minus")); 1465 setFeature(fm, "embv", 2, featureHash); 1466 setFeature(fm, "qu", 3, featureHash); 1467 setFeature(fm, "whin", 4, featureHash); 1468 setFeature(fm, "whout", 5, featureHash); 1469 nonterm.setFeatureMap(fm); 1470 l.add(nonterm); 1471 nonterm = new Nonterminal("n"); 1472 fm = new FeatureMap(); 1473 setFeature(fm, "id", 0, featureHash); 1474 setFeature(fm, "human", 6, featureHash); 1475 setFeature(fm, "gender", 7, featureHash); 1476 setFeature(fm, "text", 8, featureHash); 1477 nonterm.setFeatureMap(fm); 1478 l.add(nonterm); 1479 nonterm = new Nonterminal("opt_newvar"); 1480 fm = new FeatureMap(); 1481 setFeature(fm, "hasvar", 9, featureHash); 1482 setFeature(fm, "var", 10, featureHash); 1483 nonterm.setFeatureMap(fm); 1484 l.add(nonterm); 1485 nonterm = new Nonterminal(">"); 1486 fm = new FeatureMap(); 1487 setFeature(fm, "id", 0, featureHash); 1488 setFeature(fm, "human", 6, featureHash); 1489 setFeature(fm, "gender", 7, featureHash); 1490 fm.setFeature("type", new StringRef("noun")); 1491 setFeature(fm, "hasvar", 9, featureHash); 1492 setFeature(fm, "noun", 8, featureHash); 1493 setFeature(fm, "var", 10, featureHash); 1494 nonterm.setFeatureMap(fm); 1495 l.add(nonterm); 1496 nonterm = new Nonterminal("relcl"); 1497 fm = new FeatureMap(); 1498 setFeature(fm, "subj", 0, featureHash); 1499 setFeature(fm, "rel", 1, featureHash); 1500 setFeature(fm, "embv", 2, featureHash); 1501 setFeature(fm, "human", 6, featureHash); 1502 setFeature(fm, "qu", 3, featureHash); 1503 setFeature(fm, "whin", 4, featureHash); 1504 setFeature(fm, "whout", 5, featureHash); 1505 nonterm.setFeatureMap(fm); 1506 l.add(nonterm); 1507 addGrammarRule(new GrammarRule(ann, l, false)); 1508 1509 // nc(id:A, subj:B, rel:C, of:plus, embv:D, qu:E, whin:F, whout:G)~>n(id:A, human:H, gender:I, text:J), >(id:A, human:H, gender:I, type:noun, hasvar:minus, noun:J), [of], np(subj:B, rel:C, embv:D, case:acc, qu:E, whin:F, whout:G) 1510 l.clear(); 1511 featureHash.clear(); 1512 ann = new Annotation(); 1513 nonterm = new Nonterminal("nc"); 1514 fm = new FeatureMap(); 1515 setFeature(fm, "id", 0, featureHash); 1516 setFeature(fm, "subj", 1, featureHash); 1517 setFeature(fm, "rel", 2, featureHash); 1518 fm.setFeature("of", new StringRef("plus")); 1519 setFeature(fm, "embv", 3, featureHash); 1520 setFeature(fm, "qu", 4, featureHash); 1521 setFeature(fm, "whin", 5, featureHash); 1522 setFeature(fm, "whout", 6, featureHash); 1523 nonterm.setFeatureMap(fm); 1524 l.add(nonterm); 1525 nonterm = new Nonterminal("n"); 1526 fm = new FeatureMap(); 1527 setFeature(fm, "id", 0, featureHash); 1528 setFeature(fm, "human", 7, featureHash); 1529 setFeature(fm, "gender", 8, featureHash); 1530 setFeature(fm, "text", 9, featureHash); 1531 nonterm.setFeatureMap(fm); 1532 l.add(nonterm); 1533 nonterm = new Nonterminal(">"); 1534 fm = new FeatureMap(); 1535 setFeature(fm, "id", 0, featureHash); 1536 setFeature(fm, "human", 7, featureHash); 1537 setFeature(fm, "gender", 8, featureHash); 1538 fm.setFeature("type", new StringRef("noun")); 1539 fm.setFeature("hasvar", new StringRef("minus")); 1540 setFeature(fm, "noun", 9, featureHash); 1541 nonterm.setFeatureMap(fm); 1542 l.add(nonterm); 1543 term = new Terminal("of"); 1544 l.add(term); 1545 nonterm = new Nonterminal("np"); 1546 fm = new FeatureMap(); 1547 setFeature(fm, "subj", 1, featureHash); 1548 setFeature(fm, "rel", 2, featureHash); 1549 setFeature(fm, "embv", 3, featureHash); 1550 fm.setFeature("case", new StringRef("acc")); 1551 setFeature(fm, "qu", 4, featureHash); 1552 setFeature(fm, "whin", 5, featureHash); 1553 setFeature(fm, "whout", 6, featureHash); 1554 nonterm.setFeatureMap(fm); 1555 l.add(nonterm); 1556 addGrammarRule(new GrammarRule(ann, l, true)); 1557 1558 /* The category 'n' stands for nouns that are preceded by an optional adjective 1559 coordination: */ 1560 1561 // n(id:A, human:B, gender:C, text:D)=>opt_adj_coord, #A, $noun_sg(human:B, gender:C, text:D) 1562 l.clear(); 1563 featureHash.clear(); 1564 ann = new Annotation(); 1565 nonterm = new Nonterminal("n"); 1566 fm = new FeatureMap(); 1567 setFeature(fm, "id", 0, featureHash); 1568 setFeature(fm, "human", 1, featureHash); 1569 setFeature(fm, "gender", 2, featureHash); 1570 setFeature(fm, "text", 3, featureHash); 1571 nonterm.setFeatureMap(fm); 1572 l.add(nonterm); 1573 nonterm = new Nonterminal("opt_adj_coord"); 1574 fm = new FeatureMap(); 1575 nonterm.setFeatureMap(fm); 1576 l.add(nonterm); 1577 nonterm = new Nonterminal("#"); 1578 fm = new FeatureMap(); 1579 setFeature(fm, "pos", 0, featureHash); 1580 nonterm.setFeatureMap(fm); 1581 l.add(nonterm); 1582 preterm = new Preterminal("noun_sg"); 1583 fm = new FeatureMap(); 1584 setFeature(fm, "human", 1, featureHash); 1585 setFeature(fm, "gender", 2, featureHash); 1586 setFeature(fm, "text", 3, featureHash); 1587 preterm.setFeatureMap(fm); 1588 l.add(preterm); 1589 addGrammarRule(new GrammarRule(ann, l, false)); 1590 1591 /* New variables, optional and mandatory, are represented by 'opt_newvar' and 'newvar', 1592 respectively: */ 1593 1594 // opt_newvar(hasvar:minus)=>[] 1595 l.clear(); 1596 featureHash.clear(); 1597 ann = new Annotation(); 1598 nonterm = new Nonterminal("opt_newvar"); 1599 fm = new FeatureMap(); 1600 fm.setFeature("hasvar", new StringRef("minus")); 1601 nonterm.setFeatureMap(fm); 1602 l.add(nonterm); 1603 addGrammarRule(new GrammarRule(ann, l, false)); 1604 1605 // opt_newvar(hasvar:plus, var:A)=>newvar(var:A) 1606 l.clear(); 1607 featureHash.clear(); 1608 ann = new Annotation(); 1609 nonterm = new Nonterminal("opt_newvar"); 1610 fm = new FeatureMap(); 1611 fm.setFeature("hasvar", new StringRef("plus")); 1612 setFeature(fm, "var", 0, featureHash); 1613 nonterm.setFeatureMap(fm); 1614 l.add(nonterm); 1615 nonterm = new Nonterminal("newvar"); 1616 fm = new FeatureMap(); 1617 setFeature(fm, "var", 0, featureHash); 1618 nonterm.setFeatureMap(fm); 1619 l.add(nonterm); 1620 addGrammarRule(new GrammarRule(ann, l, false)); 1621 1622 // newvar(var:A)=> $var(text:A), /<(hasvar:plus, var:A) 1623 l.clear(); 1624 featureHash.clear(); 1625 ann = new Annotation(); 1626 nonterm = new Nonterminal("newvar"); 1627 fm = new FeatureMap(); 1628 setFeature(fm, "var", 0, featureHash); 1629 nonterm.setFeatureMap(fm); 1630 l.add(nonterm); 1631 preterm = new Preterminal("var"); 1632 fm = new FeatureMap(); 1633 setFeature(fm, "text", 0, featureHash); 1634 preterm.setFeatureMap(fm); 1635 l.add(preterm); 1636 nonterm = new Nonterminal("/<"); 1637 fm = new FeatureMap(); 1638 fm.setFeature("hasvar", new StringRef("plus")); 1639 setFeature(fm, "var", 0, featureHash); 1640 nonterm.setFeatureMap(fm); 1641 l.add(nonterm); 1642 addGrammarRule(new GrammarRule(ann, l, false)); 1643 1644 /* Proper names can either require the definite article "the" or not, and are represented 1645 by the category 'prop': */ 1646 1647 // prop(id:A, human:B, gender:C)=> $prop_sg(human:B, gender:C, text:A) 1648 l.clear(); 1649 featureHash.clear(); 1650 ann = new Annotation(); 1651 nonterm = new Nonterminal("prop"); 1652 fm = new FeatureMap(); 1653 setFeature(fm, "id", 0, featureHash); 1654 setFeature(fm, "human", 1, featureHash); 1655 setFeature(fm, "gender", 2, featureHash); 1656 nonterm.setFeatureMap(fm); 1657 l.add(nonterm); 1658 preterm = new Preterminal("prop_sg"); 1659 fm = new FeatureMap(); 1660 setFeature(fm, "human", 1, featureHash); 1661 setFeature(fm, "gender", 2, featureHash); 1662 setFeature(fm, "text", 0, featureHash); 1663 preterm.setFeatureMap(fm); 1664 l.add(preterm); 1665 addGrammarRule(new GrammarRule(ann, l, false)); 1666 1667 // prop(id:A, human:B, gender:C)=> $propdef_sg(human:B, gender:C, text:A) 1668 l.clear(); 1669 featureHash.clear(); 1670 ann = new Annotation(); 1671 nonterm = new Nonterminal("prop"); 1672 fm = new FeatureMap(); 1673 setFeature(fm, "id", 0, featureHash); 1674 setFeature(fm, "human", 1, featureHash); 1675 setFeature(fm, "gender", 2, featureHash); 1676 nonterm.setFeatureMap(fm); 1677 l.add(nonterm); 1678 preterm = new Preterminal("propdef_sg"); 1679 fm = new FeatureMap(); 1680 setFeature(fm, "human", 1, featureHash); 1681 setFeature(fm, "gender", 2, featureHash); 1682 setFeature(fm, "text", 0, featureHash); 1683 preterm.setFeatureMap(fm); 1684 l.add(preterm); 1685 addGrammarRule(new GrammarRule(ann, l, false)); 1686 1687 1688 /* --- Adjectives --- */ 1689 1690 /* Adjectives can be only coordinated by "and", and are represented by 'opt_adj_coord' 1691 for the optional case and by 'adj_coord' if mandatory: */ 1692 1693 // opt_adj_coord=>[] 1694 l.clear(); 1695 featureHash.clear(); 1696 ann = new Annotation(); 1697 nonterm = new Nonterminal("opt_adj_coord"); 1698 fm = new FeatureMap(); 1699 nonterm.setFeatureMap(fm); 1700 l.add(nonterm); 1701 addGrammarRule(new GrammarRule(ann, l, false)); 1702 1703 // opt_adj_coord=>adj_coord 1704 l.clear(); 1705 featureHash.clear(); 1706 ann = new Annotation(); 1707 nonterm = new Nonterminal("opt_adj_coord"); 1708 fm = new FeatureMap(); 1709 nonterm.setFeatureMap(fm); 1710 l.add(nonterm); 1711 nonterm = new Nonterminal("adj_coord"); 1712 fm = new FeatureMap(); 1713 nonterm.setFeatureMap(fm); 1714 l.add(nonterm); 1715 addGrammarRule(new GrammarRule(ann, l, false)); 1716 1717 // adj_coord=>adj 1718 l.clear(); 1719 featureHash.clear(); 1720 ann = new Annotation(); 1721 nonterm = new Nonterminal("adj_coord"); 1722 fm = new FeatureMap(); 1723 nonterm.setFeatureMap(fm); 1724 l.add(nonterm); 1725 nonterm = new Nonterminal("adj"); 1726 fm = new FeatureMap(); 1727 nonterm.setFeatureMap(fm); 1728 l.add(nonterm); 1729 addGrammarRule(new GrammarRule(ann, l, false)); 1730 1731 // adj_coord=>adj, [and], adj_coord 1732 l.clear(); 1733 featureHash.clear(); 1734 ann = new Annotation(); 1735 nonterm = new Nonterminal("adj_coord"); 1736 fm = new FeatureMap(); 1737 nonterm.setFeatureMap(fm); 1738 l.add(nonterm); 1739 nonterm = new Nonterminal("adj"); 1740 fm = new FeatureMap(); 1741 nonterm.setFeatureMap(fm); 1742 l.add(nonterm); 1743 term = new Terminal("and"); 1744 l.add(term); 1745 nonterm = new Nonterminal("adj_coord"); 1746 fm = new FeatureMap(); 1747 nonterm.setFeatureMap(fm); 1748 l.add(nonterm); 1749 addGrammarRule(new GrammarRule(ann, l, false)); 1750 1751 /* Uncoordinated adjectives are represented by 'adj' and can be used in positive, 1752 comparative and superlative forms: */ 1753 1754 // adj=> $adj_itr 1755 l.clear(); 1756 featureHash.clear(); 1757 ann = new Annotation(); 1758 nonterm = new Nonterminal("adj"); 1759 fm = new FeatureMap(); 1760 nonterm.setFeatureMap(fm); 1761 l.add(nonterm); 1762 preterm = new Preterminal("adj_itr"); 1763 fm = new FeatureMap(); 1764 preterm.setFeatureMap(fm); 1765 l.add(preterm); 1766 addGrammarRule(new GrammarRule(ann, l, false)); 1767 1768 // adj=>[more], $adj_itr 1769 l.clear(); 1770 featureHash.clear(); 1771 ann = new Annotation(); 1772 nonterm = new Nonterminal("adj"); 1773 fm = new FeatureMap(); 1774 nonterm.setFeatureMap(fm); 1775 l.add(nonterm); 1776 term = new Terminal("more"); 1777 l.add(term); 1778 preterm = new Preterminal("adj_itr"); 1779 fm = new FeatureMap(); 1780 preterm.setFeatureMap(fm); 1781 l.add(preterm); 1782 addGrammarRule(new GrammarRule(ann, l, false)); 1783 1784 // adj=> $adj_itr_comp 1785 l.clear(); 1786 featureHash.clear(); 1787 ann = new Annotation(); 1788 nonterm = new Nonterminal("adj"); 1789 fm = new FeatureMap(); 1790 nonterm.setFeatureMap(fm); 1791 l.add(nonterm); 1792 preterm = new Preterminal("adj_itr_comp"); 1793 fm = new FeatureMap(); 1794 preterm.setFeatureMap(fm); 1795 l.add(preterm); 1796 addGrammarRule(new GrammarRule(ann, l, false)); 1797 1798 // adj=>[most], $adj_itr 1799 l.clear(); 1800 featureHash.clear(); 1801 ann = new Annotation(); 1802 nonterm = new Nonterminal("adj"); 1803 fm = new FeatureMap(); 1804 nonterm.setFeatureMap(fm); 1805 l.add(nonterm); 1806 term = new Terminal("most"); 1807 l.add(term); 1808 preterm = new Preterminal("adj_itr"); 1809 fm = new FeatureMap(); 1810 preterm.setFeatureMap(fm); 1811 l.add(preterm); 1812 addGrammarRule(new GrammarRule(ann, l, false)); 1813 1814 // adj=> $adj_itr_sup 1815 l.clear(); 1816 featureHash.clear(); 1817 ann = new Annotation(); 1818 nonterm = new Nonterminal("adj"); 1819 fm = new FeatureMap(); 1820 nonterm.setFeatureMap(fm); 1821 l.add(nonterm); 1822 preterm = new Preterminal("adj_itr_sup"); 1823 fm = new FeatureMap(); 1824 preterm.setFeatureMap(fm); 1825 l.add(preterm); 1826 addGrammarRule(new GrammarRule(ann, l, false)); 1827 1828 /* The category 'adjc' stands for more complicated adjective constructions including 1829 nested noun phrases that represent a comparison object: */ 1830 1831 // adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=>[as], $adj_itr, [as], np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:F) 1832 l.clear(); 1833 featureHash.clear(); 1834 ann = new Annotation(); 1835 nonterm = new Nonterminal("adjc"); 1836 fm = new FeatureMap(); 1837 setFeature(fm, "subj", 0, featureHash); 1838 setFeature(fm, "rel", 1, featureHash); 1839 setFeature(fm, "embv", 2, featureHash); 1840 setFeature(fm, "qu", 3, featureHash); 1841 setFeature(fm, "whin", 4, featureHash); 1842 setFeature(fm, "whout", 5, featureHash); 1843 nonterm.setFeatureMap(fm); 1844 l.add(nonterm); 1845 term = new Terminal("as"); 1846 l.add(term); 1847 preterm = new Preterminal("adj_itr"); 1848 fm = new FeatureMap(); 1849 preterm.setFeatureMap(fm); 1850 l.add(preterm); 1851 term = new Terminal("as"); 1852 l.add(term); 1853 nonterm = new Nonterminal("np"); 1854 fm = new FeatureMap(); 1855 setFeature(fm, "subj", 0, featureHash); 1856 setFeature(fm, "rel", 1, featureHash); 1857 fm.setFeature("copula", new StringRef("minus")); 1858 setFeature(fm, "embv", 2, featureHash); 1859 fm.setFeature("case", new StringRef("acc")); 1860 setFeature(fm, "qu", 3, featureHash); 1861 setFeature(fm, "whin", 4, featureHash); 1862 setFeature(fm, "whout", 5, featureHash); 1863 nonterm.setFeatureMap(fm); 1864 l.add(nonterm); 1865 addGrammarRule(new GrammarRule(ann, l, false)); 1866 1867 // adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=> $adj_itr_comp, [than], np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:F) 1868 l.clear(); 1869 featureHash.clear(); 1870 ann = new Annotation(); 1871 nonterm = new Nonterminal("adjc"); 1872 fm = new FeatureMap(); 1873 setFeature(fm, "subj", 0, featureHash); 1874 setFeature(fm, "rel", 1, featureHash); 1875 setFeature(fm, "embv", 2, featureHash); 1876 setFeature(fm, "qu", 3, featureHash); 1877 setFeature(fm, "whin", 4, featureHash); 1878 setFeature(fm, "whout", 5, featureHash); 1879 nonterm.setFeatureMap(fm); 1880 l.add(nonterm); 1881 preterm = new Preterminal("adj_itr_comp"); 1882 fm = new FeatureMap(); 1883 preterm.setFeatureMap(fm); 1884 l.add(preterm); 1885 term = new Terminal("than"); 1886 l.add(term); 1887 nonterm = new Nonterminal("np"); 1888 fm = new FeatureMap(); 1889 setFeature(fm, "subj", 0, featureHash); 1890 setFeature(fm, "rel", 1, featureHash); 1891 fm.setFeature("copula", new StringRef("minus")); 1892 setFeature(fm, "embv", 2, featureHash); 1893 fm.setFeature("case", new StringRef("acc")); 1894 setFeature(fm, "qu", 3, featureHash); 1895 setFeature(fm, "whin", 4, featureHash); 1896 setFeature(fm, "whout", 5, featureHash); 1897 nonterm.setFeatureMap(fm); 1898 l.add(nonterm); 1899 addGrammarRule(new GrammarRule(ann, l, false)); 1900 1901 // adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=>[more], $adj_itr, [than], np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:F) 1902 l.clear(); 1903 featureHash.clear(); 1904 ann = new Annotation(); 1905 nonterm = new Nonterminal("adjc"); 1906 fm = new FeatureMap(); 1907 setFeature(fm, "subj", 0, featureHash); 1908 setFeature(fm, "rel", 1, featureHash); 1909 setFeature(fm, "embv", 2, featureHash); 1910 setFeature(fm, "qu", 3, featureHash); 1911 setFeature(fm, "whin", 4, featureHash); 1912 setFeature(fm, "whout", 5, featureHash); 1913 nonterm.setFeatureMap(fm); 1914 l.add(nonterm); 1915 term = new Terminal("more"); 1916 l.add(term); 1917 preterm = new Preterminal("adj_itr"); 1918 fm = new FeatureMap(); 1919 preterm.setFeatureMap(fm); 1920 l.add(preterm); 1921 term = new Terminal("than"); 1922 l.add(term); 1923 nonterm = new Nonterminal("np"); 1924 fm = new FeatureMap(); 1925 setFeature(fm, "subj", 0, featureHash); 1926 setFeature(fm, "rel", 1, featureHash); 1927 fm.setFeature("copula", new StringRef("minus")); 1928 setFeature(fm, "embv", 2, featureHash); 1929 fm.setFeature("case", new StringRef("acc")); 1930 setFeature(fm, "qu", 3, featureHash); 1931 setFeature(fm, "whin", 4, featureHash); 1932 setFeature(fm, "whout", 5, featureHash); 1933 nonterm.setFeatureMap(fm); 1934 l.add(nonterm); 1935 addGrammarRule(new GrammarRule(ann, l, false)); 1936 1937 // adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=> $adj_tr(prep:G), np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:F) 1938 l.clear(); 1939 featureHash.clear(); 1940 ann = new Annotation(); 1941 nonterm = new Nonterminal("adjc"); 1942 fm = new FeatureMap(); 1943 setFeature(fm, "subj", 0, featureHash); 1944 setFeature(fm, "rel", 1, featureHash); 1945 setFeature(fm, "embv", 2, featureHash); 1946 setFeature(fm, "qu", 3, featureHash); 1947 setFeature(fm, "whin", 4, featureHash); 1948 setFeature(fm, "whout", 5, featureHash); 1949 nonterm.setFeatureMap(fm); 1950 l.add(nonterm); 1951 preterm = new Preterminal("adj_tr"); 1952 fm = new FeatureMap(); 1953 setFeature(fm, "prep", 6, featureHash); 1954 preterm.setFeatureMap(fm); 1955 l.add(preterm); 1956 nonterm = new Nonterminal("np"); 1957 fm = new FeatureMap(); 1958 setFeature(fm, "subj", 0, featureHash); 1959 setFeature(fm, "rel", 1, featureHash); 1960 fm.setFeature("copula", new StringRef("minus")); 1961 setFeature(fm, "embv", 2, featureHash); 1962 fm.setFeature("case", new StringRef("acc")); 1963 setFeature(fm, "qu", 3, featureHash); 1964 setFeature(fm, "whin", 4, featureHash); 1965 setFeature(fm, "whout", 5, featureHash); 1966 nonterm.setFeatureMap(fm); 1967 l.add(nonterm); 1968 addGrammarRule(new GrammarRule(ann, l, false)); 1969 1970 // adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=>[more], $adj_tr(prep:G), np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:F) 1971 l.clear(); 1972 featureHash.clear(); 1973 ann = new Annotation(); 1974 nonterm = new Nonterminal("adjc"); 1975 fm = new FeatureMap(); 1976 setFeature(fm, "subj", 0, featureHash); 1977 setFeature(fm, "rel", 1, featureHash); 1978 setFeature(fm, "embv", 2, featureHash); 1979 setFeature(fm, "qu", 3, featureHash); 1980 setFeature(fm, "whin", 4, featureHash); 1981 setFeature(fm, "whout", 5, featureHash); 1982 nonterm.setFeatureMap(fm); 1983 l.add(nonterm); 1984 term = new Terminal("more"); 1985 l.add(term); 1986 preterm = new Preterminal("adj_tr"); 1987 fm = new FeatureMap(); 1988 setFeature(fm, "prep", 6, featureHash); 1989 preterm.setFeatureMap(fm); 1990 l.add(preterm); 1991 nonterm = new Nonterminal("np"); 1992 fm = new FeatureMap(); 1993 setFeature(fm, "subj", 0, featureHash); 1994 setFeature(fm, "rel", 1, featureHash); 1995 fm.setFeature("copula", new StringRef("minus")); 1996 setFeature(fm, "embv", 2, featureHash); 1997 fm.setFeature("case", new StringRef("acc")); 1998 setFeature(fm, "qu", 3, featureHash); 1999 setFeature(fm, "whin", 4, featureHash); 2000 setFeature(fm, "whout", 5, featureHash); 2001 nonterm.setFeatureMap(fm); 2002 l.add(nonterm); 2003 addGrammarRule(new GrammarRule(ann, l, false)); 2004 2005 // adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=>[most], $adj_tr(prep:G), np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:F) 2006 l.clear(); 2007 featureHash.clear(); 2008 ann = new Annotation(); 2009 nonterm = new Nonterminal("adjc"); 2010 fm = new FeatureMap(); 2011 setFeature(fm, "subj", 0, featureHash); 2012 setFeature(fm, "rel", 1, featureHash); 2013 setFeature(fm, "embv", 2, featureHash); 2014 setFeature(fm, "qu", 3, featureHash); 2015 setFeature(fm, "whin", 4, featureHash); 2016 setFeature(fm, "whout", 5, featureHash); 2017 nonterm.setFeatureMap(fm); 2018 l.add(nonterm); 2019 term = new Terminal("most"); 2020 l.add(term); 2021 preterm = new Preterminal("adj_tr"); 2022 fm = new FeatureMap(); 2023 setFeature(fm, "prep", 6, featureHash); 2024 preterm.setFeatureMap(fm); 2025 l.add(preterm); 2026 nonterm = new Nonterminal("np"); 2027 fm = new FeatureMap(); 2028 setFeature(fm, "subj", 0, featureHash); 2029 setFeature(fm, "rel", 1, featureHash); 2030 fm.setFeature("copula", new StringRef("minus")); 2031 setFeature(fm, "embv", 2, featureHash); 2032 fm.setFeature("case", new StringRef("acc")); 2033 setFeature(fm, "qu", 3, featureHash); 2034 setFeature(fm, "whin", 4, featureHash); 2035 setFeature(fm, "whout", 5, featureHash); 2036 nonterm.setFeatureMap(fm); 2037 l.add(nonterm); 2038 addGrammarRule(new GrammarRule(ann, l, false)); 2039 2040 // adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=>[as], $adj_tr(prep:G), np(subj:A, rel:minus, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:H), [as], np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:H, whout:F) 2041 l.clear(); 2042 featureHash.clear(); 2043 ann = new Annotation(); 2044 nonterm = new Nonterminal("adjc"); 2045 fm = new FeatureMap(); 2046 setFeature(fm, "subj", 0, featureHash); 2047 setFeature(fm, "rel", 1, featureHash); 2048 setFeature(fm, "embv", 2, featureHash); 2049 setFeature(fm, "qu", 3, featureHash); 2050 setFeature(fm, "whin", 4, featureHash); 2051 setFeature(fm, "whout", 5, featureHash); 2052 nonterm.setFeatureMap(fm); 2053 l.add(nonterm); 2054 term = new Terminal("as"); 2055 l.add(term); 2056 preterm = new Preterminal("adj_tr"); 2057 fm = new FeatureMap(); 2058 setFeature(fm, "prep", 6, featureHash); 2059 preterm.setFeatureMap(fm); 2060 l.add(preterm); 2061 nonterm = new Nonterminal("np"); 2062 fm = new FeatureMap(); 2063 setFeature(fm, "subj", 0, featureHash); 2064 fm.setFeature("rel", new StringRef("minus")); 2065 fm.setFeature("copula", new StringRef("minus")); 2066 setFeature(fm, "embv", 2, featureHash); 2067 fm.setFeature("case", new StringRef("acc")); 2068 setFeature(fm, "qu", 3, featureHash); 2069 setFeature(fm, "whin", 4, featureHash); 2070 setFeature(fm, "whout", 7, featureHash); 2071 nonterm.setFeatureMap(fm); 2072 l.add(nonterm); 2073 term = new Terminal("as"); 2074 l.add(term); 2075 nonterm = new Nonterminal("np"); 2076 fm = new FeatureMap(); 2077 setFeature(fm, "subj", 0, featureHash); 2078 setFeature(fm, "rel", 1, featureHash); 2079 fm.setFeature("copula", new StringRef("minus")); 2080 setFeature(fm, "embv", 2, featureHash); 2081 fm.setFeature("case", new StringRef("acc")); 2082 setFeature(fm, "qu", 3, featureHash); 2083 setFeature(fm, "whin", 7, featureHash); 2084 setFeature(fm, "whout", 5, featureHash); 2085 nonterm.setFeatureMap(fm); 2086 l.add(nonterm); 2087 addGrammarRule(new GrammarRule(ann, l, false)); 2088 2089 // adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=>[as], $adj_tr(prep:G), np(subj:A, rel:minus, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:H), [as], $adj_prep(prep:G), np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:H, whout:F) 2090 l.clear(); 2091 featureHash.clear(); 2092 ann = new Annotation(); 2093 nonterm = new Nonterminal("adjc"); 2094 fm = new FeatureMap(); 2095 setFeature(fm, "subj", 0, featureHash); 2096 setFeature(fm, "rel", 1, featureHash); 2097 setFeature(fm, "embv", 2, featureHash); 2098 setFeature(fm, "qu", 3, featureHash); 2099 setFeature(fm, "whin", 4, featureHash); 2100 setFeature(fm, "whout", 5, featureHash); 2101 nonterm.setFeatureMap(fm); 2102 l.add(nonterm); 2103 term = new Terminal("as"); 2104 l.add(term); 2105 preterm = new Preterminal("adj_tr"); 2106 fm = new FeatureMap(); 2107 setFeature(fm, "prep", 6, featureHash); 2108 preterm.setFeatureMap(fm); 2109 l.add(preterm); 2110 nonterm = new Nonterminal("np"); 2111 fm = new FeatureMap(); 2112 setFeature(fm, "subj", 0, featureHash); 2113 fm.setFeature("rel", new StringRef("minus")); 2114 fm.setFeature("copula", new StringRef("minus")); 2115 setFeature(fm, "embv", 2, featureHash); 2116 fm.setFeature("case", new StringRef("acc")); 2117 setFeature(fm, "qu", 3, featureHash); 2118 setFeature(fm, "whin", 4, featureHash); 2119 setFeature(fm, "whout", 7, featureHash); 2120 nonterm.setFeatureMap(fm); 2121 l.add(nonterm); 2122 term = new Terminal("as"); 2123 l.add(term); 2124 preterm = new Preterminal("adj_prep"); 2125 fm = new FeatureMap(); 2126 setFeature(fm, "prep", 6, featureHash); 2127 preterm.setFeatureMap(fm); 2128 l.add(preterm); 2129 nonterm = new Nonterminal("np"); 2130 fm = new FeatureMap(); 2131 setFeature(fm, "subj", 0, featureHash); 2132 setFeature(fm, "rel", 1, featureHash); 2133 fm.setFeature("copula", new StringRef("minus")); 2134 setFeature(fm, "embv", 2, featureHash); 2135 fm.setFeature("case", new StringRef("acc")); 2136 setFeature(fm, "qu", 3, featureHash); 2137 setFeature(fm, "whin", 7, featureHash); 2138 setFeature(fm, "whout", 5, featureHash); 2139 nonterm.setFeatureMap(fm); 2140 l.add(nonterm); 2141 addGrammarRule(new GrammarRule(ann, l, false)); 2142 2143 // adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=>[more], $adj_tr(prep:G), np(subj:A, rel:minus, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:H), [than], np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:H, whout:F) 2144 l.clear(); 2145 featureHash.clear(); 2146 ann = new Annotation(); 2147 nonterm = new Nonterminal("adjc"); 2148 fm = new FeatureMap(); 2149 setFeature(fm, "subj", 0, featureHash); 2150 setFeature(fm, "rel", 1, featureHash); 2151 setFeature(fm, "embv", 2, featureHash); 2152 setFeature(fm, "qu", 3, featureHash); 2153 setFeature(fm, "whin", 4, featureHash); 2154 setFeature(fm, "whout", 5, featureHash); 2155 nonterm.setFeatureMap(fm); 2156 l.add(nonterm); 2157 term = new Terminal("more"); 2158 l.add(term); 2159 preterm = new Preterminal("adj_tr"); 2160 fm = new FeatureMap(); 2161 setFeature(fm, "prep", 6, featureHash); 2162 preterm.setFeatureMap(fm); 2163 l.add(preterm); 2164 nonterm = new Nonterminal("np"); 2165 fm = new FeatureMap(); 2166 setFeature(fm, "subj", 0, featureHash); 2167 fm.setFeature("rel", new StringRef("minus")); 2168 fm.setFeature("copula", new StringRef("minus")); 2169 setFeature(fm, "embv", 2, featureHash); 2170 fm.setFeature("case", new StringRef("acc")); 2171 setFeature(fm, "qu", 3, featureHash); 2172 setFeature(fm, "whin", 4, featureHash); 2173 setFeature(fm, "whout", 7, featureHash); 2174 nonterm.setFeatureMap(fm); 2175 l.add(nonterm); 2176 term = new Terminal("than"); 2177 l.add(term); 2178 nonterm = new Nonterminal("np"); 2179 fm = new FeatureMap(); 2180 setFeature(fm, "subj", 0, featureHash); 2181 setFeature(fm, "rel", 1, featureHash); 2182 fm.setFeature("copula", new StringRef("minus")); 2183 setFeature(fm, "embv", 2, featureHash); 2184 fm.setFeature("case", new StringRef("acc")); 2185 setFeature(fm, "qu", 3, featureHash); 2186 setFeature(fm, "whin", 7, featureHash); 2187 setFeature(fm, "whout", 5, featureHash); 2188 nonterm.setFeatureMap(fm); 2189 l.add(nonterm); 2190 addGrammarRule(new GrammarRule(ann, l, false)); 2191 2192 // adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=> $adj_tr_comp(prep:G), np(subj:A, rel:minus, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:H), [than], np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:H, whout:F) 2193 l.clear(); 2194 featureHash.clear(); 2195 ann = new Annotation(); 2196 nonterm = new Nonterminal("adjc"); 2197 fm = new FeatureMap(); 2198 setFeature(fm, "subj", 0, featureHash); 2199 setFeature(fm, "rel", 1, featureHash); 2200 setFeature(fm, "embv", 2, featureHash); 2201 setFeature(fm, "qu", 3, featureHash); 2202 setFeature(fm, "whin", 4, featureHash); 2203 setFeature(fm, "whout", 5, featureHash); 2204 nonterm.setFeatureMap(fm); 2205 l.add(nonterm); 2206 preterm = new Preterminal("adj_tr_comp"); 2207 fm = new FeatureMap(); 2208 setFeature(fm, "prep", 6, featureHash); 2209 preterm.setFeatureMap(fm); 2210 l.add(preterm); 2211 nonterm = new Nonterminal("np"); 2212 fm = new FeatureMap(); 2213 setFeature(fm, "subj", 0, featureHash); 2214 fm.setFeature("rel", new StringRef("minus")); 2215 fm.setFeature("copula", new StringRef("minus")); 2216 setFeature(fm, "embv", 2, featureHash); 2217 fm.setFeature("case", new StringRef("acc")); 2218 setFeature(fm, "qu", 3, featureHash); 2219 setFeature(fm, "whin", 4, featureHash); 2220 setFeature(fm, "whout", 7, featureHash); 2221 nonterm.setFeatureMap(fm); 2222 l.add(nonterm); 2223 term = new Terminal("than"); 2224 l.add(term); 2225 nonterm = new Nonterminal("np"); 2226 fm = new FeatureMap(); 2227 setFeature(fm, "subj", 0, featureHash); 2228 setFeature(fm, "rel", 1, featureHash); 2229 fm.setFeature("copula", new StringRef("minus")); 2230 setFeature(fm, "embv", 2, featureHash); 2231 fm.setFeature("case", new StringRef("acc")); 2232 setFeature(fm, "qu", 3, featureHash); 2233 setFeature(fm, "whin", 7, featureHash); 2234 setFeature(fm, "whout", 5, featureHash); 2235 nonterm.setFeatureMap(fm); 2236 l.add(nonterm); 2237 addGrammarRule(new GrammarRule(ann, l, false)); 2238 2239 // adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=>[more], $adj_tr(prep:G), np(subj:A, rel:minus, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:H), [than], $adj_prep(prep:G), np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:H, whout:F) 2240 l.clear(); 2241 featureHash.clear(); 2242 ann = new Annotation(); 2243 nonterm = new Nonterminal("adjc"); 2244 fm = new FeatureMap(); 2245 setFeature(fm, "subj", 0, featureHash); 2246 setFeature(fm, "rel", 1, featureHash); 2247 setFeature(fm, "embv", 2, featureHash); 2248 setFeature(fm, "qu", 3, featureHash); 2249 setFeature(fm, "whin", 4, featureHash); 2250 setFeature(fm, "whout", 5, featureHash); 2251 nonterm.setFeatureMap(fm); 2252 l.add(nonterm); 2253 term = new Terminal("more"); 2254 l.add(term); 2255 preterm = new Preterminal("adj_tr"); 2256 fm = new FeatureMap(); 2257 setFeature(fm, "prep", 6, featureHash); 2258 preterm.setFeatureMap(fm); 2259 l.add(preterm); 2260 nonterm = new Nonterminal("np"); 2261 fm = new FeatureMap(); 2262 setFeature(fm, "subj", 0, featureHash); 2263 fm.setFeature("rel", new StringRef("minus")); 2264 fm.setFeature("copula", new StringRef("minus")); 2265 setFeature(fm, "embv", 2, featureHash); 2266 fm.setFeature("case", new StringRef("acc")); 2267 setFeature(fm, "qu", 3, featureHash); 2268 setFeature(fm, "whin", 4, featureHash); 2269 setFeature(fm, "whout", 7, featureHash); 2270 nonterm.setFeatureMap(fm); 2271 l.add(nonterm); 2272 term = new Terminal("than"); 2273 l.add(term); 2274 preterm = new Preterminal("adj_prep"); 2275 fm = new FeatureMap(); 2276 setFeature(fm, "prep", 6, featureHash); 2277 preterm.setFeatureMap(fm); 2278 l.add(preterm); 2279 nonterm = new Nonterminal("np"); 2280 fm = new FeatureMap(); 2281 setFeature(fm, "subj", 0, featureHash); 2282 setFeature(fm, "rel", 1, featureHash); 2283 fm.setFeature("copula", new StringRef("minus")); 2284 setFeature(fm, "embv", 2, featureHash); 2285 fm.setFeature("case", new StringRef("acc")); 2286 setFeature(fm, "qu", 3, featureHash); 2287 setFeature(fm, "whin", 7, featureHash); 2288 setFeature(fm, "whout", 5, featureHash); 2289 nonterm.setFeatureMap(fm); 2290 l.add(nonterm); 2291 addGrammarRule(new GrammarRule(ann, l, false)); 2292 2293 // adjc(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=> $adj_tr_comp(prep:G), np(subj:A, rel:minus, copula:minus, embv:C, case:acc, qu:D, whin:E, whout:H), [than], $adj_prep(prep:G), np(subj:A, rel:B, copula:minus, embv:C, case:acc, qu:D, whin:H, whout:F) 2294 l.clear(); 2295 featureHash.clear(); 2296 ann = new Annotation(); 2297 nonterm = new Nonterminal("adjc"); 2298 fm = new FeatureMap(); 2299 setFeature(fm, "subj", 0, featureHash); 2300 setFeature(fm, "rel", 1, featureHash); 2301 setFeature(fm, "embv", 2, featureHash); 2302 setFeature(fm, "qu", 3, featureHash); 2303 setFeature(fm, "whin", 4, featureHash); 2304 setFeature(fm, "whout", 5, featureHash); 2305 nonterm.setFeatureMap(fm); 2306 l.add(nonterm); 2307 preterm = new Preterminal("adj_tr_comp"); 2308 fm = new FeatureMap(); 2309 setFeature(fm, "prep", 6, featureHash); 2310 preterm.setFeatureMap(fm); 2311 l.add(preterm); 2312 nonterm = new Nonterminal("np"); 2313 fm = new FeatureMap(); 2314 setFeature(fm, "subj", 0, featureHash); 2315 fm.setFeature("rel", new StringRef("minus")); 2316 fm.setFeature("copula", new StringRef("minus")); 2317 setFeature(fm, "embv", 2, featureHash); 2318 fm.setFeature("case", new StringRef("acc")); 2319 setFeature(fm, "qu", 3, featureHash); 2320 setFeature(fm, "whin", 4, featureHash); 2321 setFeature(fm, "whout", 7, featureHash); 2322 nonterm.setFeatureMap(fm); 2323 l.add(nonterm); 2324 term = new Terminal("than"); 2325 l.add(term); 2326 preterm = new Preterminal("adj_prep"); 2327 fm = new FeatureMap(); 2328 setFeature(fm, "prep", 6, featureHash); 2329 preterm.setFeatureMap(fm); 2330 l.add(preterm); 2331 nonterm = new Nonterminal("np"); 2332 fm = new FeatureMap(); 2333 setFeature(fm, "subj", 0, featureHash); 2334 setFeature(fm, "rel", 1, featureHash); 2335 fm.setFeature("copula", new StringRef("minus")); 2336 setFeature(fm, "embv", 2, featureHash); 2337 fm.setFeature("case", new StringRef("acc")); 2338 setFeature(fm, "qu", 3, featureHash); 2339 setFeature(fm, "whin", 7, featureHash); 2340 setFeature(fm, "whout", 5, featureHash); 2341 nonterm.setFeatureMap(fm); 2342 l.add(nonterm); 2343 addGrammarRule(new GrammarRule(ann, l, false)); 2344 2345 2346 /* --- Relative Clauses --- */ 2347 2348 /* Relative clauses are represented by 'relcl'. They start with a relative pronoun and 2349 are always optional: */ 2350 2351 // relcl(whin:A, whout:A)=>[] 2352 l.clear(); 2353 featureHash.clear(); 2354 ann = new Annotation(); 2355 nonterm = new Nonterminal("relcl"); 2356 fm = new FeatureMap(); 2357 setFeature(fm, "whin", 0, featureHash); 2358 setFeature(fm, "whout", 0, featureHash); 2359 nonterm.setFeatureMap(fm); 2360 l.add(nonterm); 2361 addGrammarRule(new GrammarRule(ann, l, false)); 2362 2363 // 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) 2364 l.clear(); 2365 featureHash.clear(); 2366 ann = new Annotation(); 2367 nonterm = new Nonterminal("relcl"); 2368 fm = new FeatureMap(); 2369 setFeature(fm, "subj", 0, featureHash); 2370 fm.setFeature("rel", new StringRef("plus")); 2371 fm.setFeature("embv", new StringRef("plus")); 2372 setFeature(fm, "human", 1, featureHash); 2373 setFeature(fm, "qu", 2, featureHash); 2374 setFeature(fm, "whin", 3, featureHash); 2375 setFeature(fm, "whout", 4, featureHash); 2376 nonterm.setFeatureMap(fm); 2377 l.add(nonterm); 2378 nonterm = new Nonterminal("relpron"); 2379 fm = new FeatureMap(); 2380 setFeature(fm, "human", 1, featureHash); 2381 setFeature(fm, "relpron", 5, featureHash); 2382 nonterm.setFeatureMap(fm); 2383 l.add(nonterm); 2384 nonterm = new Nonterminal("relcl1"); 2385 fm = new FeatureMap(); 2386 setFeature(fm, "subj", 0, featureHash); 2387 setFeature(fm, "human", 1, featureHash); 2388 setFeature(fm, "relpron", 5, featureHash); 2389 setFeature(fm, "qu", 2, featureHash); 2390 setFeature(fm, "whin", 3, featureHash); 2391 setFeature(fm, "whout", 4, featureHash); 2392 nonterm.setFeatureMap(fm); 2393 l.add(nonterm); 2394 addGrammarRule(new GrammarRule(ann, l, false)); 2395 2396 /* Like sentences and verb phrases, relative clauses can be coordinated by "or" 2397 ('relcl1') and "and" ('relcl2'): */ 2398 2399 // 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) 2400 l.clear(); 2401 featureHash.clear(); 2402 ann = new Annotation(); 2403 nonterm = new Nonterminal("relcl1"); 2404 fm = new FeatureMap(); 2405 setFeature(fm, "subj", 0, featureHash); 2406 setFeature(fm, "human", 1, featureHash); 2407 setFeature(fm, "relpron", 2, featureHash); 2408 setFeature(fm, "qu", 3, featureHash); 2409 setFeature(fm, "whin", 4, featureHash); 2410 setFeature(fm, "whout", 5, featureHash); 2411 nonterm.setFeatureMap(fm); 2412 l.add(nonterm); 2413 nonterm = new Nonterminal("//"); 2414 fm = new FeatureMap(); 2415 nonterm.setFeatureMap(fm); 2416 l.add(nonterm); 2417 nonterm = new Nonterminal("relcl2"); 2418 fm = new FeatureMap(); 2419 setFeature(fm, "subj", 0, featureHash); 2420 setFeature(fm, "human", 1, featureHash); 2421 fm.setFeature("rel", new StringRef("minus")); 2422 setFeature(fm, "relpron", 2, featureHash); 2423 setFeature(fm, "qu", 3, featureHash); 2424 setFeature(fm, "whin", 4, featureHash); 2425 setFeature(fm, "whout", 6, featureHash); 2426 nonterm.setFeatureMap(fm); 2427 l.add(nonterm); 2428 nonterm = new Nonterminal("or_relpron"); 2429 fm = new FeatureMap(); 2430 setFeature(fm, "human", 1, featureHash); 2431 setFeature(fm, "relpron", 2, featureHash); 2432 nonterm.setFeatureMap(fm); 2433 l.add(nonterm); 2434 nonterm = new Nonterminal("relcl1"); 2435 fm = new FeatureMap(); 2436 setFeature(fm, "subj", 0, featureHash); 2437 setFeature(fm, "human", 1, featureHash); 2438 setFeature(fm, "relpron", 2, featureHash); 2439 setFeature(fm, "qu", 3, featureHash); 2440 setFeature(fm, "whin", 6, featureHash); 2441 setFeature(fm, "whout", 5, featureHash); 2442 nonterm.setFeatureMap(fm); 2443 l.add(nonterm); 2444 addGrammarRule(new GrammarRule(ann, l, true)); 2445 2446 // 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) 2447 l.clear(); 2448 featureHash.clear(); 2449 ann = new Annotation(); 2450 nonterm = new Nonterminal("relcl1"); 2451 fm = new FeatureMap(); 2452 setFeature(fm, "subj", 0, featureHash); 2453 setFeature(fm, "human", 1, featureHash); 2454 setFeature(fm, "relpron", 2, featureHash); 2455 setFeature(fm, "qu", 3, featureHash); 2456 setFeature(fm, "whin", 4, featureHash); 2457 setFeature(fm, "whout", 5, featureHash); 2458 nonterm.setFeatureMap(fm); 2459 l.add(nonterm); 2460 nonterm = new Nonterminal("relcl2"); 2461 fm = new FeatureMap(); 2462 setFeature(fm, "subj", 0, featureHash); 2463 setFeature(fm, "human", 1, featureHash); 2464 setFeature(fm, "relpron", 2, featureHash); 2465 setFeature(fm, "qu", 3, featureHash); 2466 setFeature(fm, "whin", 4, featureHash); 2467 setFeature(fm, "whout", 5, featureHash); 2468 nonterm.setFeatureMap(fm); 2469 l.add(nonterm); 2470 addGrammarRule(new GrammarRule(ann, l, false)); 2471 2472 // 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) 2473 l.clear(); 2474 featureHash.clear(); 2475 ann = new Annotation(); 2476 nonterm = new Nonterminal("relcl2"); 2477 fm = new FeatureMap(); 2478 setFeature(fm, "subj", 0, featureHash); 2479 setFeature(fm, "rel", 1, featureHash); 2480 setFeature(fm, "relpron", 2, featureHash); 2481 setFeature(fm, "human", 3, featureHash); 2482 setFeature(fm, "qu", 4, featureHash); 2483 setFeature(fm, "whin", 5, featureHash); 2484 setFeature(fm, "whout", 6, featureHash); 2485 nonterm.setFeatureMap(fm); 2486 l.add(nonterm); 2487 nonterm = new Nonterminal("vp"); 2488 fm = new FeatureMap(); 2489 setFeature(fm, "subj", 0, featureHash); 2490 fm.setFeature("rel", new StringRef("minus")); 2491 fm.setFeature("pl", new StringRef("minus")); 2492 setFeature(fm, "qu", 4, featureHash); 2493 setFeature(fm, "whin", 5, featureHash); 2494 setFeature(fm, "whout", 7, featureHash); 2495 nonterm.setFeatureMap(fm); 2496 l.add(nonterm); 2497 nonterm = new Nonterminal("and_relpron"); 2498 fm = new FeatureMap(); 2499 setFeature(fm, "human", 3, featureHash); 2500 setFeature(fm, "relpron", 2, featureHash); 2501 nonterm.setFeatureMap(fm); 2502 l.add(nonterm); 2503 nonterm = new Nonterminal("relcl2"); 2504 fm = new FeatureMap(); 2505 setFeature(fm, "subj", 0, featureHash); 2506 setFeature(fm, "rel", 1, featureHash); 2507 setFeature(fm, "relpron", 2, featureHash); 2508 setFeature(fm, "human", 3, featureHash); 2509 setFeature(fm, "qu", 4, featureHash); 2510 setFeature(fm, "whin", 7, featureHash); 2511 setFeature(fm, "whout", 6, featureHash); 2512 nonterm.setFeatureMap(fm); 2513 l.add(nonterm); 2514 addGrammarRule(new GrammarRule(ann, l, false)); 2515 2516 // relcl2(subj:A, rel:B, qu:C, whin:D, whout:E)=>vp(subj:A, rel:B, pl:minus, qu:C, whin:D, whout:E) 2517 l.clear(); 2518 featureHash.clear(); 2519 ann = new Annotation(); 2520 nonterm = new Nonterminal("relcl2"); 2521 fm = new FeatureMap(); 2522 setFeature(fm, "subj", 0, featureHash); 2523 setFeature(fm, "rel", 1, featureHash); 2524 setFeature(fm, "qu", 2, featureHash); 2525 setFeature(fm, "whin", 3, featureHash); 2526 setFeature(fm, "whout", 4, featureHash); 2527 nonterm.setFeatureMap(fm); 2528 l.add(nonterm); 2529 nonterm = new Nonterminal("vp"); 2530 fm = new FeatureMap(); 2531 setFeature(fm, "subj", 0, featureHash); 2532 setFeature(fm, "rel", 1, featureHash); 2533 fm.setFeature("pl", new StringRef("minus")); 2534 setFeature(fm, "qu", 2, featureHash); 2535 setFeature(fm, "whin", 3, featureHash); 2536 setFeature(fm, "whout", 4, featureHash); 2537 nonterm.setFeatureMap(fm); 2538 l.add(nonterm); 2539 addGrammarRule(new GrammarRule(ann, l, false)); 2540 2541 // relcl2(subj:A, rel:B, qu:C, whin:D, whout:E)~>np(id:F, subj:A, rel:minus, copula:minus, pl:G, embv:H, case:nom, refl:minus, qu:C, whin:D, whout:I), aux(be:minus, pl:G), verb(vcat:tr, be:minus, pl:G, vform:inf), vmod(subj:F, rel:B, embv:H, copula:minus, qu:C, whin:I, whout:E) 2542 l.clear(); 2543 featureHash.clear(); 2544 ann = new Annotation(); 2545 nonterm = new Nonterminal("relcl2"); 2546 fm = new FeatureMap(); 2547 setFeature(fm, "subj", 0, featureHash); 2548 setFeature(fm, "rel", 1, featureHash); 2549 setFeature(fm, "qu", 2, featureHash); 2550 setFeature(fm, "whin", 3, featureHash); 2551 setFeature(fm, "whout", 4, featureHash); 2552 nonterm.setFeatureMap(fm); 2553 l.add(nonterm); 2554 nonterm = new Nonterminal("np"); 2555 fm = new FeatureMap(); 2556 setFeature(fm, "id", 5, featureHash); 2557 setFeature(fm, "subj", 0, featureHash); 2558 fm.setFeature("rel", new StringRef("minus")); 2559 fm.setFeature("copula", new StringRef("minus")); 2560 setFeature(fm, "pl", 6, featureHash); 2561 setFeature(fm, "embv", 7, featureHash); 2562 fm.setFeature("case", new StringRef("nom")); 2563 fm.setFeature("refl", new StringRef("minus")); 2564 setFeature(fm, "qu", 2, featureHash); 2565 setFeature(fm, "whin", 3, featureHash); 2566 setFeature(fm, "whout", 8, featureHash); 2567 nonterm.setFeatureMap(fm); 2568 l.add(nonterm); 2569 nonterm = new Nonterminal("aux"); 2570 fm = new FeatureMap(); 2571 fm.setFeature("be", new StringRef("minus")); 2572 setFeature(fm, "pl", 6, featureHash); 2573 nonterm.setFeatureMap(fm); 2574 l.add(nonterm); 2575 nonterm = new Nonterminal("verb"); 2576 fm = new FeatureMap(); 2577 fm.setFeature("vcat", new StringRef("tr")); 2578 fm.setFeature("be", new StringRef("minus")); 2579 setFeature(fm, "pl", 6, featureHash); 2580 fm.setFeature("vform", new StringRef("inf")); 2581 nonterm.setFeatureMap(fm); 2582 l.add(nonterm); 2583 nonterm = new Nonterminal("vmod"); 2584 fm = new FeatureMap(); 2585 setFeature(fm, "subj", 5, featureHash); 2586 setFeature(fm, "rel", 1, featureHash); 2587 setFeature(fm, "embv", 7, featureHash); 2588 fm.setFeature("copula", new StringRef("minus")); 2589 setFeature(fm, "qu", 2, featureHash); 2590 setFeature(fm, "whin", 8, featureHash); 2591 setFeature(fm, "whout", 4, featureHash); 2592 nonterm.setFeatureMap(fm); 2593 l.add(nonterm); 2594 addGrammarRule(new GrammarRule(ann, l, true)); 2595 2596 // relcl2(subj:A, rel:B, qu:C, whin:D, whout:E)~>np(id:F, subj:A, rel:minus, copula:minus, pl:G, embv:H, case:nom, refl:minus, qu:C, whin:D, whout:I), verb(vcat:tr, be:minus, pl:G, vform:fin), vmod(subj:F, rel:B, embv:H, copula:minus, qu:C, whin:I, whout:E) 2597 l.clear(); 2598 featureHash.clear(); 2599 ann = new Annotation(); 2600 nonterm = new Nonterminal("relcl2"); 2601 fm = new FeatureMap(); 2602 setFeature(fm, "subj", 0, featureHash); 2603 setFeature(fm, "rel", 1, featureHash); 2604 setFeature(fm, "qu", 2, featureHash); 2605 setFeature(fm, "whin", 3, featureHash); 2606 setFeature(fm, "whout", 4, featureHash); 2607 nonterm.setFeatureMap(fm); 2608 l.add(nonterm); 2609 nonterm = new Nonterminal("np"); 2610 fm = new FeatureMap(); 2611 setFeature(fm, "id", 5, featureHash); 2612 setFeature(fm, "subj", 0, featureHash); 2613 fm.setFeature("rel", new StringRef("minus")); 2614 fm.setFeature("copula", new StringRef("minus")); 2615 setFeature(fm, "pl", 6, featureHash); 2616 setFeature(fm, "embv", 7, featureHash); 2617 fm.setFeature("case", new StringRef("nom")); 2618 fm.setFeature("refl", new StringRef("minus")); 2619 setFeature(fm, "qu", 2, featureHash); 2620 setFeature(fm, "whin", 3, featureHash); 2621 setFeature(fm, "whout", 8, featureHash); 2622 nonterm.setFeatureMap(fm); 2623 l.add(nonterm); 2624 nonterm = new Nonterminal("verb"); 2625 fm = new FeatureMap(); 2626 fm.setFeature("vcat", new StringRef("tr")); 2627 fm.setFeature("be", new StringRef("minus")); 2628 setFeature(fm, "pl", 6, featureHash); 2629 fm.setFeature("vform", new StringRef("fin")); 2630 nonterm.setFeatureMap(fm); 2631 l.add(nonterm); 2632 nonterm = new Nonterminal("vmod"); 2633 fm = new FeatureMap(); 2634 setFeature(fm, "subj", 5, featureHash); 2635 setFeature(fm, "rel", 1, featureHash); 2636 setFeature(fm, "embv", 7, featureHash); 2637 fm.setFeature("copula", new StringRef("minus")); 2638 setFeature(fm, "qu", 2, featureHash); 2639 setFeature(fm, "whin", 8, featureHash); 2640 setFeature(fm, "whout", 4, featureHash); 2641 nonterm.setFeatureMap(fm); 2642 l.add(nonterm); 2643 addGrammarRule(new GrammarRule(ann, l, true)); 2644 2645 /* Relative pronouns are represented by 'relpron' and can be either "that", "who" or 2646 "which": */ 2647 2648 // relpron(relpron:that)=>[that] 2649 l.clear(); 2650 featureHash.clear(); 2651 ann = new Annotation(); 2652 nonterm = new Nonterminal("relpron"); 2653 fm = new FeatureMap(); 2654 fm.setFeature("relpron", new StringRef("that")); 2655 nonterm.setFeatureMap(fm); 2656 l.add(nonterm); 2657 term = new Terminal("that"); 2658 l.add(term); 2659 addGrammarRule(new GrammarRule(ann, l, false)); 2660 2661 // relpron(human:plus, relpron:who)=>[who] 2662 l.clear(); 2663 featureHash.clear(); 2664 ann = new Annotation(); 2665 nonterm = new Nonterminal("relpron"); 2666 fm = new FeatureMap(); 2667 fm.setFeature("human", new StringRef("plus")); 2668 fm.setFeature("relpron", new StringRef("who")); 2669 nonterm.setFeatureMap(fm); 2670 l.add(nonterm); 2671 term = new Terminal("who"); 2672 l.add(term); 2673 addGrammarRule(new GrammarRule(ann, l, false)); 2674 2675 // relpron(human:minus, relpron:which)=>[which] 2676 l.clear(); 2677 featureHash.clear(); 2678 ann = new Annotation(); 2679 nonterm = new Nonterminal("relpron"); 2680 fm = new FeatureMap(); 2681 fm.setFeature("human", new StringRef("minus")); 2682 fm.setFeature("relpron", new StringRef("which")); 2683 nonterm.setFeatureMap(fm); 2684 l.add(nonterm); 2685 term = new Terminal("which"); 2686 l.add(term); 2687 addGrammarRule(new GrammarRule(ann, l, false)); 2688 2689 /* The categories 'or_relpron' and 'and_relpron' define shortcuts - like "or that" as 2690 one token - for better usability inside of the predictive editor: */ 2691 2692 // or_relpron(human:A, relpron:B)=>[or], relpron(human:A, relpron:B) 2693 l.clear(); 2694 featureHash.clear(); 2695 ann = new Annotation(); 2696 nonterm = new Nonterminal("or_relpron"); 2697 fm = new FeatureMap(); 2698 setFeature(fm, "human", 0, featureHash); 2699 setFeature(fm, "relpron", 1, featureHash); 2700 nonterm.setFeatureMap(fm); 2701 l.add(nonterm); 2702 term = new Terminal("or"); 2703 l.add(term); 2704 nonterm = new Nonterminal("relpron"); 2705 fm = new FeatureMap(); 2706 setFeature(fm, "human", 0, featureHash); 2707 setFeature(fm, "relpron", 1, featureHash); 2708 nonterm.setFeatureMap(fm); 2709 l.add(nonterm); 2710 addGrammarRule(new GrammarRule(ann, l, false)); 2711 2712 // or_relpron(relpron:that)=>['or that'] 2713 l.clear(); 2714 featureHash.clear(); 2715 ann = new Annotation(); 2716 nonterm = new Nonterminal("or_relpron"); 2717 fm = new FeatureMap(); 2718 fm.setFeature("relpron", new StringRef("that")); 2719 nonterm.setFeatureMap(fm); 2720 l.add(nonterm); 2721 term = new Terminal("or that"); 2722 l.add(term); 2723 addGrammarRule(new GrammarRule(ann, l, false)); 2724 2725 // or_relpron(human:plus, relpron:who)=>['or who'] 2726 l.clear(); 2727 featureHash.clear(); 2728 ann = new Annotation(); 2729 nonterm = new Nonterminal("or_relpron"); 2730 fm = new FeatureMap(); 2731 fm.setFeature("human", new StringRef("plus")); 2732 fm.setFeature("relpron", new StringRef("who")); 2733 nonterm.setFeatureMap(fm); 2734 l.add(nonterm); 2735 term = new Terminal("or who"); 2736 l.add(term); 2737 addGrammarRule(new GrammarRule(ann, l, false)); 2738 2739 // or_relpron(human:minus, relpron:which)=>['or which'] 2740 l.clear(); 2741 featureHash.clear(); 2742 ann = new Annotation(); 2743 nonterm = new Nonterminal("or_relpron"); 2744 fm = new FeatureMap(); 2745 fm.setFeature("human", new StringRef("minus")); 2746 fm.setFeature("relpron", new StringRef("which")); 2747 nonterm.setFeatureMap(fm); 2748 l.add(nonterm); 2749 term = new Terminal("or which"); 2750 l.add(term); 2751 addGrammarRule(new GrammarRule(ann, l, false)); 2752 2753 // and_relpron(human:A, relpron:B)=>[and], relpron(human:A, relpron:B) 2754 l.clear(); 2755 featureHash.clear(); 2756 ann = new Annotation(); 2757 nonterm = new Nonterminal("and_relpron"); 2758 fm = new FeatureMap(); 2759 setFeature(fm, "human", 0, featureHash); 2760 setFeature(fm, "relpron", 1, featureHash); 2761 nonterm.setFeatureMap(fm); 2762 l.add(nonterm); 2763 term = new Terminal("and"); 2764 l.add(term); 2765 nonterm = new Nonterminal("relpron"); 2766 fm = new FeatureMap(); 2767 setFeature(fm, "human", 0, featureHash); 2768 setFeature(fm, "relpron", 1, featureHash); 2769 nonterm.setFeatureMap(fm); 2770 l.add(nonterm); 2771 addGrammarRule(new GrammarRule(ann, l, false)); 2772 2773 // and_relpron(relpron:that)=>['and that'] 2774 l.clear(); 2775 featureHash.clear(); 2776 ann = new Annotation(); 2777 nonterm = new Nonterminal("and_relpron"); 2778 fm = new FeatureMap(); 2779 fm.setFeature("relpron", new StringRef("that")); 2780 nonterm.setFeatureMap(fm); 2781 l.add(nonterm); 2782 term = new Terminal("and that"); 2783 l.add(term); 2784 addGrammarRule(new GrammarRule(ann, l, false)); 2785 2786 // and_relpron(human:plus, relpron:who)=>['and who'] 2787 l.clear(); 2788 featureHash.clear(); 2789 ann = new Annotation(); 2790 nonterm = new Nonterminal("and_relpron"); 2791 fm = new FeatureMap(); 2792 fm.setFeature("human", new StringRef("plus")); 2793 fm.setFeature("relpron", new StringRef("who")); 2794 nonterm.setFeatureMap(fm); 2795 l.add(nonterm); 2796 term = new Terminal("and who"); 2797 l.add(term); 2798 addGrammarRule(new GrammarRule(ann, l, false)); 2799 2800 // and_relpron(human:minus, relpron:which)=>['and which'] 2801 l.clear(); 2802 featureHash.clear(); 2803 ann = new Annotation(); 2804 nonterm = new Nonterminal("and_relpron"); 2805 fm = new FeatureMap(); 2806 fm.setFeature("human", new StringRef("minus")); 2807 fm.setFeature("relpron", new StringRef("which")); 2808 nonterm.setFeatureMap(fm); 2809 l.add(nonterm); 2810 term = new Terminal("and which"); 2811 l.add(term); 2812 addGrammarRule(new GrammarRule(ann, l, false)); 2813 2814 2815 /* --- Verb Phrase Modifiers --- */ 2816 2817 /* Verb phrase modifiers are represented by 'vmod' and the auxiliary category 'vmod_x', 2818 and are always optional: */ 2819 2820 // vmod(whin:A, whout:A)=>[] 2821 l.clear(); 2822 featureHash.clear(); 2823 ann = new Annotation(); 2824 nonterm = new Nonterminal("vmod"); 2825 fm = new FeatureMap(); 2826 setFeature(fm, "whin", 0, featureHash); 2827 setFeature(fm, "whout", 0, featureHash); 2828 nonterm.setFeatureMap(fm); 2829 l.add(nonterm); 2830 addGrammarRule(new GrammarRule(ann, l, false)); 2831 2832 // vmod(subj:A, rel:B, embv:minus, copula:C, qu:D, whin:E, whout:F)=>adv_coord(copula:C), vmod_x(subj:A, rel:B, copula:C, qu:D, whin:E, whout:F) 2833 l.clear(); 2834 featureHash.clear(); 2835 ann = new Annotation(); 2836 nonterm = new Nonterminal("vmod"); 2837 fm = new FeatureMap(); 2838 setFeature(fm, "subj", 0, featureHash); 2839 setFeature(fm, "rel", 1, featureHash); 2840 fm.setFeature("embv", new StringRef("minus")); 2841 setFeature(fm, "copula", 2, featureHash); 2842 setFeature(fm, "qu", 3, featureHash); 2843 setFeature(fm, "whin", 4, featureHash); 2844 setFeature(fm, "whout", 5, featureHash); 2845 nonterm.setFeatureMap(fm); 2846 l.add(nonterm); 2847 nonterm = new Nonterminal("adv_coord"); 2848 fm = new FeatureMap(); 2849 setFeature(fm, "copula", 2, featureHash); 2850 nonterm.setFeatureMap(fm); 2851 l.add(nonterm); 2852 nonterm = new Nonterminal("vmod_x"); 2853 fm = new FeatureMap(); 2854 setFeature(fm, "subj", 0, featureHash); 2855 setFeature(fm, "rel", 1, featureHash); 2856 setFeature(fm, "copula", 2, featureHash); 2857 setFeature(fm, "qu", 3, featureHash); 2858 setFeature(fm, "whin", 4, featureHash); 2859 setFeature(fm, "whout", 5, featureHash); 2860 nonterm.setFeatureMap(fm); 2861 l.add(nonterm); 2862 addGrammarRule(new GrammarRule(ann, l, false)); 2863 2864 // vmod(subj:A, rel:B, embv:minus, copula:C, qu:D, whin:E, whout:F)=>pp(subj:A, rel:B, embv:G, qu:D, whin:E, whout:H), vmod(subj:A, rel:B, embv:G, copula:C, qu:D, whin:H, whout:F) 2865 l.clear(); 2866 featureHash.clear(); 2867 ann = new Annotation(); 2868 nonterm = new Nonterminal("vmod"); 2869 fm = new FeatureMap(); 2870 setFeature(fm, "subj", 0, featureHash); 2871 setFeature(fm, "rel", 1, featureHash); 2872 fm.setFeature("embv", new StringRef("minus")); 2873 setFeature(fm, "copula", 2, featureHash); 2874 setFeature(fm, "qu", 3, featureHash); 2875 setFeature(fm, "whin", 4, featureHash); 2876 setFeature(fm, "whout", 5, featureHash); 2877 nonterm.setFeatureMap(fm); 2878 l.add(nonterm); 2879 nonterm = new Nonterminal("pp"); 2880 fm = new FeatureMap(); 2881 setFeature(fm, "subj", 0, featureHash); 2882 setFeature(fm, "rel", 1, featureHash); 2883 setFeature(fm, "embv", 6, featureHash); 2884 setFeature(fm, "qu", 3, featureHash); 2885 setFeature(fm, "whin", 4, featureHash); 2886 setFeature(fm, "whout", 7, featureHash); 2887 nonterm.setFeatureMap(fm); 2888 l.add(nonterm); 2889 nonterm = new Nonterminal("vmod"); 2890 fm = new FeatureMap(); 2891 setFeature(fm, "subj", 0, featureHash); 2892 setFeature(fm, "rel", 1, featureHash); 2893 setFeature(fm, "embv", 6, featureHash); 2894 setFeature(fm, "copula", 2, featureHash); 2895 setFeature(fm, "qu", 3, featureHash); 2896 setFeature(fm, "whin", 7, featureHash); 2897 setFeature(fm, "whout", 5, featureHash); 2898 nonterm.setFeatureMap(fm); 2899 l.add(nonterm); 2900 addGrammarRule(new GrammarRule(ann, l, false)); 2901 2902 // vmod_x(whin:A, whout:A)=>[] 2903 l.clear(); 2904 featureHash.clear(); 2905 ann = new Annotation(); 2906 nonterm = new Nonterminal("vmod_x"); 2907 fm = new FeatureMap(); 2908 setFeature(fm, "whin", 0, featureHash); 2909 setFeature(fm, "whout", 0, featureHash); 2910 nonterm.setFeatureMap(fm); 2911 l.add(nonterm); 2912 addGrammarRule(new GrammarRule(ann, l, false)); 2913 2914 // vmod_x(subj:A, rel:B, copula:C, qu:D, whin:E, whout:F)=>pp(subj:A, rel:B, embv:G, qu:D, whin:E, whout:H), vmod(subj:A, rel:B, embv:G, copula:C, qu:D, whin:H, whout:F) 2915 l.clear(); 2916 featureHash.clear(); 2917 ann = new Annotation(); 2918 nonterm = new Nonterminal("vmod_x"); 2919 fm = new FeatureMap(); 2920 setFeature(fm, "subj", 0, featureHash); 2921 setFeature(fm, "rel", 1, featureHash); 2922 setFeature(fm, "copula", 2, featureHash); 2923 setFeature(fm, "qu", 3, featureHash); 2924 setFeature(fm, "whin", 4, featureHash); 2925 setFeature(fm, "whout", 5, featureHash); 2926 nonterm.setFeatureMap(fm); 2927 l.add(nonterm); 2928 nonterm = new Nonterminal("pp"); 2929 fm = new FeatureMap(); 2930 setFeature(fm, "subj", 0, featureHash); 2931 setFeature(fm, "rel", 1, featureHash); 2932 setFeature(fm, "embv", 6, featureHash); 2933 setFeature(fm, "qu", 3, featureHash); 2934 setFeature(fm, "whin", 4, featureHash); 2935 setFeature(fm, "whout", 7, featureHash); 2936 nonterm.setFeatureMap(fm); 2937 l.add(nonterm); 2938 nonterm = new Nonterminal("vmod"); 2939 fm = new FeatureMap(); 2940 setFeature(fm, "subj", 0, featureHash); 2941 setFeature(fm, "rel", 1, featureHash); 2942 setFeature(fm, "embv", 6, featureHash); 2943 setFeature(fm, "copula", 2, featureHash); 2944 setFeature(fm, "qu", 3, featureHash); 2945 setFeature(fm, "whin", 7, featureHash); 2946 setFeature(fm, "whout", 5, featureHash); 2947 nonterm.setFeatureMap(fm); 2948 l.add(nonterm); 2949 addGrammarRule(new GrammarRule(ann, l, false)); 2950 2951 /* The category 'pp' represents prepositional phrases: */ 2952 2953 // pp(subj:A, rel:B, embv:C, qu:D, whin:E, whout:F)=> $prep, np(subj:A, rel:B, embv:C, case:acc, qu:D, whin:E, whout:F) 2954 l.clear(); 2955 featureHash.clear(); 2956 ann = new Annotation(); 2957 nonterm = new Nonterminal("pp"); 2958 fm = new FeatureMap(); 2959 setFeature(fm, "subj", 0, featureHash); 2960 setFeature(fm, "rel", 1, featureHash); 2961 setFeature(fm, "embv", 2, featureHash); 2962 setFeature(fm, "qu", 3, featureHash); 2963 setFeature(fm, "whin", 4, featureHash); 2964 setFeature(fm, "whout", 5, featureHash); 2965 nonterm.setFeatureMap(fm); 2966 l.add(nonterm); 2967 preterm = new Preterminal("prep"); 2968 fm = new FeatureMap(); 2969 preterm.setFeatureMap(fm); 2970 l.add(preterm); 2971 nonterm = new Nonterminal("np"); 2972 fm = new FeatureMap(); 2973 setFeature(fm, "subj", 0, featureHash); 2974 setFeature(fm, "rel", 1, featureHash); 2975 setFeature(fm, "embv", 2, featureHash); 2976 fm.setFeature("case", new StringRef("acc")); 2977 setFeature(fm, "qu", 3, featureHash); 2978 setFeature(fm, "whin", 4, featureHash); 2979 setFeature(fm, "whout", 5, featureHash); 2980 nonterm.setFeatureMap(fm); 2981 l.add(nonterm); 2982 addGrammarRule(new GrammarRule(ann, l, false)); 2983 2984 /* Adverbs can be coordinated by "and", which is represented by 'adv_coord': */ 2985 2986 // adv_coord(copula:minus)=>adv_phrase 2987 l.clear(); 2988 featureHash.clear(); 2989 ann = new Annotation(); 2990 nonterm = new Nonterminal("adv_coord"); 2991 fm = new FeatureMap(); 2992 fm.setFeature("copula", new StringRef("minus")); 2993 nonterm.setFeatureMap(fm); 2994 l.add(nonterm); 2995 nonterm = new Nonterminal("adv_phrase"); 2996 fm = new FeatureMap(); 2997 nonterm.setFeatureMap(fm); 2998 l.add(nonterm); 2999 addGrammarRule(new GrammarRule(ann, l, false)); 3000 3001 // adv_coord(copula:minus)=>adv_phrase, [and], adv_coord 3002 l.clear(); 3003 featureHash.clear(); 3004 ann = new Annotation(); 3005 nonterm = new Nonterminal("adv_coord"); 3006 fm = new FeatureMap(); 3007 fm.setFeature("copula", new StringRef("minus")); 3008 nonterm.setFeatureMap(fm); 3009 l.add(nonterm); 3010 nonterm = new Nonterminal("adv_phrase"); 3011 fm = new FeatureMap(); 3012 nonterm.setFeatureMap(fm); 3013 l.add(nonterm); 3014 term = new Terminal("and"); 3015 l.add(term); 3016 nonterm = new Nonterminal("adv_coord"); 3017 fm = new FeatureMap(); 3018 nonterm.setFeatureMap(fm); 3019 l.add(nonterm); 3020 addGrammarRule(new GrammarRule(ann, l, false)); 3021 3022 /* Adverbial phrases are represented by 'adv_phrase', and can be in positive, comparative 3023 or superlative form: */ 3024 3025 // adv_phrase=> $adv 3026 l.clear(); 3027 featureHash.clear(); 3028 ann = new Annotation(); 3029 nonterm = new Nonterminal("adv_phrase"); 3030 fm = new FeatureMap(); 3031 nonterm.setFeatureMap(fm); 3032 l.add(nonterm); 3033 preterm = new Preterminal("adv"); 3034 fm = new FeatureMap(); 3035 preterm.setFeatureMap(fm); 3036 l.add(preterm); 3037 addGrammarRule(new GrammarRule(ann, l, false)); 3038 3039 // adv_phrase=>[more], $adv 3040 l.clear(); 3041 featureHash.clear(); 3042 ann = new Annotation(); 3043 nonterm = new Nonterminal("adv_phrase"); 3044 fm = new FeatureMap(); 3045 nonterm.setFeatureMap(fm); 3046 l.add(nonterm); 3047 term = new Terminal("more"); 3048 l.add(term); 3049 preterm = new Preterminal("adv"); 3050 fm = new FeatureMap(); 3051 preterm.setFeatureMap(fm); 3052 l.add(preterm); 3053 addGrammarRule(new GrammarRule(ann, l, false)); 3054 3055 // adv_phrase=> $adv_comp 3056 l.clear(); 3057 featureHash.clear(); 3058 ann = new Annotation(); 3059 nonterm = new Nonterminal("adv_phrase"); 3060 fm = new FeatureMap(); 3061 nonterm.setFeatureMap(fm); 3062 l.add(nonterm); 3063 preterm = new Preterminal("adv_comp"); 3064 fm = new FeatureMap(); 3065 preterm.setFeatureMap(fm); 3066 l.add(preterm); 3067 addGrammarRule(new GrammarRule(ann, l, false)); 3068 3069 // adv_phrase=>[most], $adv 3070 l.clear(); 3071 featureHash.clear(); 3072 ann = new Annotation(); 3073 nonterm = new Nonterminal("adv_phrase"); 3074 fm = new FeatureMap(); 3075 nonterm.setFeatureMap(fm); 3076 l.add(nonterm); 3077 term = new Terminal("most"); 3078 l.add(term); 3079 preterm = new Preterminal("adv"); 3080 fm = new FeatureMap(); 3081 preterm.setFeatureMap(fm); 3082 l.add(preterm); 3083 addGrammarRule(new GrammarRule(ann, l, false)); 3084 3085 // adv_phrase=> $adv_sup 3086 l.clear(); 3087 featureHash.clear(); 3088 ann = new Annotation(); 3089 nonterm = new Nonterminal("adv_phrase"); 3090 fm = new FeatureMap(); 3091 nonterm.setFeatureMap(fm); 3092 l.add(nonterm); 3093 preterm = new Preterminal("adv_sup"); 3094 fm = new FeatureMap(); 3095 preterm.setFeatureMap(fm); 3096 l.add(preterm); 3097 addGrammarRule(new GrammarRule(ann, l, false)); 3098 3099 3100 /* --- Verbs --- */ 3101 3102 /* The category 'verb' represents main verbs that can be intransitive or transitive: */ 3103 3104 // verb(be:minus, vcat:itr, pl:minus, vform:fin)=> $iv_finsg 3105 l.clear(); 3106 featureHash.clear(); 3107 ann = new Annotation(); 3108 nonterm = new Nonterminal("verb"); 3109 fm = new FeatureMap(); 3110 fm.setFeature("be", new StringRef("minus")); 3111 fm.setFeature("vcat", new StringRef("itr")); 3112 fm.setFeature("pl", new StringRef("minus")); 3113 fm.setFeature("vform", new StringRef("fin")); 3114 nonterm.setFeatureMap(fm); 3115 l.add(nonterm); 3116 preterm = new Preterminal("iv_finsg"); 3117 fm = new FeatureMap(); 3118 preterm.setFeatureMap(fm); 3119 l.add(preterm); 3120 addGrammarRule(new GrammarRule(ann, l, false)); 3121 3122 // verb(be:minus, vcat:itr, pl:plus, vform:fin)=> $iv_infpl 3123 l.clear(); 3124 featureHash.clear(); 3125 ann = new Annotation(); 3126 nonterm = new Nonterminal("verb"); 3127 fm = new FeatureMap(); 3128 fm.setFeature("be", new StringRef("minus")); 3129 fm.setFeature("vcat", new StringRef("itr")); 3130 fm.setFeature("pl", new StringRef("plus")); 3131 fm.setFeature("vform", new StringRef("fin")); 3132 nonterm.setFeatureMap(fm); 3133 l.add(nonterm); 3134 preterm = new Preterminal("iv_infpl"); 3135 fm = new FeatureMap(); 3136 preterm.setFeatureMap(fm); 3137 l.add(preterm); 3138 addGrammarRule(new GrammarRule(ann, l, false)); 3139 3140 // verb(be:minus, vcat:itr, vform:inf)=> $iv_infpl 3141 l.clear(); 3142 featureHash.clear(); 3143 ann = new Annotation(); 3144 nonterm = new Nonterminal("verb"); 3145 fm = new FeatureMap(); 3146 fm.setFeature("be", new StringRef("minus")); 3147 fm.setFeature("vcat", new StringRef("itr")); 3148 fm.setFeature("vform", new StringRef("inf")); 3149 nonterm.setFeatureMap(fm); 3150 l.add(nonterm); 3151 preterm = new Preterminal("iv_infpl"); 3152 fm = new FeatureMap(); 3153 preterm.setFeatureMap(fm); 3154 l.add(preterm); 3155 addGrammarRule(new GrammarRule(ann, l, false)); 3156 3157 // verb(be:minus, vcat:tr, pl:minus, vform:fin)=> $tv_finsg 3158 l.clear(); 3159 featureHash.clear(); 3160 ann = new Annotation(); 3161 nonterm = new Nonterminal("verb"); 3162 fm = new FeatureMap(); 3163 fm.setFeature("be", new StringRef("minus")); 3164 fm.setFeature("vcat", new StringRef("tr")); 3165 fm.setFeature("pl", new StringRef("minus")); 3166 fm.setFeature("vform", new StringRef("fin")); 3167 nonterm.setFeatureMap(fm); 3168 l.add(nonterm); 3169 preterm = new Preterminal("tv_finsg"); 3170 fm = new FeatureMap(); 3171 preterm.setFeatureMap(fm); 3172 l.add(preterm); 3173 addGrammarRule(new GrammarRule(ann, l, false)); 3174 3175 // verb(be:minus, vcat:tr, pl:plus, vform:fin)=> $tv_infpl 3176 l.clear(); 3177 featureHash.clear(); 3178 ann = new Annotation(); 3179 nonterm = new Nonterminal("verb"); 3180 fm = new FeatureMap(); 3181 fm.setFeature("be", new StringRef("minus")); 3182 fm.setFeature("vcat", new StringRef("tr")); 3183 fm.setFeature("pl", new StringRef("plus")); 3184 fm.setFeature("vform", new StringRef("fin")); 3185 nonterm.setFeatureMap(fm); 3186 l.add(nonterm); 3187 preterm = new Preterminal("tv_infpl"); 3188 fm = new FeatureMap(); 3189 preterm.setFeatureMap(fm); 3190 l.add(preterm); 3191 addGrammarRule(new GrammarRule(ann, l, false)); 3192 3193 // verb(be:minus, vcat:tr, vform:inf)=> $tv_infpl 3194 l.clear(); 3195 featureHash.clear(); 3196 ann = new Annotation(); 3197 nonterm = new Nonterminal("verb"); 3198 fm = new FeatureMap(); 3199 fm.setFeature("be", new StringRef("minus")); 3200 fm.setFeature("vcat", new StringRef("tr")); 3201 fm.setFeature("vform", new StringRef("inf")); 3202 nonterm.setFeatureMap(fm); 3203 l.add(nonterm); 3204 preterm = new Preterminal("tv_infpl"); 3205 fm = new FeatureMap(); 3206 preterm.setFeatureMap(fm); 3207 l.add(preterm); 3208 addGrammarRule(new GrammarRule(ann, l, false)); 3209 3210 // verb(be:plus, vcat:tr)=> $tv_pp 3211 l.clear(); 3212 featureHash.clear(); 3213 ann = new Annotation(); 3214 nonterm = new Nonterminal("verb"); 3215 fm = new FeatureMap(); 3216 fm.setFeature("be", new StringRef("plus")); 3217 fm.setFeature("vcat", new StringRef("tr")); 3218 nonterm.setFeatureMap(fm); 3219 l.add(nonterm); 3220 preterm = new Preterminal("tv_pp"); 3221 fm = new FeatureMap(); 3222 preterm.setFeatureMap(fm); 3223 l.add(preterm); 3224 addGrammarRule(new GrammarRule(ann, l, false)); 3225 3226 /* Auxiliary verbs are represented by 'aux', which includes negation markers: */ 3227 3228 // aux(be:plus, exist:plus, pl:minus)=>[is] 3229 l.clear(); 3230 featureHash.clear(); 3231 ann = new Annotation(); 3232 nonterm = new Nonterminal("aux"); 3233 fm = new FeatureMap(); 3234 fm.setFeature("be", new StringRef("plus")); 3235 fm.setFeature("exist", new StringRef("plus")); 3236 fm.setFeature("pl", new StringRef("minus")); 3237 nonterm.setFeatureMap(fm); 3238 l.add(nonterm); 3239 term = new Terminal("is"); 3240 l.add(term); 3241 addGrammarRule(new GrammarRule(ann, l, false)); 3242 3243 // aux(be:plus, exist:minus, pl:minus)=> //, ['is not'] 3244 l.clear(); 3245 featureHash.clear(); 3246 ann = new Annotation(); 3247 nonterm = new Nonterminal("aux"); 3248 fm = new FeatureMap(); 3249 fm.setFeature("be", new StringRef("plus")); 3250 fm.setFeature("exist", new StringRef("minus")); 3251 fm.setFeature("pl", new StringRef("minus")); 3252 nonterm.setFeatureMap(fm); 3253 l.add(nonterm); 3254 nonterm = new Nonterminal("//"); 3255 fm = new FeatureMap(); 3256 nonterm.setFeatureMap(fm); 3257 l.add(nonterm); 3258 term = new Terminal("is not"); 3259 l.add(term); 3260 addGrammarRule(new GrammarRule(ann, l, false)); 3261 3262 // aux(be:plus, exist:minus, pl:minus)=> //, [is, not] 3263 l.clear(); 3264 featureHash.clear(); 3265 ann = new Annotation(); 3266 nonterm = new Nonterminal("aux"); 3267 fm = new FeatureMap(); 3268 fm.setFeature("be", new StringRef("plus")); 3269 fm.setFeature("exist", new StringRef("minus")); 3270 fm.setFeature("pl", new StringRef("minus")); 3271 nonterm.setFeatureMap(fm); 3272 l.add(nonterm); 3273 nonterm = new Nonterminal("//"); 3274 fm = new FeatureMap(); 3275 nonterm.setFeatureMap(fm); 3276 l.add(nonterm); 3277 term = new Terminal("is"); 3278 l.add(term); 3279 term = new Terminal("not"); 3280 l.add(term); 3281 addGrammarRule(new GrammarRule(ann, l, false)); 3282 3283 // aux(be:plus, exist:plus, pl:plus)=>[are] 3284 l.clear(); 3285 featureHash.clear(); 3286 ann = new Annotation(); 3287 nonterm = new Nonterminal("aux"); 3288 fm = new FeatureMap(); 3289 fm.setFeature("be", new StringRef("plus")); 3290 fm.setFeature("exist", new StringRef("plus")); 3291 fm.setFeature("pl", new StringRef("plus")); 3292 nonterm.setFeatureMap(fm); 3293 l.add(nonterm); 3294 term = new Terminal("are"); 3295 l.add(term); 3296 addGrammarRule(new GrammarRule(ann, l, false)); 3297 3298 // aux(be:plus, exist:minus, pl:plus)=> //, ['are not'] 3299 l.clear(); 3300 featureHash.clear(); 3301 ann = new Annotation(); 3302 nonterm = new Nonterminal("aux"); 3303 fm = new FeatureMap(); 3304 fm.setFeature("be", new StringRef("plus")); 3305 fm.setFeature("exist", new StringRef("minus")); 3306 fm.setFeature("pl", new StringRef("plus")); 3307 nonterm.setFeatureMap(fm); 3308 l.add(nonterm); 3309 nonterm = new Nonterminal("//"); 3310 fm = new FeatureMap(); 3311 nonterm.setFeatureMap(fm); 3312 l.add(nonterm); 3313 term = new Terminal("are not"); 3314 l.add(term); 3315 addGrammarRule(new GrammarRule(ann, l, false)); 3316 3317 // aux(be:plus, exist:minus, pl:plus)=> //, [are, not] 3318 l.clear(); 3319 featureHash.clear(); 3320 ann = new Annotation(); 3321 nonterm = new Nonterminal("aux"); 3322 fm = new FeatureMap(); 3323 fm.setFeature("be", new StringRef("plus")); 3324 fm.setFeature("exist", new StringRef("minus")); 3325 fm.setFeature("pl", new StringRef("plus")); 3326 nonterm.setFeatureMap(fm); 3327 l.add(nonterm); 3328 nonterm = new Nonterminal("//"); 3329 fm = new FeatureMap(); 3330 nonterm.setFeatureMap(fm); 3331 l.add(nonterm); 3332 term = new Terminal("are"); 3333 l.add(term); 3334 term = new Terminal("not"); 3335 l.add(term); 3336 addGrammarRule(new GrammarRule(ann, l, false)); 3337 3338 // aux(be:minus, exist:minus, pl:minus)=> //, ['does not'] 3339 l.clear(); 3340 featureHash.clear(); 3341 ann = new Annotation(); 3342 nonterm = new Nonterminal("aux"); 3343 fm = new FeatureMap(); 3344 fm.setFeature("be", new StringRef("minus")); 3345 fm.setFeature("exist", new StringRef("minus")); 3346 fm.setFeature("pl", new StringRef("minus")); 3347 nonterm.setFeatureMap(fm); 3348 l.add(nonterm); 3349 nonterm = new Nonterminal("//"); 3350 fm = new FeatureMap(); 3351 nonterm.setFeatureMap(fm); 3352 l.add(nonterm); 3353 term = new Terminal("does not"); 3354 l.add(term); 3355 addGrammarRule(new GrammarRule(ann, l, false)); 3356 3357 // aux(be:minus, exist:minus, pl:plus)=> //, ['do not'] 3358 l.clear(); 3359 featureHash.clear(); 3360 ann = new Annotation(); 3361 nonterm = new Nonterminal("aux"); 3362 fm = new FeatureMap(); 3363 fm.setFeature("be", new StringRef("minus")); 3364 fm.setFeature("exist", new StringRef("minus")); 3365 fm.setFeature("pl", new StringRef("plus")); 3366 nonterm.setFeatureMap(fm); 3367 l.add(nonterm); 3368 nonterm = new Nonterminal("//"); 3369 fm = new FeatureMap(); 3370 nonterm.setFeatureMap(fm); 3371 l.add(nonterm); 3372 term = new Terminal("do not"); 3373 l.add(term); 3374 addGrammarRule(new GrammarRule(ann, l, false)); 3375 3376 // aux(be:minus, exist:minus)=> //, [can] 3377 l.clear(); 3378 featureHash.clear(); 3379 ann = new Annotation(); 3380 nonterm = new Nonterminal("aux"); 3381 fm = new FeatureMap(); 3382 fm.setFeature("be", new StringRef("minus")); 3383 fm.setFeature("exist", new StringRef("minus")); 3384 nonterm.setFeatureMap(fm); 3385 l.add(nonterm); 3386 nonterm = new Nonterminal("//"); 3387 fm = new FeatureMap(); 3388 nonterm.setFeatureMap(fm); 3389 l.add(nonterm); 3390 term = new Terminal("can"); 3391 l.add(term); 3392 addGrammarRule(new GrammarRule(ann, l, false)); 3393 3394 // aux(be:minus, exist:minus)=> //, [should] 3395 l.clear(); 3396 featureHash.clear(); 3397 ann = new Annotation(); 3398 nonterm = new Nonterminal("aux"); 3399 fm = new FeatureMap(); 3400 fm.setFeature("be", new StringRef("minus")); 3401 fm.setFeature("exist", new StringRef("minus")); 3402 nonterm.setFeatureMap(fm); 3403 l.add(nonterm); 3404 nonterm = new Nonterminal("//"); 3405 fm = new FeatureMap(); 3406 nonterm.setFeatureMap(fm); 3407 l.add(nonterm); 3408 term = new Terminal("should"); 3409 l.add(term); 3410 addGrammarRule(new GrammarRule(ann, l, false)); 3411 3412 // aux(be:minus, exist:minus)=> //, [must] 3413 l.clear(); 3414 featureHash.clear(); 3415 ann = new Annotation(); 3416 nonterm = new Nonterminal("aux"); 3417 fm = new FeatureMap(); 3418 fm.setFeature("be", new StringRef("minus")); 3419 fm.setFeature("exist", new StringRef("minus")); 3420 nonterm.setFeatureMap(fm); 3421 l.add(nonterm); 3422 nonterm = new Nonterminal("//"); 3423 fm = new FeatureMap(); 3424 nonterm.setFeatureMap(fm); 3425 l.add(nonterm); 3426 term = new Terminal("must"); 3427 l.add(term); 3428 addGrammarRule(new GrammarRule(ann, l, false)); 3429 3430 // aux(be:minus, exist:minus, pl:minus)=> //, ['has to'] 3431 l.clear(); 3432 featureHash.clear(); 3433 ann = new Annotation(); 3434 nonterm = new Nonterminal("aux"); 3435 fm = new FeatureMap(); 3436 fm.setFeature("be", new StringRef("minus")); 3437 fm.setFeature("exist", new StringRef("minus")); 3438 fm.setFeature("pl", new StringRef("minus")); 3439 nonterm.setFeatureMap(fm); 3440 l.add(nonterm); 3441 nonterm = new Nonterminal("//"); 3442 fm = new FeatureMap(); 3443 nonterm.setFeatureMap(fm); 3444 l.add(nonterm); 3445 term = new Terminal("has to"); 3446 l.add(term); 3447 addGrammarRule(new GrammarRule(ann, l, false)); 3448 3449 // aux(be:minus, exist:minus, pl:plus)=> //, ['have to'] 3450 l.clear(); 3451 featureHash.clear(); 3452 ann = new Annotation(); 3453 nonterm = new Nonterminal("aux"); 3454 fm = new FeatureMap(); 3455 fm.setFeature("be", new StringRef("minus")); 3456 fm.setFeature("exist", new StringRef("minus")); 3457 fm.setFeature("pl", new StringRef("plus")); 3458 nonterm.setFeatureMap(fm); 3459 l.add(nonterm); 3460 nonterm = new Nonterminal("//"); 3461 fm = new FeatureMap(); 3462 nonterm.setFeatureMap(fm); 3463 l.add(nonterm); 3464 term = new Terminal("have to"); 3465 l.add(term); 3466 addGrammarRule(new GrammarRule(ann, l, false)); 3467 3468 // aux(be:plus, exist:minus)=> //, [can, be] 3469 l.clear(); 3470 featureHash.clear(); 3471 ann = new Annotation(); 3472 nonterm = new Nonterminal("aux"); 3473 fm = new FeatureMap(); 3474 fm.setFeature("be", new StringRef("plus")); 3475 fm.setFeature("exist", new StringRef("minus")); 3476 nonterm.setFeatureMap(fm); 3477 l.add(nonterm); 3478 nonterm = new Nonterminal("//"); 3479 fm = new FeatureMap(); 3480 nonterm.setFeatureMap(fm); 3481 l.add(nonterm); 3482 term = new Terminal("can"); 3483 l.add(term); 3484 term = new Terminal("be"); 3485 l.add(term); 3486 addGrammarRule(new GrammarRule(ann, l, false)); 3487 3488 // aux(be:plus, exist:minus)=> //, [should, be] 3489 l.clear(); 3490 featureHash.clear(); 3491 ann = new Annotation(); 3492 nonterm = new Nonterminal("aux"); 3493 fm = new FeatureMap(); 3494 fm.setFeature("be", new StringRef("plus")); 3495 fm.setFeature("exist", new StringRef("minus")); 3496 nonterm.setFeatureMap(fm); 3497 l.add(nonterm); 3498 nonterm = new Nonterminal("//"); 3499 fm = new FeatureMap(); 3500 nonterm.setFeatureMap(fm); 3501 l.add(nonterm); 3502 term = new Terminal("should"); 3503 l.add(term); 3504 term = new Terminal("be"); 3505 l.add(term); 3506 addGrammarRule(new GrammarRule(ann, l, false)); 3507 3508 // aux(be:plus, exist:minus)=> //, [must, be] 3509 l.clear(); 3510 featureHash.clear(); 3511 ann = new Annotation(); 3512 nonterm = new Nonterminal("aux"); 3513 fm = new FeatureMap(); 3514 fm.setFeature("be", new StringRef("plus")); 3515 fm.setFeature("exist", new StringRef("minus")); 3516 nonterm.setFeatureMap(fm); 3517 l.add(nonterm); 3518 nonterm = new Nonterminal("//"); 3519 fm = new FeatureMap(); 3520 nonterm.setFeatureMap(fm); 3521 l.add(nonterm); 3522 term = new Terminal("must"); 3523 l.add(term); 3524 term = new Terminal("be"); 3525 l.add(term); 3526 addGrammarRule(new GrammarRule(ann, l, false)); 3527 3528 // aux(be:plus, exist:minus, pl:minus)=> //, ['has to', be] 3529 l.clear(); 3530 featureHash.clear(); 3531 ann = new Annotation(); 3532 nonterm = new Nonterminal("aux"); 3533 fm = new FeatureMap(); 3534 fm.setFeature("be", new StringRef("plus")); 3535 fm.setFeature("exist", new StringRef("minus")); 3536 fm.setFeature("pl", new StringRef("minus")); 3537 nonterm.setFeatureMap(fm); 3538 l.add(nonterm); 3539 nonterm = new Nonterminal("//"); 3540 fm = new FeatureMap(); 3541 nonterm.setFeatureMap(fm); 3542 l.add(nonterm); 3543 term = new Terminal("has to"); 3544 l.add(term); 3545 term = new Terminal("be"); 3546 l.add(term); 3547 addGrammarRule(new GrammarRule(ann, l, false)); 3548 3549 // aux(be:plus, exist:minus, pl:plus)=> //, ['have to', be] 3550 l.clear(); 3551 featureHash.clear(); 3552 ann = new Annotation(); 3553 nonterm = new Nonterminal("aux"); 3554 fm = new FeatureMap(); 3555 fm.setFeature("be", new StringRef("plus")); 3556 fm.setFeature("exist", new StringRef("minus")); 3557 fm.setFeature("pl", new StringRef("plus")); 3558 nonterm.setFeatureMap(fm); 3559 l.add(nonterm); 3560 nonterm = new Nonterminal("//"); 3561 fm = new FeatureMap(); 3562 nonterm.setFeatureMap(fm); 3563 l.add(nonterm); 3564 term = new Terminal("have to"); 3565 l.add(term); 3566 term = new Terminal("be"); 3567 l.add(term); 3568 addGrammarRule(new GrammarRule(ann, l, false)); 3569 3570 // aux(be:plus, exist:minus)=> //, [cannot, be] 3571 l.clear(); 3572 featureHash.clear(); 3573 ann = new Annotation(); 3574 nonterm = new Nonterminal("aux"); 3575 fm = new FeatureMap(); 3576 fm.setFeature("be", new StringRef("plus")); 3577 fm.setFeature("exist", new StringRef("minus")); 3578 nonterm.setFeatureMap(fm); 3579 l.add(nonterm); 3580 nonterm = new Nonterminal("//"); 3581 fm = new FeatureMap(); 3582 nonterm.setFeatureMap(fm); 3583 l.add(nonterm); 3584 term = new Terminal("cannot"); 3585 l.add(term); 3586 term = new Terminal("be"); 3587 l.add(term); 3588 addGrammarRule(new GrammarRule(ann, l, false)); 3589 3590 // aux(be:plus, exist:minus)=> //, [can, not, be] 3591 l.clear(); 3592 featureHash.clear(); 3593 ann = new Annotation(); 3594 nonterm = new Nonterminal("aux"); 3595 fm = new FeatureMap(); 3596 fm.setFeature("be", new StringRef("plus")); 3597 fm.setFeature("exist", new StringRef("minus")); 3598 nonterm.setFeatureMap(fm); 3599 l.add(nonterm); 3600 nonterm = new Nonterminal("//"); 3601 fm = new FeatureMap(); 3602 nonterm.setFeatureMap(fm); 3603 l.add(nonterm); 3604 term = new Terminal("can"); 3605 l.add(term); 3606 term = new Terminal("not"); 3607 l.add(term); 3608 term = new Terminal("be"); 3609 l.add(term); 3610 addGrammarRule(new GrammarRule(ann, l, false)); 3611 3612 // aux(be:plus, exist:minus)=> //, [should, not, be] 3613 l.clear(); 3614 featureHash.clear(); 3615 ann = new Annotation(); 3616 nonterm = new Nonterminal("aux"); 3617 fm = new FeatureMap(); 3618 fm.setFeature("be", new StringRef("plus")); 3619 fm.setFeature("exist", new StringRef("minus")); 3620 nonterm.setFeatureMap(fm); 3621 l.add(nonterm); 3622 nonterm = new Nonterminal("//"); 3623 fm = new FeatureMap(); 3624 nonterm.setFeatureMap(fm); 3625 l.add(nonterm); 3626 term = new Terminal("should"); 3627 l.add(term); 3628 term = new Terminal("not"); 3629 l.add(term); 3630 term = new Terminal("be"); 3631 l.add(term); 3632 addGrammarRule(new GrammarRule(ann, l, false)); 3633 3634 // aux(be:plus, exist:minus, pl:minus)=> //, ['does not', 'have to', be] 3635 l.clear(); 3636 featureHash.clear(); 3637 ann = new Annotation(); 3638 nonterm = new Nonterminal("aux"); 3639 fm = new FeatureMap(); 3640 fm.setFeature("be", new StringRef("plus")); 3641 fm.setFeature("exist", new StringRef("minus")); 3642 fm.setFeature("pl", new StringRef("minus")); 3643 nonterm.setFeatureMap(fm); 3644 l.add(nonterm); 3645 nonterm = new Nonterminal("//"); 3646 fm = new FeatureMap(); 3647 nonterm.setFeatureMap(fm); 3648 l.add(nonterm); 3649 term = new Terminal("does not"); 3650 l.add(term); 3651 term = new Terminal("have to"); 3652 l.add(term); 3653 term = new Terminal("be"); 3654 l.add(term); 3655 addGrammarRule(new GrammarRule(ann, l, false)); 3656 3657 // aux(be:plus, exist:minus, pl:plus)=> //, ['do not', 'have to', be] 3658 l.clear(); 3659 featureHash.clear(); 3660 ann = new Annotation(); 3661 nonterm = new Nonterminal("aux"); 3662 fm = new FeatureMap(); 3663 fm.setFeature("be", new StringRef("plus")); 3664 fm.setFeature("exist", new StringRef("minus")); 3665 fm.setFeature("pl", new StringRef("plus")); 3666 nonterm.setFeatureMap(fm); 3667 l.add(nonterm); 3668 nonterm = new Nonterminal("//"); 3669 fm = new FeatureMap(); 3670 nonterm.setFeatureMap(fm); 3671 l.add(nonterm); 3672 term = new Terminal("do not"); 3673 l.add(term); 3674 term = new Terminal("have to"); 3675 l.add(term); 3676 term = new Terminal("be"); 3677 l.add(term); 3678 addGrammarRule(new GrammarRule(ann, l, false)); 3679 3680 // aux(be:minus, exist:minus, pl:minus)=> //, [cannot] 3681 l.clear(); 3682 featureHash.clear(); 3683 ann = new Annotation(); 3684 nonterm = new Nonterminal("aux"); 3685 fm = new FeatureMap(); 3686 fm.setFeature("be", new StringRef("minus")); 3687 fm.setFeature("exist", new StringRef("minus")); 3688 fm.setFeature("pl", new StringRef("minus")); 3689 nonterm.setFeatureMap(fm); 3690 l.add(nonterm); 3691 nonterm = new Nonterminal("//"); 3692 fm = new FeatureMap(); 3693 nonterm.setFeatureMap(fm); 3694 l.add(nonterm); 3695 term = new Terminal("cannot"); 3696 l.add(term); 3697 addGrammarRule(new GrammarRule(ann, l, false)); 3698 3699 // aux(be:minus, exist:minus, pl:minus)=> //, [can, not] 3700 l.clear(); 3701 featureHash.clear(); 3702 ann = new Annotation(); 3703 nonterm = new Nonterminal("aux"); 3704 fm = new FeatureMap(); 3705 fm.setFeature("be", new StringRef("minus")); 3706 fm.setFeature("exist", new StringRef("minus")); 3707 fm.setFeature("pl", new StringRef("minus")); 3708 nonterm.setFeatureMap(fm); 3709 l.add(nonterm); 3710 nonterm = new Nonterminal("//"); 3711 fm = new FeatureMap(); 3712 nonterm.setFeatureMap(fm); 3713 l.add(nonterm); 3714 term = new Terminal("can"); 3715 l.add(term); 3716 term = new Terminal("not"); 3717 l.add(term); 3718 addGrammarRule(new GrammarRule(ann, l, false)); 3719 3720 // aux(be:minus, exist:minus, pl:minus)=> //, [should, not] 3721 l.clear(); 3722 featureHash.clear(); 3723 ann = new Annotation(); 3724 nonterm = new Nonterminal("aux"); 3725 fm = new FeatureMap(); 3726 fm.setFeature("be", new StringRef("minus")); 3727 fm.setFeature("exist", new StringRef("minus")); 3728 fm.setFeature("pl", new StringRef("minus")); 3729 nonterm.setFeatureMap(fm); 3730 l.add(nonterm); 3731 nonterm = new Nonterminal("//"); 3732 fm = new FeatureMap(); 3733 nonterm.setFeatureMap(fm); 3734 l.add(nonterm); 3735 term = new Terminal("should"); 3736 l.add(term); 3737 term = new Terminal("not"); 3738 l.add(term); 3739 addGrammarRule(new GrammarRule(ann, l, false)); 3740 3741 // aux(be:minus, exist:minus, pl:minus)=> //, ['does not', 'have to'] 3742 l.clear(); 3743 featureHash.clear(); 3744 ann = new Annotation(); 3745 nonterm = new Nonterminal("aux"); 3746 fm = new FeatureMap(); 3747 fm.setFeature("be", new StringRef("minus")); 3748 fm.setFeature("exist", new StringRef("minus")); 3749 fm.setFeature("pl", new StringRef("minus")); 3750 nonterm.setFeatureMap(fm); 3751 l.add(nonterm); 3752 nonterm = new Nonterminal("//"); 3753 fm = new FeatureMap(); 3754 nonterm.setFeatureMap(fm); 3755 l.add(nonterm); 3756 term = new Terminal("does not"); 3757 l.add(term); 3758 term = new Terminal("have to"); 3759 l.add(term); 3760 addGrammarRule(new GrammarRule(ann, l, false)); 3761 3762 // aux(be:minus, exist:minus, pl:plus)=> //, ['do not', 'have to'] 3763 l.clear(); 3764 featureHash.clear(); 3765 ann = new Annotation(); 3766 nonterm = new Nonterminal("aux"); 3767 fm = new FeatureMap(); 3768 fm.setFeature("be", new StringRef("minus")); 3769 fm.setFeature("exist", new StringRef("minus")); 3770 fm.setFeature("pl", new StringRef("plus")); 3771 nonterm.setFeatureMap(fm); 3772 l.add(nonterm); 3773 nonterm = new Nonterminal("//"); 3774 fm = new FeatureMap(); 3775 nonterm.setFeatureMap(fm); 3776 l.add(nonterm); 3777 term = new Terminal("do not"); 3778 l.add(term); 3779 term = new Terminal("have to"); 3780 l.add(term); 3781 addGrammarRule(new GrammarRule(ann, l, false)); 3782 3783 3784 /* --- Quantifiers --- */ 3785 3786 /* Existential and universal quantifiers are represented by 'quant': */ 3787 3788 // quant(exist:plus)=>[a] 3789 l.clear(); 3790 featureHash.clear(); 3791 ann = new Annotation(); 3792 nonterm = new Nonterminal("quant"); 3793 fm = new FeatureMap(); 3794 fm.setFeature("exist", new StringRef("plus")); 3795 nonterm.setFeatureMap(fm); 3796 l.add(nonterm); 3797 term = new Terminal("a"); 3798 l.add(term); 3799 addGrammarRule(new GrammarRule(ann, l, false)); 3800 3801 // quant(exist:plus)=>[an] 3802 l.clear(); 3803 featureHash.clear(); 3804 ann = new Annotation(); 3805 nonterm = new Nonterminal("quant"); 3806 fm = new FeatureMap(); 3807 fm.setFeature("exist", new StringRef("plus")); 3808 nonterm.setFeatureMap(fm); 3809 l.add(nonterm); 3810 term = new Terminal("an"); 3811 l.add(term); 3812 addGrammarRule(new GrammarRule(ann, l, false)); 3813 3814 // quant(exist:minus)=> //, [every] 3815 l.clear(); 3816 featureHash.clear(); 3817 ann = new Annotation(); 3818 nonterm = new Nonterminal("quant"); 3819 fm = new FeatureMap(); 3820 fm.setFeature("exist", new StringRef("minus")); 3821 nonterm.setFeatureMap(fm); 3822 l.add(nonterm); 3823 nonterm = new Nonterminal("//"); 3824 fm = new FeatureMap(); 3825 nonterm.setFeatureMap(fm); 3826 l.add(nonterm); 3827 term = new Terminal("every"); 3828 l.add(term); 3829 addGrammarRule(new GrammarRule(ann, l, false)); 3830 3831 // quant(exist:minus)=> //, [no] 3832 l.clear(); 3833 featureHash.clear(); 3834 ann = new Annotation(); 3835 nonterm = new Nonterminal("quant"); 3836 fm = new FeatureMap(); 3837 fm.setFeature("exist", new StringRef("minus")); 3838 nonterm.setFeatureMap(fm); 3839 l.add(nonterm); 3840 nonterm = new Nonterminal("//"); 3841 fm = new FeatureMap(); 3842 nonterm.setFeatureMap(fm); 3843 l.add(nonterm); 3844 term = new Terminal("no"); 3845 l.add(term); 3846 addGrammarRule(new GrammarRule(ann, l, false)); 3847 3848 /* The category 'num_quant' stands for numerical quantifiers: */ 3849 3850 // num_quant=>['at least'] 3851 l.clear(); 3852 featureHash.clear(); 3853 ann = new Annotation(); 3854 nonterm = new Nonterminal("num_quant"); 3855 fm = new FeatureMap(); 3856 nonterm.setFeatureMap(fm); 3857 l.add(nonterm); 3858 term = new Terminal("at least"); 3859 l.add(term); 3860 addGrammarRule(new GrammarRule(ann, l, false)); 3861 3862 // num_quant=>['at most'] 3863 l.clear(); 3864 featureHash.clear(); 3865 ann = new Annotation(); 3866 nonterm = new Nonterminal("num_quant"); 3867 fm = new FeatureMap(); 3868 nonterm.setFeatureMap(fm); 3869 l.add(nonterm); 3870 term = new Terminal("at most"); 3871 l.add(term); 3872 addGrammarRule(new GrammarRule(ann, l, false)); 3873 3874 // num_quant=>['less than'] 3875 l.clear(); 3876 featureHash.clear(); 3877 ann = new Annotation(); 3878 nonterm = new Nonterminal("num_quant"); 3879 fm = new FeatureMap(); 3880 nonterm.setFeatureMap(fm); 3881 l.add(nonterm); 3882 term = new Terminal("less than"); 3883 l.add(term); 3884 addGrammarRule(new GrammarRule(ann, l, false)); 3885 3886 // num_quant=>['more than'] 3887 l.clear(); 3888 featureHash.clear(); 3889 ann = new Annotation(); 3890 nonterm = new Nonterminal("num_quant"); 3891 fm = new FeatureMap(); 3892 nonterm.setFeatureMap(fm); 3893 l.add(nonterm); 3894 term = new Terminal("more than"); 3895 l.add(term); 3896 addGrammarRule(new GrammarRule(ann, l, false)); 3897 3898 // num_quant=>[exactly] 3899 l.clear(); 3900 featureHash.clear(); 3901 ann = new Annotation(); 3902 nonterm = new Nonterminal("num_quant"); 3903 fm = new FeatureMap(); 3904 nonterm.setFeatureMap(fm); 3905 l.add(nonterm); 3906 term = new Terminal("exactly"); 3907 l.add(term); 3908 addGrammarRule(new GrammarRule(ann, l, false)); 3909 3910 3911 /* --- Indefinite Pronouns --- */ 3912 3913 /* Indefinite pronouns are represented by 'ipron': */ 3914 3915 // ipron(exist:plus, human:minus)=>[something] 3916 l.clear(); 3917 featureHash.clear(); 3918 ann = new Annotation(); 3919 nonterm = new Nonterminal("ipron"); 3920 fm = new FeatureMap(); 3921 fm.setFeature("exist", new StringRef("plus")); 3922 fm.setFeature("human", new StringRef("minus")); 3923 nonterm.setFeatureMap(fm); 3924 l.add(nonterm); 3925 term = new Terminal("something"); 3926 l.add(term); 3927 addGrammarRule(new GrammarRule(ann, l, false)); 3928 3929 // ipron(exist:plus, human:plus)=>[somebody] 3930 l.clear(); 3931 featureHash.clear(); 3932 ann = new Annotation(); 3933 nonterm = new Nonterminal("ipron"); 3934 fm = new FeatureMap(); 3935 fm.setFeature("exist", new StringRef("plus")); 3936 fm.setFeature("human", new StringRef("plus")); 3937 nonterm.setFeatureMap(fm); 3938 l.add(nonterm); 3939 term = new Terminal("somebody"); 3940 l.add(term); 3941 addGrammarRule(new GrammarRule(ann, l, false)); 3942 3943 // ipron(exist:minus, human:minus)=> //, [everything] 3944 l.clear(); 3945 featureHash.clear(); 3946 ann = new Annotation(); 3947 nonterm = new Nonterminal("ipron"); 3948 fm = new FeatureMap(); 3949 fm.setFeature("exist", new StringRef("minus")); 3950 fm.setFeature("human", new StringRef("minus")); 3951 nonterm.setFeatureMap(fm); 3952 l.add(nonterm); 3953 nonterm = new Nonterminal("//"); 3954 fm = new FeatureMap(); 3955 nonterm.setFeatureMap(fm); 3956 l.add(nonterm); 3957 term = new Terminal("everything"); 3958 l.add(term); 3959 addGrammarRule(new GrammarRule(ann, l, false)); 3960 3961 // ipron(exist:minus, human:plus)=> //, [everybody] 3962 l.clear(); 3963 featureHash.clear(); 3964 ann = new Annotation(); 3965 nonterm = new Nonterminal("ipron"); 3966 fm = new FeatureMap(); 3967 fm.setFeature("exist", new StringRef("minus")); 3968 fm.setFeature("human", new StringRef("plus")); 3969 nonterm.setFeatureMap(fm); 3970 l.add(nonterm); 3971 nonterm = new Nonterminal("//"); 3972 fm = new FeatureMap(); 3973 nonterm.setFeatureMap(fm); 3974 l.add(nonterm); 3975 term = new Terminal("everybody"); 3976 l.add(term); 3977 addGrammarRule(new GrammarRule(ann, l, false)); 3978 3979 // ipron(exist:minus, human:minus)=> //, [nothing] 3980 l.clear(); 3981 featureHash.clear(); 3982 ann = new Annotation(); 3983 nonterm = new Nonterminal("ipron"); 3984 fm = new FeatureMap(); 3985 fm.setFeature("exist", new StringRef("minus")); 3986 fm.setFeature("human", new StringRef("minus")); 3987 nonterm.setFeatureMap(fm); 3988 l.add(nonterm); 3989 nonterm = new Nonterminal("//"); 3990 fm = new FeatureMap(); 3991 nonterm.setFeatureMap(fm); 3992 l.add(nonterm); 3993 term = new Terminal("nothing"); 3994 l.add(term); 3995 addGrammarRule(new GrammarRule(ann, l, false)); 3996 3997 // ipron(exist:minus, human:plus)=> //, [nobody] 3998 l.clear(); 3999 featureHash.clear(); 4000 ann = new Annotation(); 4001 nonterm = new Nonterminal("ipron"); 4002 fm = new FeatureMap(); 4003 fm.setFeature("exist", new StringRef("minus")); 4004 fm.setFeature("human", new StringRef("plus")); 4005 nonterm.setFeatureMap(fm); 4006 l.add(nonterm); 4007 nonterm = new Nonterminal("//"); 4008 fm = new FeatureMap(); 4009 nonterm.setFeatureMap(fm); 4010 l.add(nonterm); 4011 term = new Terminal("nobody"); 4012 l.add(term); 4013 addGrammarRule(new GrammarRule(ann, l, false)); 4014 4015 4016 /* --- Anaphoric Pronouns --- */ 4017 4018 /* The category 'pron' represents reflexive and irreflexive anaphoric pronouns: */ 4019 4020 // $pron(refl:plus, human:minus)=>[itself] 4021 l.clear(); 4022 featureHash.clear(); 4023 ann = new Annotation(); 4024 preterm = new Preterminal("pron"); 4025 fm = new FeatureMap(); 4026 fm.setFeature("refl", new StringRef("plus")); 4027 fm.setFeature("human", new StringRef("minus")); 4028 preterm.setFeatureMap(fm); 4029 l.add(preterm); 4030 term = new Terminal("itself"); 4031 l.add(term); 4032 addLexicalRule(new LexicalRule(ann, l)); 4033 4034 // $pron(refl:plus, human:plus, gender:masc)=>[himself] 4035 l.clear(); 4036 featureHash.clear(); 4037 ann = new Annotation(); 4038 preterm = new Preterminal("pron"); 4039 fm = new FeatureMap(); 4040 fm.setFeature("refl", new StringRef("plus")); 4041 fm.setFeature("human", new StringRef("plus")); 4042 fm.setFeature("gender", new StringRef("masc")); 4043 preterm.setFeatureMap(fm); 4044 l.add(preterm); 4045 term = new Terminal("himself"); 4046 l.add(term); 4047 addLexicalRule(new LexicalRule(ann, l)); 4048 4049 // $pron(refl:plus, human:plus, gender:fem)=>[herself] 4050 l.clear(); 4051 featureHash.clear(); 4052 ann = new Annotation(); 4053 preterm = new Preterminal("pron"); 4054 fm = new FeatureMap(); 4055 fm.setFeature("refl", new StringRef("plus")); 4056 fm.setFeature("human", new StringRef("plus")); 4057 fm.setFeature("gender", new StringRef("fem")); 4058 preterm.setFeatureMap(fm); 4059 l.add(preterm); 4060 term = new Terminal("herself"); 4061 l.add(term); 4062 addLexicalRule(new LexicalRule(ann, l)); 4063 4064 // $pron(refl:minus, human:minus)=>[it] 4065 l.clear(); 4066 featureHash.clear(); 4067 ann = new Annotation(); 4068 preterm = new Preterminal("pron"); 4069 fm = new FeatureMap(); 4070 fm.setFeature("refl", new StringRef("minus")); 4071 fm.setFeature("human", new StringRef("minus")); 4072 preterm.setFeatureMap(fm); 4073 l.add(preterm); 4074 term = new Terminal("it"); 4075 l.add(term); 4076 addLexicalRule(new LexicalRule(ann, l)); 4077 4078 // $pron(refl:minus, case:nom, human:plus, gender:masc)=>[he] 4079 l.clear(); 4080 featureHash.clear(); 4081 ann = new Annotation(); 4082 preterm = new Preterminal("pron"); 4083 fm = new FeatureMap(); 4084 fm.setFeature("refl", new StringRef("minus")); 4085 fm.setFeature("case", new StringRef("nom")); 4086 fm.setFeature("human", new StringRef("plus")); 4087 fm.setFeature("gender", new StringRef("masc")); 4088 preterm.setFeatureMap(fm); 4089 l.add(preterm); 4090 term = new Terminal("he"); 4091 l.add(term); 4092 addLexicalRule(new LexicalRule(ann, l)); 4093 4094 // $pron(refl:minus, case:acc, human:plus, gender:masc)=>[him] 4095 l.clear(); 4096 featureHash.clear(); 4097 ann = new Annotation(); 4098 preterm = new Preterminal("pron"); 4099 fm = new FeatureMap(); 4100 fm.setFeature("refl", new StringRef("minus")); 4101 fm.setFeature("case", new StringRef("acc")); 4102 fm.setFeature("human", new StringRef("plus")); 4103 fm.setFeature("gender", new StringRef("masc")); 4104 preterm.setFeatureMap(fm); 4105 l.add(preterm); 4106 term = new Terminal("him"); 4107 l.add(term); 4108 addLexicalRule(new LexicalRule(ann, l)); 4109 4110 // $pron(refl:minus, case:nom, human:plus, gender:fem)=>[she] 4111 l.clear(); 4112 featureHash.clear(); 4113 ann = new Annotation(); 4114 preterm = new Preterminal("pron"); 4115 fm = new FeatureMap(); 4116 fm.setFeature("refl", new StringRef("minus")); 4117 fm.setFeature("case", new StringRef("nom")); 4118 fm.setFeature("human", new StringRef("plus")); 4119 fm.setFeature("gender", new StringRef("fem")); 4120 preterm.setFeatureMap(fm); 4121 l.add(preterm); 4122 term = new Terminal("she"); 4123 l.add(term); 4124 addLexicalRule(new LexicalRule(ann, l)); 4125 4126 // $pron(refl:minus, case:acc, human:plus, gender:fem)=>[her] 4127 l.clear(); 4128 featureHash.clear(); 4129 ann = new Annotation(); 4130 preterm = new Preterminal("pron"); 4131 fm = new FeatureMap(); 4132 fm.setFeature("refl", new StringRef("minus")); 4133 fm.setFeature("case", new StringRef("acc")); 4134 fm.setFeature("human", new StringRef("plus")); 4135 fm.setFeature("gender", new StringRef("fem")); 4136 preterm.setFeatureMap(fm); 4137 l.add(preterm); 4138 term = new Terminal("her"); 4139 l.add(term); 4140 addLexicalRule(new LexicalRule(ann, l)); 4141 4142 } 4143 }