001 package ch.uzh.ifi.attempto.acewiki.core.grammar; 002 003 import java.util.ArrayList; 004 import java.util.HashMap; 005 006 import ch.uzh.ifi.attempto.chartparser.Nonterminal; 007 import ch.uzh.ifi.attempto.chartparser.Rule; 008 import ch.uzh.ifi.attempto.chartparser.StringRef; 009 import ch.uzh.ifi.attempto.chartparser.Terminal; 010 import ch.uzh.ifi.attempto.chartparser.Category; 011 import ch.uzh.ifi.attempto.chartparser.FeatureMap; 012 013 /** 014 * This grammar class is automatically generated by the SWI Prolog program "generate_java.pl". 015 */ 016 @SuppressWarnings("all") 017 public class StandardGrammar extends ch.uzh.ifi.attempto.chartparser.Grammar { 018 019 /** 020 * Creates a new grammar object. 021 */ 022 public StandardGrammar() { 023 super("text"); 024 ArrayList<Category> l = new ArrayList<Category>(); 025 Category c; 026 HashMap<Integer, StringRef> featureHash = new HashMap<Integer, StringRef>(); 027 028 // test=>textelement, fill 029 l.clear(); 030 featureHash.clear(); 031 c = new Nonterminal("test"); 032 l.add(c); 033 c = new Nonterminal("textelement"); 034 l.add(c); 035 c = new Nonterminal("fill"); 036 l.add(c); 037 addRule(new Rule(l, true)); 038 039 // fill=>[] 040 l.clear(); 041 featureHash.clear(); 042 c = new Nonterminal("fill"); 043 l.add(c); 044 addRule(new Rule(l, true)); 045 046 // fill=>[-], fill 047 l.clear(); 048 featureHash.clear(); 049 c = new Nonterminal("fill"); 050 l.add(c); 051 c = new Terminal("-"); 052 l.add(c); 053 c = new Nonterminal("fill"); 054 l.add(c); 055 addRule(new Rule(l, true)); 056 057 // text~>[] 058 l.clear(); 059 featureHash.clear(); 060 c = new Nonterminal("text"); 061 l.add(c); 062 addRule(new Rule(l, false)); 063 064 // text~>textelement, text 065 l.clear(); 066 featureHash.clear(); 067 c = new Nonterminal("text"); 068 l.add(c); 069 c = new Nonterminal("textelement"); 070 l.add(c); 071 c = new Nonterminal("text"); 072 l.add(c); 073 addRule(new Rule(l, false)); 074 075 // textelement~>declaration 076 l.clear(); 077 featureHash.clear(); 078 c = new Nonterminal("textelement"); 079 l.add(c); 080 c = new Nonterminal("declaration"); 081 l.add(c); 082 addRule(new Rule(l, false)); 083 084 // textelement~>question 085 l.clear(); 086 featureHash.clear(); 087 c = new Nonterminal("textelement"); 088 l.add(c); 089 c = new Nonterminal("question"); 090 l.add(c); 091 addRule(new Rule(l, false)); 092 093 // declaration~>sentence, ['.'] 094 l.clear(); 095 featureHash.clear(); 096 c = new Nonterminal("declaration"); 097 l.add(c); 098 c = new Nonterminal("sentence"); 099 l.add(c); 100 c = new Terminal("."); 101 l.add(c); 102 addRule(new Rule(l, false)); 103 104 // question~>simple_sentence_2(whin:right, whout:left), [?] 105 l.clear(); 106 featureHash.clear(); 107 c = new Nonterminal("question"); 108 l.add(c); 109 c = new Nonterminal("simple_sentence_2"); 110 c.setFeature("whin", new StringRef("right")); 111 c.setFeature("whout", new StringRef("left")); 112 l.add(c); 113 c = new Terminal("?"); 114 l.add(c); 115 addRule(new Rule(l, false)); 116 117 // sentence=>sentence_coord_1 118 l.clear(); 119 featureHash.clear(); 120 c = new Nonterminal("sentence"); 121 l.add(c); 122 c = new Nonterminal("sentence_coord_1"); 123 l.add(c); 124 addRule(new Rule(l, true)); 125 126 // sentence~>['for every'], noun_constr, sentence_coord_1 127 l.clear(); 128 featureHash.clear(); 129 c = new Nonterminal("sentence"); 130 l.add(c); 131 c = new Terminal("for every"); 132 l.add(c); 133 c = new Nonterminal("noun_constr"); 134 l.add(c); 135 c = new Nonterminal("sentence_coord_1"); 136 l.add(c); 137 addRule(new Rule(l, false)); 138 139 // sentence~>[if], sentence_coord_1, [then], sentence_coord_1 140 l.clear(); 141 featureHash.clear(); 142 c = new Nonterminal("sentence"); 143 l.add(c); 144 c = new Terminal("if"); 145 l.add(c); 146 c = new Nonterminal("sentence_coord_1"); 147 l.add(c); 148 c = new Terminal("then"); 149 l.add(c); 150 c = new Nonterminal("sentence_coord_1"); 151 l.add(c); 152 addRule(new Rule(l, false)); 153 154 // sentence_coord_1=>sentence_coord_2 155 l.clear(); 156 featureHash.clear(); 157 c = new Nonterminal("sentence_coord_1"); 158 l.add(c); 159 c = new Nonterminal("sentence_coord_2"); 160 l.add(c); 161 addRule(new Rule(l, true)); 162 163 // sentence_coord_1~>sentence_coord_2, [or], sentence_coord_1 164 l.clear(); 165 featureHash.clear(); 166 c = new Nonterminal("sentence_coord_1"); 167 l.add(c); 168 c = new Nonterminal("sentence_coord_2"); 169 l.add(c); 170 c = new Terminal("or"); 171 l.add(c); 172 c = new Nonterminal("sentence_coord_1"); 173 l.add(c); 174 addRule(new Rule(l, false)); 175 176 // sentence_coord_2=>simple_sentence 177 l.clear(); 178 featureHash.clear(); 179 c = new Nonterminal("sentence_coord_2"); 180 l.add(c); 181 c = new Nonterminal("simple_sentence"); 182 l.add(c); 183 addRule(new Rule(l, true)); 184 185 // sentence_coord_2=>simple_sentence, [and], sentence_coord_2 186 l.clear(); 187 featureHash.clear(); 188 c = new Nonterminal("sentence_coord_2"); 189 l.add(c); 190 c = new Nonterminal("simple_sentence"); 191 l.add(c); 192 c = new Terminal("and"); 193 l.add(c); 194 c = new Nonterminal("sentence_coord_2"); 195 l.add(c); 196 addRule(new Rule(l, true)); 197 198 // simple_sentence~>['it is false that'], simple_sentence_2(whin:minus, whout:minus) 199 l.clear(); 200 featureHash.clear(); 201 c = new Nonterminal("simple_sentence"); 202 l.add(c); 203 c = new Terminal("it is false that"); 204 l.add(c); 205 c = new Nonterminal("simple_sentence_2"); 206 c.setFeature("whin", new StringRef("minus")); 207 c.setFeature("whout", new StringRef("minus")); 208 l.add(c); 209 addRule(new Rule(l, false)); 210 211 // simple_sentence=>['there is'], nounphrase(exist:plus, def:minus, pl:minus, verb:be, whin:minus, whout:minus) 212 l.clear(); 213 featureHash.clear(); 214 c = new Nonterminal("simple_sentence"); 215 l.add(c); 216 c = new Terminal("there is"); 217 l.add(c); 218 c = new Nonterminal("nounphrase"); 219 c.setFeature("exist", new StringRef("plus")); 220 c.setFeature("def", new StringRef("minus")); 221 c.setFeature("pl", new StringRef("minus")); 222 c.setFeature("verb", new StringRef("be")); 223 c.setFeature("whin", new StringRef("minus")); 224 c.setFeature("whout", new StringRef("minus")); 225 l.add(c); 226 addRule(new Rule(l, true)); 227 228 // simple_sentence=>['there is'], nounphrase(exist:plus, def:minus, pl:minus, verb:be, whin:minus, whout:minus), ['such that'], simple_sentence 229 l.clear(); 230 featureHash.clear(); 231 c = new Nonterminal("simple_sentence"); 232 l.add(c); 233 c = new Terminal("there is"); 234 l.add(c); 235 c = new Nonterminal("nounphrase"); 236 c.setFeature("exist", new StringRef("plus")); 237 c.setFeature("def", new StringRef("minus")); 238 c.setFeature("pl", new StringRef("minus")); 239 c.setFeature("verb", new StringRef("be")); 240 c.setFeature("whin", new StringRef("minus")); 241 c.setFeature("whout", new StringRef("minus")); 242 l.add(c); 243 c = new Terminal("such that"); 244 l.add(c); 245 c = new Nonterminal("simple_sentence"); 246 l.add(c); 247 addRule(new Rule(l, true)); 248 249 // simple_sentence=>['there are'], nounphrase(exist:plus, def:minus, pl:plus, whin:minus, whout:minus) 250 l.clear(); 251 featureHash.clear(); 252 c = new Nonterminal("simple_sentence"); 253 l.add(c); 254 c = new Terminal("there are"); 255 l.add(c); 256 c = new Nonterminal("nounphrase"); 257 c.setFeature("exist", new StringRef("plus")); 258 c.setFeature("def", new StringRef("minus")); 259 c.setFeature("pl", new StringRef("plus")); 260 c.setFeature("whin", new StringRef("minus")); 261 c.setFeature("whout", new StringRef("minus")); 262 l.add(c); 263 addRule(new Rule(l, true)); 264 265 // simple_sentence=>simple_sentence_2(whin:minus, whout:minus) 266 l.clear(); 267 featureHash.clear(); 268 c = new Nonterminal("simple_sentence"); 269 l.add(c); 270 c = new Nonterminal("simple_sentence_2"); 271 c.setFeature("whin", new StringRef("minus")); 272 c.setFeature("whout", new StringRef("minus")); 273 l.add(c); 274 addRule(new Rule(l, true)); 275 276 // simple_sentence_2(whin:A, whout:B)=>nounphrase(exist:plus, pl:C, whin:A, whout:D), verbphrase_coord_1(pl:C, whin:D, whout:B) 277 l.clear(); 278 featureHash.clear(); 279 c = new Nonterminal("simple_sentence_2"); 280 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 281 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 282 l.add(c); 283 c = new Nonterminal("nounphrase"); 284 c.setFeature("exist", new StringRef("plus")); 285 setFeature(c.getFeatureMap(), "pl", 2, featureHash); 286 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 287 setFeature(c.getFeatureMap(), "whout", 3, featureHash); 288 l.add(c); 289 c = new Nonterminal("verbphrase_coord_1"); 290 setFeature(c.getFeatureMap(), "pl", 2, featureHash); 291 setFeature(c.getFeatureMap(), "whin", 3, featureHash); 292 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 293 l.add(c); 294 addRule(new Rule(l, true)); 295 296 // simple_sentence_2(whin:minus, whout:minus)~>nounphrase(exist:minus), verbphrase_coord_1(pl:minus, whin:minus, whout:minus) 297 l.clear(); 298 featureHash.clear(); 299 c = new Nonterminal("simple_sentence_2"); 300 c.setFeature("whin", new StringRef("minus")); 301 c.setFeature("whout", new StringRef("minus")); 302 l.add(c); 303 c = new Nonterminal("nounphrase"); 304 c.setFeature("exist", new StringRef("minus")); 305 l.add(c); 306 c = new Nonterminal("verbphrase_coord_1"); 307 c.setFeature("pl", new StringRef("minus")); 308 c.setFeature("whin", new StringRef("minus")); 309 c.setFeature("whout", new StringRef("minus")); 310 l.add(c); 311 addRule(new Rule(l, false)); 312 313 // verbphrase_coord_1(pl:A, whin:B, whout:C)=>verbphrase_coord_2(pl:A, whin:B, whout:C) 314 l.clear(); 315 featureHash.clear(); 316 c = new Nonterminal("verbphrase_coord_1"); 317 setFeature(c.getFeatureMap(), "pl", 0, featureHash); 318 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 319 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 320 l.add(c); 321 c = new Nonterminal("verbphrase_coord_2"); 322 setFeature(c.getFeatureMap(), "pl", 0, featureHash); 323 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 324 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 325 l.add(c); 326 addRule(new Rule(l, true)); 327 328 // verbphrase_coord_1(pl:A, whin:B, whout:B)~>verbphrase_coord_2(pl:A, whin:B, whout:B), [or], verbphrase_coord_1(pl:A, whin:B, whout:B) 329 l.clear(); 330 featureHash.clear(); 331 c = new Nonterminal("verbphrase_coord_1"); 332 setFeature(c.getFeatureMap(), "pl", 0, featureHash); 333 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 334 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 335 l.add(c); 336 c = new Nonterminal("verbphrase_coord_2"); 337 setFeature(c.getFeatureMap(), "pl", 0, featureHash); 338 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 339 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 340 l.add(c); 341 c = new Terminal("or"); 342 l.add(c); 343 c = new Nonterminal("verbphrase_coord_1"); 344 setFeature(c.getFeatureMap(), "pl", 0, featureHash); 345 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 346 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 347 l.add(c); 348 addRule(new Rule(l, false)); 349 350 // verbphrase_coord_2(pl:A, whin:B, whout:C)=>verbphrase_cut(pl:A, whin:B, whout:C) 351 l.clear(); 352 featureHash.clear(); 353 c = new Nonterminal("verbphrase_coord_2"); 354 setFeature(c.getFeatureMap(), "pl", 0, featureHash); 355 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 356 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 357 l.add(c); 358 c = new Nonterminal("verbphrase_cut"); 359 setFeature(c.getFeatureMap(), "pl", 0, featureHash); 360 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 361 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 362 l.add(c); 363 addRule(new Rule(l, true)); 364 365 // verbphrase_coord_2(pl:A, whin:B, whout:B)=>verbphrase_cut(pl:A, whin:B, whout:B), [and], verbphrase_coord_2(pl:A, whin:B, whout:B) 366 l.clear(); 367 featureHash.clear(); 368 c = new Nonterminal("verbphrase_coord_2"); 369 setFeature(c.getFeatureMap(), "pl", 0, featureHash); 370 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 371 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 372 l.add(c); 373 c = new Nonterminal("verbphrase_cut"); 374 setFeature(c.getFeatureMap(), "pl", 0, featureHash); 375 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 376 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 377 l.add(c); 378 c = new Terminal("and"); 379 l.add(c); 380 c = new Nonterminal("verbphrase_coord_2"); 381 setFeature(c.getFeatureMap(), "pl", 0, featureHash); 382 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 383 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 384 l.add(c); 385 addRule(new Rule(l, true)); 386 387 // verbphrase_cut(that:A, pl:B, whin:C, whout:D)=>verbphrase(neg:minus, that:A, pl:B, whin:C, whout:D) 388 l.clear(); 389 featureHash.clear(); 390 c = new Nonterminal("verbphrase_cut"); 391 setFeature(c.getFeatureMap(), "that", 0, featureHash); 392 setFeature(c.getFeatureMap(), "pl", 1, featureHash); 393 setFeature(c.getFeatureMap(), "whin", 2, featureHash); 394 setFeature(c.getFeatureMap(), "whout", 3, featureHash); 395 l.add(c); 396 c = new Nonterminal("verbphrase"); 397 c.setFeature("neg", new StringRef("minus")); 398 setFeature(c.getFeatureMap(), "that", 0, featureHash); 399 setFeature(c.getFeatureMap(), "pl", 1, featureHash); 400 setFeature(c.getFeatureMap(), "whin", 2, featureHash); 401 setFeature(c.getFeatureMap(), "whout", 3, featureHash); 402 l.add(c); 403 addRule(new Rule(l, true)); 404 405 // verbphrase_cut(that:A, pl:B, whin:C, whout:D)~>verbphrase(neg:plus, that:A, pl:B, whin:C, whout:D) 406 l.clear(); 407 featureHash.clear(); 408 c = new Nonterminal("verbphrase_cut"); 409 setFeature(c.getFeatureMap(), "that", 0, featureHash); 410 setFeature(c.getFeatureMap(), "pl", 1, featureHash); 411 setFeature(c.getFeatureMap(), "whin", 2, featureHash); 412 setFeature(c.getFeatureMap(), "whout", 3, featureHash); 413 l.add(c); 414 c = new Nonterminal("verbphrase"); 415 c.setFeature("neg", new StringRef("plus")); 416 setFeature(c.getFeatureMap(), "that", 0, featureHash); 417 setFeature(c.getFeatureMap(), "pl", 1, featureHash); 418 setFeature(c.getFeatureMap(), "whin", 2, featureHash); 419 setFeature(c.getFeatureMap(), "whout", 3, featureHash); 420 l.add(c); 421 addRule(new Rule(l, false)); 422 423 // verbphrase(neg:A, that:B, pl:C, whin:D, whout:E)=>verb(verb:full, pl:C, neg:A), nounphrase_cut(that:B, verb:full, whin:D, whout:E) 424 l.clear(); 425 featureHash.clear(); 426 c = new Nonterminal("verbphrase"); 427 setFeature(c.getFeatureMap(), "neg", 0, featureHash); 428 setFeature(c.getFeatureMap(), "that", 1, featureHash); 429 setFeature(c.getFeatureMap(), "pl", 2, featureHash); 430 setFeature(c.getFeatureMap(), "whin", 3, featureHash); 431 setFeature(c.getFeatureMap(), "whout", 4, featureHash); 432 l.add(c); 433 c = new Nonterminal("verb"); 434 c.setFeature("verb", new StringRef("full")); 435 setFeature(c.getFeatureMap(), "pl", 2, featureHash); 436 setFeature(c.getFeatureMap(), "neg", 0, featureHash); 437 l.add(c); 438 c = new Nonterminal("nounphrase_cut"); 439 setFeature(c.getFeatureMap(), "that", 1, featureHash); 440 c.setFeature("verb", new StringRef("full")); 441 setFeature(c.getFeatureMap(), "whin", 3, featureHash); 442 setFeature(c.getFeatureMap(), "whout", 4, featureHash); 443 l.add(c); 444 addRule(new Rule(l, true)); 445 446 // verbphrase(neg:A, that:B, pl:C, whin:D, whout:E)=>verb(verb:be, pl:C, neg:A), nounphrase_cut(of:plus, that:B, pl:minus, verb:be, whin:D, whout:E) 447 l.clear(); 448 featureHash.clear(); 449 c = new Nonterminal("verbphrase"); 450 setFeature(c.getFeatureMap(), "neg", 0, featureHash); 451 setFeature(c.getFeatureMap(), "that", 1, featureHash); 452 setFeature(c.getFeatureMap(), "pl", 2, featureHash); 453 setFeature(c.getFeatureMap(), "whin", 3, featureHash); 454 setFeature(c.getFeatureMap(), "whout", 4, featureHash); 455 l.add(c); 456 c = new Nonterminal("verb"); 457 c.setFeature("verb", new StringRef("be")); 458 setFeature(c.getFeatureMap(), "pl", 2, featureHash); 459 setFeature(c.getFeatureMap(), "neg", 0, featureHash); 460 l.add(c); 461 c = new Nonterminal("nounphrase_cut"); 462 c.setFeature("of", new StringRef("plus")); 463 setFeature(c.getFeatureMap(), "that", 1, featureHash); 464 c.setFeature("pl", new StringRef("minus")); 465 c.setFeature("verb", new StringRef("be")); 466 setFeature(c.getFeatureMap(), "whin", 3, featureHash); 467 setFeature(c.getFeatureMap(), "whout", 4, featureHash); 468 l.add(c); 469 addRule(new Rule(l, true)); 470 471 // verbphrase(neg:A, that:B, pl:minus, whin:C, whout:D)=>verb(verb:be, pl:minus, neg:A), nounphrase_cut(of:minus, that:B, pl:minus, verb:be, whin:C, whout:D) 472 l.clear(); 473 featureHash.clear(); 474 c = new Nonterminal("verbphrase"); 475 setFeature(c.getFeatureMap(), "neg", 0, featureHash); 476 setFeature(c.getFeatureMap(), "that", 1, featureHash); 477 c.setFeature("pl", new StringRef("minus")); 478 setFeature(c.getFeatureMap(), "whin", 2, featureHash); 479 setFeature(c.getFeatureMap(), "whout", 3, featureHash); 480 l.add(c); 481 c = new Nonterminal("verb"); 482 c.setFeature("verb", new StringRef("be")); 483 c.setFeature("pl", new StringRef("minus")); 484 setFeature(c.getFeatureMap(), "neg", 0, featureHash); 485 l.add(c); 486 c = new Nonterminal("nounphrase_cut"); 487 c.setFeature("of", new StringRef("minus")); 488 setFeature(c.getFeatureMap(), "that", 1, featureHash); 489 c.setFeature("pl", new StringRef("minus")); 490 c.setFeature("verb", new StringRef("be")); 491 setFeature(c.getFeatureMap(), "whin", 2, featureHash); 492 setFeature(c.getFeatureMap(), "whout", 3, featureHash); 493 l.add(c); 494 addRule(new Rule(l, true)); 495 496 // verbphrase(neg:A, that:B, pl:C, whin:D, whout:E)=>verb(verb:be, pl:C, neg:A), ['TRADJ'], nounphrase_cut(that:B, verb:full, whin:D, whout:E) 497 l.clear(); 498 featureHash.clear(); 499 c = new Nonterminal("verbphrase"); 500 setFeature(c.getFeatureMap(), "neg", 0, featureHash); 501 setFeature(c.getFeatureMap(), "that", 1, featureHash); 502 setFeature(c.getFeatureMap(), "pl", 2, featureHash); 503 setFeature(c.getFeatureMap(), "whin", 3, featureHash); 504 setFeature(c.getFeatureMap(), "whout", 4, featureHash); 505 l.add(c); 506 c = new Nonterminal("verb"); 507 c.setFeature("verb", new StringRef("be")); 508 setFeature(c.getFeatureMap(), "pl", 2, featureHash); 509 setFeature(c.getFeatureMap(), "neg", 0, featureHash); 510 l.add(c); 511 c = new Terminal("TRADJ"); 512 l.add(c); 513 c = new Nonterminal("nounphrase_cut"); 514 setFeature(c.getFeatureMap(), "that", 1, featureHash); 515 c.setFeature("verb", new StringRef("full")); 516 setFeature(c.getFeatureMap(), "whin", 3, featureHash); 517 setFeature(c.getFeatureMap(), "whout", 4, featureHash); 518 l.add(c); 519 addRule(new Rule(l, true)); 520 521 // verbphrase(neg:A, that:B, pl:C, whin:D, whout:E)=>verb(verb:be, pl:C, neg:A), ['PVERB'], nounphrase_cut(that:B, verb:full, whin:D, whout:E) 522 l.clear(); 523 featureHash.clear(); 524 c = new Nonterminal("verbphrase"); 525 setFeature(c.getFeatureMap(), "neg", 0, featureHash); 526 setFeature(c.getFeatureMap(), "that", 1, featureHash); 527 setFeature(c.getFeatureMap(), "pl", 2, featureHash); 528 setFeature(c.getFeatureMap(), "whin", 3, featureHash); 529 setFeature(c.getFeatureMap(), "whout", 4, featureHash); 530 l.add(c); 531 c = new Nonterminal("verb"); 532 c.setFeature("verb", new StringRef("be")); 533 setFeature(c.getFeatureMap(), "pl", 2, featureHash); 534 setFeature(c.getFeatureMap(), "neg", 0, featureHash); 535 l.add(c); 536 c = new Terminal("PVERB"); 537 l.add(c); 538 c = new Nonterminal("nounphrase_cut"); 539 setFeature(c.getFeatureMap(), "that", 1, featureHash); 540 c.setFeature("verb", new StringRef("full")); 541 setFeature(c.getFeatureMap(), "whin", 3, featureHash); 542 setFeature(c.getFeatureMap(), "whout", 4, featureHash); 543 l.add(c); 544 addRule(new Rule(l, true)); 545 546 // nounphrase_cut(exist:plus, that:A, of:B, def:C, pl:D, verb:E, whin:F, whout:G)=>nounphrase(exist:plus, that:A, of:B, def:C, pl:D, verb:E, whin:F, whout:G) 547 l.clear(); 548 featureHash.clear(); 549 c = new Nonterminal("nounphrase_cut"); 550 c.setFeature("exist", new StringRef("plus")); 551 setFeature(c.getFeatureMap(), "that", 0, featureHash); 552 setFeature(c.getFeatureMap(), "of", 1, featureHash); 553 setFeature(c.getFeatureMap(), "def", 2, featureHash); 554 setFeature(c.getFeatureMap(), "pl", 3, featureHash); 555 setFeature(c.getFeatureMap(), "verb", 4, featureHash); 556 setFeature(c.getFeatureMap(), "whin", 5, featureHash); 557 setFeature(c.getFeatureMap(), "whout", 6, featureHash); 558 l.add(c); 559 c = new Nonterminal("nounphrase"); 560 c.setFeature("exist", new StringRef("plus")); 561 setFeature(c.getFeatureMap(), "that", 0, featureHash); 562 setFeature(c.getFeatureMap(), "of", 1, featureHash); 563 setFeature(c.getFeatureMap(), "def", 2, featureHash); 564 setFeature(c.getFeatureMap(), "pl", 3, featureHash); 565 setFeature(c.getFeatureMap(), "verb", 4, featureHash); 566 setFeature(c.getFeatureMap(), "whin", 5, featureHash); 567 setFeature(c.getFeatureMap(), "whout", 6, featureHash); 568 l.add(c); 569 addRule(new Rule(l, true)); 570 571 // nounphrase_cut(exist:minus, that:A, of:B, def:C, pl:D, verb:E, whin:F, whout:G)~>nounphrase(exist:minus, that:A, of:B, def:C, pl:D, verb:E, whin:F, whout:G) 572 l.clear(); 573 featureHash.clear(); 574 c = new Nonterminal("nounphrase_cut"); 575 c.setFeature("exist", new StringRef("minus")); 576 setFeature(c.getFeatureMap(), "that", 0, featureHash); 577 setFeature(c.getFeatureMap(), "of", 1, featureHash); 578 setFeature(c.getFeatureMap(), "def", 2, featureHash); 579 setFeature(c.getFeatureMap(), "pl", 3, featureHash); 580 setFeature(c.getFeatureMap(), "verb", 4, featureHash); 581 setFeature(c.getFeatureMap(), "whin", 5, featureHash); 582 setFeature(c.getFeatureMap(), "whout", 6, featureHash); 583 l.add(c); 584 c = new Nonterminal("nounphrase"); 585 c.setFeature("exist", new StringRef("minus")); 586 setFeature(c.getFeatureMap(), "that", 0, featureHash); 587 setFeature(c.getFeatureMap(), "of", 1, featureHash); 588 setFeature(c.getFeatureMap(), "def", 2, featureHash); 589 setFeature(c.getFeatureMap(), "pl", 3, featureHash); 590 setFeature(c.getFeatureMap(), "verb", 4, featureHash); 591 setFeature(c.getFeatureMap(), "whin", 5, featureHash); 592 setFeature(c.getFeatureMap(), "whout", 6, featureHash); 593 l.add(c); 594 addRule(new Rule(l, false)); 595 596 // nounphrase(exist:plus, that:A, of:minus, def:plus, pl:minus, whin:B, whout:C)=>['PROPERNAME'], that_phrase(that:A, whin:B, whout:C) 597 l.clear(); 598 featureHash.clear(); 599 c = new Nonterminal("nounphrase"); 600 c.setFeature("exist", new StringRef("plus")); 601 setFeature(c.getFeatureMap(), "that", 0, featureHash); 602 c.setFeature("of", new StringRef("minus")); 603 c.setFeature("def", new StringRef("plus")); 604 c.setFeature("pl", new StringRef("minus")); 605 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 606 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 607 l.add(c); 608 c = new Terminal("PROPERNAME"); 609 l.add(c); 610 c = new Nonterminal("that_phrase"); 611 setFeature(c.getFeatureMap(), "that", 0, featureHash); 612 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 613 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 614 l.add(c); 615 addRule(new Rule(l, true)); 616 617 // nounphrase(exist:plus, that:minus, of:minus, def:plus, pl:minus, whin:A, whout:A)=>var_ante 618 l.clear(); 619 featureHash.clear(); 620 c = new Nonterminal("nounphrase"); 621 c.setFeature("exist", new StringRef("plus")); 622 c.setFeature("that", new StringRef("minus")); 623 c.setFeature("of", new StringRef("minus")); 624 c.setFeature("def", new StringRef("plus")); 625 c.setFeature("pl", new StringRef("minus")); 626 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 627 setFeature(c.getFeatureMap(), "whout", 0, featureHash); 628 l.add(c); 629 c = new Nonterminal("var_ante"); 630 l.add(c); 631 addRule(new Rule(l, true)); 632 633 // nounphrase(exist:plus, that:minus, of:minus, def:plus, pl:minus, whin:A, whout:A)~>['DEF_NOUN'(noun:B), 'REFERENCE'(text:C)], <<<(type:noun, hasvar:plus, noun:B, var:C) 634 l.clear(); 635 featureHash.clear(); 636 c = new Nonterminal("nounphrase"); 637 c.setFeature("exist", new StringRef("plus")); 638 c.setFeature("that", new StringRef("minus")); 639 c.setFeature("of", new StringRef("minus")); 640 c.setFeature("def", new StringRef("plus")); 641 c.setFeature("pl", new StringRef("minus")); 642 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 643 setFeature(c.getFeatureMap(), "whout", 0, featureHash); 644 l.add(c); 645 c = new Terminal("DEF_NOUN"); 646 setFeature(c.getFeatureMap(), "noun", 1, featureHash); 647 l.add(c); 648 c = new Terminal("REFERENCE"); 649 setFeature(c.getFeatureMap(), "text", 2, featureHash); 650 l.add(c); 651 c = new Nonterminal("<<<"); 652 c.setFeature("type", new StringRef("noun")); 653 c.setFeature("hasvar", new StringRef("plus")); 654 setFeature(c.getFeatureMap(), "noun", 1, featureHash); 655 setFeature(c.getFeatureMap(), "var", 2, featureHash); 656 l.add(c); 657 addRule(new Rule(l, false)); 658 659 // nounphrase(exist:plus, that:minus, of:minus, def:plus, pl:minus, whin:A, whout:A)~>['DEF_NOUN'(noun:B)], <<<(type:noun, noun:B) 660 l.clear(); 661 featureHash.clear(); 662 c = new Nonterminal("nounphrase"); 663 c.setFeature("exist", new StringRef("plus")); 664 c.setFeature("that", new StringRef("minus")); 665 c.setFeature("of", new StringRef("minus")); 666 c.setFeature("def", new StringRef("plus")); 667 c.setFeature("pl", new StringRef("minus")); 668 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 669 setFeature(c.getFeatureMap(), "whout", 0, featureHash); 670 l.add(c); 671 c = new Terminal("DEF_NOUN"); 672 setFeature(c.getFeatureMap(), "noun", 1, featureHash); 673 l.add(c); 674 c = new Nonterminal("<<<"); 675 c.setFeature("type", new StringRef("noun")); 676 setFeature(c.getFeatureMap(), "noun", 1, featureHash); 677 l.add(c); 678 addRule(new Rule(l, false)); 679 680 // nounphrase(exist:plus, that:minus, of:minus, def:plus, pl:minus, whin:A, whout:A)~>['REFERENCE'(text:B)], <<<(hasvar:plus, var:B) 681 l.clear(); 682 featureHash.clear(); 683 c = new Nonterminal("nounphrase"); 684 c.setFeature("exist", new StringRef("plus")); 685 c.setFeature("that", new StringRef("minus")); 686 c.setFeature("of", new StringRef("minus")); 687 c.setFeature("def", new StringRef("plus")); 688 c.setFeature("pl", new StringRef("minus")); 689 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 690 setFeature(c.getFeatureMap(), "whout", 0, featureHash); 691 l.add(c); 692 c = new Terminal("REFERENCE"); 693 setFeature(c.getFeatureMap(), "text", 1, featureHash); 694 l.add(c); 695 c = new Nonterminal("<<<"); 696 c.setFeature("hasvar", new StringRef("plus")); 697 setFeature(c.getFeatureMap(), "var", 1, featureHash); 698 l.add(c); 699 addRule(new Rule(l, false)); 700 701 // nounphrase(exist:plus, that:A, of:B, pl:minus, whin:C, whout:D)=>[a], noun_constr(that:A, of:B, whin:C, whout:D) 702 l.clear(); 703 featureHash.clear(); 704 c = new Nonterminal("nounphrase"); 705 c.setFeature("exist", new StringRef("plus")); 706 setFeature(c.getFeatureMap(), "that", 0, featureHash); 707 setFeature(c.getFeatureMap(), "of", 1, featureHash); 708 c.setFeature("pl", new StringRef("minus")); 709 setFeature(c.getFeatureMap(), "whin", 2, featureHash); 710 setFeature(c.getFeatureMap(), "whout", 3, featureHash); 711 l.add(c); 712 c = new Terminal("a"); 713 l.add(c); 714 c = new Nonterminal("noun_constr"); 715 setFeature(c.getFeatureMap(), "that", 0, featureHash); 716 setFeature(c.getFeatureMap(), "of", 1, featureHash); 717 setFeature(c.getFeatureMap(), "whin", 2, featureHash); 718 setFeature(c.getFeatureMap(), "whout", 3, featureHash); 719 l.add(c); 720 addRule(new Rule(l, true)); 721 722 // nounphrase(exist:plus, that:A, of:B, pl:minus, whin:C, whout:D)=>[an], noun_constr(that:A, of:B, whin:C, whout:D) 723 l.clear(); 724 featureHash.clear(); 725 c = new Nonterminal("nounphrase"); 726 c.setFeature("exist", new StringRef("plus")); 727 setFeature(c.getFeatureMap(), "that", 0, featureHash); 728 setFeature(c.getFeatureMap(), "of", 1, featureHash); 729 c.setFeature("pl", new StringRef("minus")); 730 setFeature(c.getFeatureMap(), "whin", 2, featureHash); 731 setFeature(c.getFeatureMap(), "whout", 3, featureHash); 732 l.add(c); 733 c = new Terminal("an"); 734 l.add(c); 735 c = new Nonterminal("noun_constr"); 736 setFeature(c.getFeatureMap(), "that", 0, featureHash); 737 setFeature(c.getFeatureMap(), "of", 1, featureHash); 738 setFeature(c.getFeatureMap(), "whin", 2, featureHash); 739 setFeature(c.getFeatureMap(), "whout", 3, featureHash); 740 l.add(c); 741 addRule(new Rule(l, true)); 742 743 // nounphrase(exist:plus, that:A, of:minus, pl:minus, whin:B, whout:C)=>exist_anon, var_ante, that_phrase(that:A, whin:B, whout:C) 744 l.clear(); 745 featureHash.clear(); 746 c = new Nonterminal("nounphrase"); 747 c.setFeature("exist", new StringRef("plus")); 748 setFeature(c.getFeatureMap(), "that", 0, featureHash); 749 c.setFeature("of", new StringRef("minus")); 750 c.setFeature("pl", new StringRef("minus")); 751 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 752 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 753 l.add(c); 754 c = new Nonterminal("exist_anon"); 755 l.add(c); 756 c = new Nonterminal("var_ante"); 757 l.add(c); 758 c = new Nonterminal("that_phrase"); 759 setFeature(c.getFeatureMap(), "that", 0, featureHash); 760 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 761 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 762 l.add(c); 763 addRule(new Rule(l, true)); 764 765 // nounphrase(exist:plus, that:A, of:minus, pl:minus, whin:B, whout:C)=>exist_anon, that_phrase(that:A, whin:B, whout:C) 766 l.clear(); 767 featureHash.clear(); 768 c = new Nonterminal("nounphrase"); 769 c.setFeature("exist", new StringRef("plus")); 770 setFeature(c.getFeatureMap(), "that", 0, featureHash); 771 c.setFeature("of", new StringRef("minus")); 772 c.setFeature("pl", new StringRef("minus")); 773 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 774 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 775 l.add(c); 776 c = new Nonterminal("exist_anon"); 777 l.add(c); 778 c = new Nonterminal("that_phrase"); 779 setFeature(c.getFeatureMap(), "that", 0, featureHash); 780 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 781 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 782 l.add(c); 783 addRule(new Rule(l, true)); 784 785 // nounphrase(exist:plus, that:minus, of:minus, pl:plus, verb:full, whin:A, whout:A)=>num_quant, ['NUMBER', 'NOUNPL'] 786 l.clear(); 787 featureHash.clear(); 788 c = new Nonterminal("nounphrase"); 789 c.setFeature("exist", new StringRef("plus")); 790 c.setFeature("that", new StringRef("minus")); 791 c.setFeature("of", new StringRef("minus")); 792 c.setFeature("pl", new StringRef("plus")); 793 c.setFeature("verb", new StringRef("full")); 794 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 795 setFeature(c.getFeatureMap(), "whout", 0, featureHash); 796 l.add(c); 797 c = new Nonterminal("num_quant"); 798 l.add(c); 799 c = new Terminal("NUMBER"); 800 l.add(c); 801 c = new Terminal("NOUNPL"); 802 l.add(c); 803 addRule(new Rule(l, true)); 804 805 // nounphrase(exist:plus, that:minus, of:minus, pl:minus, verb:full, whin:A, whout:A)=>num_quant, [1, 'NOUN'] 806 l.clear(); 807 featureHash.clear(); 808 c = new Nonterminal("nounphrase"); 809 c.setFeature("exist", new StringRef("plus")); 810 c.setFeature("that", new StringRef("minus")); 811 c.setFeature("of", new StringRef("minus")); 812 c.setFeature("pl", new StringRef("minus")); 813 c.setFeature("verb", new StringRef("full")); 814 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 815 setFeature(c.getFeatureMap(), "whout", 0, featureHash); 816 l.add(c); 817 c = new Nonterminal("num_quant"); 818 l.add(c); 819 c = new Terminal("1"); 820 l.add(c); 821 c = new Terminal("NOUN"); 822 l.add(c); 823 addRule(new Rule(l, true)); 824 825 // nounphrase(exist:plus, that:minus, of:minus, pl:minus, whin:right, whout:left)=>[what] 826 l.clear(); 827 featureHash.clear(); 828 c = new Nonterminal("nounphrase"); 829 c.setFeature("exist", new StringRef("plus")); 830 c.setFeature("that", new StringRef("minus")); 831 c.setFeature("of", new StringRef("minus")); 832 c.setFeature("pl", new StringRef("minus")); 833 c.setFeature("whin", new StringRef("right")); 834 c.setFeature("whout", new StringRef("left")); 835 l.add(c); 836 c = new Terminal("what"); 837 l.add(c); 838 addRule(new Rule(l, true)); 839 840 // nounphrase(exist:plus, that:minus, of:minus, pl:minus, whin:right, whout:left)=>[who] 841 l.clear(); 842 featureHash.clear(); 843 c = new Nonterminal("nounphrase"); 844 c.setFeature("exist", new StringRef("plus")); 845 c.setFeature("that", new StringRef("minus")); 846 c.setFeature("of", new StringRef("minus")); 847 c.setFeature("pl", new StringRef("minus")); 848 c.setFeature("whin", new StringRef("right")); 849 c.setFeature("whout", new StringRef("left")); 850 l.add(c); 851 c = new Terminal("who"); 852 l.add(c); 853 addRule(new Rule(l, true)); 854 855 // nounphrase(exist:plus, that:A, of:B, pl:minus, whin:right, whout:left)=>[which], noun_constr(that:A, of:B, whin:left, whout:left) 856 l.clear(); 857 featureHash.clear(); 858 c = new Nonterminal("nounphrase"); 859 c.setFeature("exist", new StringRef("plus")); 860 setFeature(c.getFeatureMap(), "that", 0, featureHash); 861 setFeature(c.getFeatureMap(), "of", 1, featureHash); 862 c.setFeature("pl", new StringRef("minus")); 863 c.setFeature("whin", new StringRef("right")); 864 c.setFeature("whout", new StringRef("left")); 865 l.add(c); 866 c = new Terminal("which"); 867 l.add(c); 868 c = new Nonterminal("noun_constr"); 869 setFeature(c.getFeatureMap(), "that", 0, featureHash); 870 setFeature(c.getFeatureMap(), "of", 1, featureHash); 871 c.setFeature("whin", new StringRef("left")); 872 c.setFeature("whout", new StringRef("left")); 873 l.add(c); 874 addRule(new Rule(l, true)); 875 876 // nounphrase(exist:plus, that:minus, of:minus, pl:plus, whin:right, whout:left)=>[which, 'NOUNPL'] 877 l.clear(); 878 featureHash.clear(); 879 c = new Nonterminal("nounphrase"); 880 c.setFeature("exist", new StringRef("plus")); 881 c.setFeature("that", new StringRef("minus")); 882 c.setFeature("of", new StringRef("minus")); 883 c.setFeature("pl", new StringRef("plus")); 884 c.setFeature("whin", new StringRef("right")); 885 c.setFeature("whout", new StringRef("left")); 886 l.add(c); 887 c = new Terminal("which"); 888 l.add(c); 889 c = new Terminal("NOUNPL"); 890 l.add(c); 891 addRule(new Rule(l, true)); 892 893 // nounphrase(exist:minus, that:A, of:B, pl:minus, whin:minus, whout:minus)=>[every], noun_constr(that:A, of:B, whin:minus, whout:minus) 894 l.clear(); 895 featureHash.clear(); 896 c = new Nonterminal("nounphrase"); 897 c.setFeature("exist", new StringRef("minus")); 898 setFeature(c.getFeatureMap(), "that", 0, featureHash); 899 setFeature(c.getFeatureMap(), "of", 1, featureHash); 900 c.setFeature("pl", new StringRef("minus")); 901 c.setFeature("whin", new StringRef("minus")); 902 c.setFeature("whout", new StringRef("minus")); 903 l.add(c); 904 c = new Terminal("every"); 905 l.add(c); 906 c = new Nonterminal("noun_constr"); 907 setFeature(c.getFeatureMap(), "that", 0, featureHash); 908 setFeature(c.getFeatureMap(), "of", 1, featureHash); 909 c.setFeature("whin", new StringRef("minus")); 910 c.setFeature("whout", new StringRef("minus")); 911 l.add(c); 912 addRule(new Rule(l, true)); 913 914 // nounphrase(exist:minus, that:A, of:minus, pl:minus, whin:minus, whout:minus)=>univ_anon, var_ante, that_phrase(that:A, whin:minus, whout:minus) 915 l.clear(); 916 featureHash.clear(); 917 c = new Nonterminal("nounphrase"); 918 c.setFeature("exist", new StringRef("minus")); 919 setFeature(c.getFeatureMap(), "that", 0, featureHash); 920 c.setFeature("of", new StringRef("minus")); 921 c.setFeature("pl", new StringRef("minus")); 922 c.setFeature("whin", new StringRef("minus")); 923 c.setFeature("whout", new StringRef("minus")); 924 l.add(c); 925 c = new Nonterminal("univ_anon"); 926 l.add(c); 927 c = new Nonterminal("var_ante"); 928 l.add(c); 929 c = new Nonterminal("that_phrase"); 930 setFeature(c.getFeatureMap(), "that", 0, featureHash); 931 c.setFeature("whin", new StringRef("minus")); 932 c.setFeature("whout", new StringRef("minus")); 933 l.add(c); 934 addRule(new Rule(l, true)); 935 936 // nounphrase(exist:minus, that:A, of:minus, pl:minus, whin:minus, whout:minus)=>univ_anon, that_phrase(that:A, whin:minus, whout:minus) 937 l.clear(); 938 featureHash.clear(); 939 c = new Nonterminal("nounphrase"); 940 c.setFeature("exist", new StringRef("minus")); 941 setFeature(c.getFeatureMap(), "that", 0, featureHash); 942 c.setFeature("of", new StringRef("minus")); 943 c.setFeature("pl", new StringRef("minus")); 944 c.setFeature("whin", new StringRef("minus")); 945 c.setFeature("whout", new StringRef("minus")); 946 l.add(c); 947 c = new Nonterminal("univ_anon"); 948 l.add(c); 949 c = new Nonterminal("that_phrase"); 950 setFeature(c.getFeatureMap(), "that", 0, featureHash); 951 c.setFeature("whin", new StringRef("minus")); 952 c.setFeature("whout", new StringRef("minus")); 953 l.add(c); 954 addRule(new Rule(l, true)); 955 956 // nounphrase(exist:minus, that:A, of:B, pl:minus, whin:minus, whout:minus)=>[no], noun_constr(that:A, of:B, whin:minus, whout:minus) 957 l.clear(); 958 featureHash.clear(); 959 c = new Nonterminal("nounphrase"); 960 c.setFeature("exist", new StringRef("minus")); 961 setFeature(c.getFeatureMap(), "that", 0, featureHash); 962 setFeature(c.getFeatureMap(), "of", 1, featureHash); 963 c.setFeature("pl", new StringRef("minus")); 964 c.setFeature("whin", new StringRef("minus")); 965 c.setFeature("whout", new StringRef("minus")); 966 l.add(c); 967 c = new Terminal("no"); 968 l.add(c); 969 c = new Nonterminal("noun_constr"); 970 setFeature(c.getFeatureMap(), "that", 0, featureHash); 971 setFeature(c.getFeatureMap(), "of", 1, featureHash); 972 c.setFeature("whin", new StringRef("minus")); 973 c.setFeature("whout", new StringRef("minus")); 974 l.add(c); 975 addRule(new Rule(l, true)); 976 977 // nounphrase(exist:minus, that:A, of:minus, pl:minus, whin:minus, whout:minus)=>neg_anon, var_ante, that_phrase(that:A, whin:minus, whout:minus) 978 l.clear(); 979 featureHash.clear(); 980 c = new Nonterminal("nounphrase"); 981 c.setFeature("exist", new StringRef("minus")); 982 setFeature(c.getFeatureMap(), "that", 0, featureHash); 983 c.setFeature("of", new StringRef("minus")); 984 c.setFeature("pl", new StringRef("minus")); 985 c.setFeature("whin", new StringRef("minus")); 986 c.setFeature("whout", new StringRef("minus")); 987 l.add(c); 988 c = new Nonterminal("neg_anon"); 989 l.add(c); 990 c = new Nonterminal("var_ante"); 991 l.add(c); 992 c = new Nonterminal("that_phrase"); 993 setFeature(c.getFeatureMap(), "that", 0, featureHash); 994 c.setFeature("whin", new StringRef("minus")); 995 c.setFeature("whout", new StringRef("minus")); 996 l.add(c); 997 addRule(new Rule(l, true)); 998 999 // nounphrase(exist:minus, that:A, of:minus, pl:minus, whin:minus, whout:minus)=>neg_anon, that_phrase(that:A, whin:minus, whout:minus) 1000 l.clear(); 1001 featureHash.clear(); 1002 c = new Nonterminal("nounphrase"); 1003 c.setFeature("exist", new StringRef("minus")); 1004 setFeature(c.getFeatureMap(), "that", 0, featureHash); 1005 c.setFeature("of", new StringRef("minus")); 1006 c.setFeature("pl", new StringRef("minus")); 1007 c.setFeature("whin", new StringRef("minus")); 1008 c.setFeature("whout", new StringRef("minus")); 1009 l.add(c); 1010 c = new Nonterminal("neg_anon"); 1011 l.add(c); 1012 c = new Nonterminal("that_phrase"); 1013 setFeature(c.getFeatureMap(), "that", 0, featureHash); 1014 c.setFeature("whin", new StringRef("minus")); 1015 c.setFeature("whout", new StringRef("minus")); 1016 l.add(c); 1017 addRule(new Rule(l, true)); 1018 1019 // noun_constr(that:A, of:minus, whin:B, whout:C)=>noun_ante, that_phrase(that:A, whin:B, whout:C) 1020 l.clear(); 1021 featureHash.clear(); 1022 c = new Nonterminal("noun_constr"); 1023 setFeature(c.getFeatureMap(), "that", 0, featureHash); 1024 c.setFeature("of", new StringRef("minus")); 1025 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 1026 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 1027 l.add(c); 1028 c = new Nonterminal("noun_ante"); 1029 l.add(c); 1030 c = new Nonterminal("that_phrase"); 1031 setFeature(c.getFeatureMap(), "that", 0, featureHash); 1032 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 1033 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 1034 l.add(c); 1035 addRule(new Rule(l, true)); 1036 1037 // noun_constr(that:A, of:plus, whin:B, whout:C)=>['NOUNOF'], nounphrase_cut(that:A, whin:B, whout:C) 1038 l.clear(); 1039 featureHash.clear(); 1040 c = new Nonterminal("noun_constr"); 1041 setFeature(c.getFeatureMap(), "that", 0, featureHash); 1042 c.setFeature("of", new StringRef("plus")); 1043 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 1044 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 1045 l.add(c); 1046 c = new Terminal("NOUNOF"); 1047 l.add(c); 1048 c = new Nonterminal("nounphrase_cut"); 1049 setFeature(c.getFeatureMap(), "that", 0, featureHash); 1050 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 1051 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 1052 l.add(c); 1053 addRule(new Rule(l, true)); 1054 1055 // noun_ante=>['NOUN'(text:A)], newvar(var:B), >>>(type:noun, hasvar:plus, noun:A, var:B) 1056 l.clear(); 1057 featureHash.clear(); 1058 c = new Nonterminal("noun_ante"); 1059 l.add(c); 1060 c = new Terminal("NOUN"); 1061 setFeature(c.getFeatureMap(), "text", 0, featureHash); 1062 l.add(c); 1063 c = new Nonterminal("newvar"); 1064 setFeature(c.getFeatureMap(), "var", 1, featureHash); 1065 l.add(c); 1066 c = new Nonterminal(">>>"); 1067 c.setFeature("type", new StringRef("noun")); 1068 c.setFeature("hasvar", new StringRef("plus")); 1069 setFeature(c.getFeatureMap(), "noun", 0, featureHash); 1070 setFeature(c.getFeatureMap(), "var", 1, featureHash); 1071 l.add(c); 1072 addRule(new Rule(l, true)); 1073 1074 // noun_ante=>['NOUN'(text:A)], >>>(type:noun, hasvar:minus, noun:A) 1075 l.clear(); 1076 featureHash.clear(); 1077 c = new Nonterminal("noun_ante"); 1078 l.add(c); 1079 c = new Terminal("NOUN"); 1080 setFeature(c.getFeatureMap(), "text", 0, featureHash); 1081 l.add(c); 1082 c = new Nonterminal(">>>"); 1083 c.setFeature("type", new StringRef("noun")); 1084 c.setFeature("hasvar", new StringRef("minus")); 1085 setFeature(c.getFeatureMap(), "noun", 0, featureHash); 1086 l.add(c); 1087 addRule(new Rule(l, true)); 1088 1089 // var_ante=>newvar(var:A), >>>(type:var, hasvar:plus, var:A) 1090 l.clear(); 1091 featureHash.clear(); 1092 c = new Nonterminal("var_ante"); 1093 l.add(c); 1094 c = new Nonterminal("newvar"); 1095 setFeature(c.getFeatureMap(), "var", 0, featureHash); 1096 l.add(c); 1097 c = new Nonterminal(">>>"); 1098 c.setFeature("type", new StringRef("var")); 1099 c.setFeature("hasvar", new StringRef("plus")); 1100 setFeature(c.getFeatureMap(), "var", 0, featureHash); 1101 l.add(c); 1102 addRule(new Rule(l, true)); 1103 1104 // newvar(var:A)=>['VARIABLE'(text:A)], </<(hasvar:plus, var:A) 1105 l.clear(); 1106 featureHash.clear(); 1107 c = new Nonterminal("newvar"); 1108 setFeature(c.getFeatureMap(), "var", 0, featureHash); 1109 l.add(c); 1110 c = new Terminal("VARIABLE"); 1111 setFeature(c.getFeatureMap(), "text", 0, featureHash); 1112 l.add(c); 1113 c = new Nonterminal("</<"); 1114 c.setFeature("hasvar", new StringRef("plus")); 1115 setFeature(c.getFeatureMap(), "var", 0, featureHash); 1116 l.add(c); 1117 addRule(new Rule(l, true)); 1118 1119 // verb(verb:be, neg:minus, pl:minus)=>[is] 1120 l.clear(); 1121 featureHash.clear(); 1122 c = new Nonterminal("verb"); 1123 c.setFeature("verb", new StringRef("be")); 1124 c.setFeature("neg", new StringRef("minus")); 1125 c.setFeature("pl", new StringRef("minus")); 1126 l.add(c); 1127 c = new Terminal("is"); 1128 l.add(c); 1129 addRule(new Rule(l, true)); 1130 1131 // verb(verb:be, neg:plus, pl:minus)=>['is not'] 1132 l.clear(); 1133 featureHash.clear(); 1134 c = new Nonterminal("verb"); 1135 c.setFeature("verb", new StringRef("be")); 1136 c.setFeature("neg", new StringRef("plus")); 1137 c.setFeature("pl", new StringRef("minus")); 1138 l.add(c); 1139 c = new Terminal("is not"); 1140 l.add(c); 1141 addRule(new Rule(l, true)); 1142 1143 // verb(verb:be, neg:plus, pl:minus)=>[is, not] 1144 l.clear(); 1145 featureHash.clear(); 1146 c = new Nonterminal("verb"); 1147 c.setFeature("verb", new StringRef("be")); 1148 c.setFeature("neg", new StringRef("plus")); 1149 c.setFeature("pl", new StringRef("minus")); 1150 l.add(c); 1151 c = new Terminal("is"); 1152 l.add(c); 1153 c = new Terminal("not"); 1154 l.add(c); 1155 addRule(new Rule(l, true)); 1156 1157 // verb(verb:be, neg:minus, pl:plus)=>[are] 1158 l.clear(); 1159 featureHash.clear(); 1160 c = new Nonterminal("verb"); 1161 c.setFeature("verb", new StringRef("be")); 1162 c.setFeature("neg", new StringRef("minus")); 1163 c.setFeature("pl", new StringRef("plus")); 1164 l.add(c); 1165 c = new Terminal("are"); 1166 l.add(c); 1167 addRule(new Rule(l, true)); 1168 1169 // verb(verb:be, neg:plus, pl:plus)=>['are not'] 1170 l.clear(); 1171 featureHash.clear(); 1172 c = new Nonterminal("verb"); 1173 c.setFeature("verb", new StringRef("be")); 1174 c.setFeature("neg", new StringRef("plus")); 1175 c.setFeature("pl", new StringRef("plus")); 1176 l.add(c); 1177 c = new Terminal("are not"); 1178 l.add(c); 1179 addRule(new Rule(l, true)); 1180 1181 // verb(verb:be, neg:plus, pl:plus)=>[are, not] 1182 l.clear(); 1183 featureHash.clear(); 1184 c = new Nonterminal("verb"); 1185 c.setFeature("verb", new StringRef("be")); 1186 c.setFeature("neg", new StringRef("plus")); 1187 c.setFeature("pl", new StringRef("plus")); 1188 l.add(c); 1189 c = new Terminal("are"); 1190 l.add(c); 1191 c = new Terminal("not"); 1192 l.add(c); 1193 addRule(new Rule(l, true)); 1194 1195 // verb(verb:full, neg:minus, pl:minus)=>['VERB'] 1196 l.clear(); 1197 featureHash.clear(); 1198 c = new Nonterminal("verb"); 1199 c.setFeature("verb", new StringRef("full")); 1200 c.setFeature("neg", new StringRef("minus")); 1201 c.setFeature("pl", new StringRef("minus")); 1202 l.add(c); 1203 c = new Terminal("VERB"); 1204 l.add(c); 1205 addRule(new Rule(l, true)); 1206 1207 // verb(verb:full, neg:plus, pl:minus)=>['does not', 'VERBINF'] 1208 l.clear(); 1209 featureHash.clear(); 1210 c = new Nonterminal("verb"); 1211 c.setFeature("verb", new StringRef("full")); 1212 c.setFeature("neg", new StringRef("plus")); 1213 c.setFeature("pl", new StringRef("minus")); 1214 l.add(c); 1215 c = new Terminal("does not"); 1216 l.add(c); 1217 c = new Terminal("VERBINF"); 1218 l.add(c); 1219 addRule(new Rule(l, true)); 1220 1221 // verb(verb:full, neg:minus, pl:plus)=>['VERBINF'] 1222 l.clear(); 1223 featureHash.clear(); 1224 c = new Nonterminal("verb"); 1225 c.setFeature("verb", new StringRef("full")); 1226 c.setFeature("neg", new StringRef("minus")); 1227 c.setFeature("pl", new StringRef("plus")); 1228 l.add(c); 1229 c = new Terminal("VERBINF"); 1230 l.add(c); 1231 addRule(new Rule(l, true)); 1232 1233 // verb(verb:full, neg:plus, pl:plus)=>['do not', 'VERBINF'] 1234 l.clear(); 1235 featureHash.clear(); 1236 c = new Nonterminal("verb"); 1237 c.setFeature("verb", new StringRef("full")); 1238 c.setFeature("neg", new StringRef("plus")); 1239 c.setFeature("pl", new StringRef("plus")); 1240 l.add(c); 1241 c = new Terminal("do not"); 1242 l.add(c); 1243 c = new Terminal("VERBINF"); 1244 l.add(c); 1245 addRule(new Rule(l, true)); 1246 1247 // that_phrase(that:minus, whin:A, whout:A)=>[] 1248 l.clear(); 1249 featureHash.clear(); 1250 c = new Nonterminal("that_phrase"); 1251 c.setFeature("that", new StringRef("minus")); 1252 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 1253 setFeature(c.getFeatureMap(), "whout", 0, featureHash); 1254 l.add(c); 1255 addRule(new Rule(l, true)); 1256 1257 // that_phrase(that:plus, whin:A, whout:B)=>rel_pron, that_phrase_1(whin:A, whout:B) 1258 l.clear(); 1259 featureHash.clear(); 1260 c = new Nonterminal("that_phrase"); 1261 c.setFeature("that", new StringRef("plus")); 1262 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 1263 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 1264 l.add(c); 1265 c = new Nonterminal("rel_pron"); 1266 l.add(c); 1267 c = new Nonterminal("that_phrase_1"); 1268 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 1269 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 1270 l.add(c); 1271 addRule(new Rule(l, true)); 1272 1273 // that_phrase_1(whin:A, whout:B)=>that_phrase_2(whin:A, whout:B) 1274 l.clear(); 1275 featureHash.clear(); 1276 c = new Nonterminal("that_phrase_1"); 1277 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 1278 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 1279 l.add(c); 1280 c = new Nonterminal("that_phrase_2"); 1281 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 1282 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 1283 l.add(c); 1284 addRule(new Rule(l, true)); 1285 1286 // that_phrase_1(whin:A, whout:A)~>that_phrase_2(that:minus, whin:A, whout:A), or_rel_pron, that_phrase_1(whin:A, whout:A) 1287 l.clear(); 1288 featureHash.clear(); 1289 c = new Nonterminal("that_phrase_1"); 1290 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 1291 setFeature(c.getFeatureMap(), "whout", 0, featureHash); 1292 l.add(c); 1293 c = new Nonterminal("that_phrase_2"); 1294 c.setFeature("that", new StringRef("minus")); 1295 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 1296 setFeature(c.getFeatureMap(), "whout", 0, featureHash); 1297 l.add(c); 1298 c = new Nonterminal("or_rel_pron"); 1299 l.add(c); 1300 c = new Nonterminal("that_phrase_1"); 1301 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 1302 setFeature(c.getFeatureMap(), "whout", 0, featureHash); 1303 l.add(c); 1304 addRule(new Rule(l, false)); 1305 1306 // that_phrase_2(that:A, whin:B, whout:B)=>verbphrase_cut(that:minus, pl:minus, whin:B, whout:B), and_rel_pron, that_phrase_2(that:A, whin:B, whout:B) 1307 l.clear(); 1308 featureHash.clear(); 1309 c = new Nonterminal("that_phrase_2"); 1310 setFeature(c.getFeatureMap(), "that", 0, featureHash); 1311 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 1312 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 1313 l.add(c); 1314 c = new Nonterminal("verbphrase_cut"); 1315 c.setFeature("that", new StringRef("minus")); 1316 c.setFeature("pl", new StringRef("minus")); 1317 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 1318 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 1319 l.add(c); 1320 c = new Nonterminal("and_rel_pron"); 1321 l.add(c); 1322 c = new Nonterminal("that_phrase_2"); 1323 setFeature(c.getFeatureMap(), "that", 0, featureHash); 1324 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 1325 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 1326 l.add(c); 1327 addRule(new Rule(l, true)); 1328 1329 // that_phrase_2(that:A, whin:B, whout:C)=>verbphrase_cut(that:A, pl:minus, whin:B, whout:C) 1330 l.clear(); 1331 featureHash.clear(); 1332 c = new Nonterminal("that_phrase_2"); 1333 setFeature(c.getFeatureMap(), "that", 0, featureHash); 1334 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 1335 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 1336 l.add(c); 1337 c = new Nonterminal("verbphrase_cut"); 1338 setFeature(c.getFeatureMap(), "that", 0, featureHash); 1339 c.setFeature("pl", new StringRef("minus")); 1340 setFeature(c.getFeatureMap(), "whin", 1, featureHash); 1341 setFeature(c.getFeatureMap(), "whout", 2, featureHash); 1342 l.add(c); 1343 addRule(new Rule(l, true)); 1344 1345 // that_phrase_2(that:minus, whin:A, whout:B)=>nounphrase_cut(that:minus, verb:full, pl:C, whin:A, whout:B), verb(verb:full, pl:C) 1346 l.clear(); 1347 featureHash.clear(); 1348 c = new Nonterminal("that_phrase_2"); 1349 c.setFeature("that", new StringRef("minus")); 1350 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 1351 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 1352 l.add(c); 1353 c = new Nonterminal("nounphrase_cut"); 1354 c.setFeature("that", new StringRef("minus")); 1355 c.setFeature("verb", new StringRef("full")); 1356 setFeature(c.getFeatureMap(), "pl", 2, featureHash); 1357 setFeature(c.getFeatureMap(), "whin", 0, featureHash); 1358 setFeature(c.getFeatureMap(), "whout", 1, featureHash); 1359 l.add(c); 1360 c = new Nonterminal("verb"); 1361 c.setFeature("verb", new StringRef("full")); 1362 setFeature(c.getFeatureMap(), "pl", 2, featureHash); 1363 l.add(c); 1364 addRule(new Rule(l, true)); 1365 1366 // rel_pron=>[that] 1367 l.clear(); 1368 featureHash.clear(); 1369 c = new Nonterminal("rel_pron"); 1370 l.add(c); 1371 c = new Terminal("that"); 1372 l.add(c); 1373 addRule(new Rule(l, true)); 1374 1375 // or_rel_pron=>[or], rel_pron 1376 l.clear(); 1377 featureHash.clear(); 1378 c = new Nonterminal("or_rel_pron"); 1379 l.add(c); 1380 c = new Terminal("or"); 1381 l.add(c); 1382 c = new Nonterminal("rel_pron"); 1383 l.add(c); 1384 addRule(new Rule(l, true)); 1385 1386 // or_rel_pron=>['or that'] 1387 l.clear(); 1388 featureHash.clear(); 1389 c = new Nonterminal("or_rel_pron"); 1390 l.add(c); 1391 c = new Terminal("or that"); 1392 l.add(c); 1393 addRule(new Rule(l, true)); 1394 1395 // and_rel_pron=>[and], rel_pron 1396 l.clear(); 1397 featureHash.clear(); 1398 c = new Nonterminal("and_rel_pron"); 1399 l.add(c); 1400 c = new Terminal("and"); 1401 l.add(c); 1402 c = new Nonterminal("rel_pron"); 1403 l.add(c); 1404 addRule(new Rule(l, true)); 1405 1406 // and_rel_pron=>['and that'] 1407 l.clear(); 1408 featureHash.clear(); 1409 c = new Nonterminal("and_rel_pron"); 1410 l.add(c); 1411 c = new Terminal("and that"); 1412 l.add(c); 1413 addRule(new Rule(l, true)); 1414 1415 // exist_anon=>[something] 1416 l.clear(); 1417 featureHash.clear(); 1418 c = new Nonterminal("exist_anon"); 1419 l.add(c); 1420 c = new Terminal("something"); 1421 l.add(c); 1422 addRule(new Rule(l, true)); 1423 1424 // exist_anon=>[somebody] 1425 l.clear(); 1426 featureHash.clear(); 1427 c = new Nonterminal("exist_anon"); 1428 l.add(c); 1429 c = new Terminal("somebody"); 1430 l.add(c); 1431 addRule(new Rule(l, true)); 1432 1433 // univ_anon=>[everything] 1434 l.clear(); 1435 featureHash.clear(); 1436 c = new Nonterminal("univ_anon"); 1437 l.add(c); 1438 c = new Terminal("everything"); 1439 l.add(c); 1440 addRule(new Rule(l, true)); 1441 1442 // univ_anon=>[everybody] 1443 l.clear(); 1444 featureHash.clear(); 1445 c = new Nonterminal("univ_anon"); 1446 l.add(c); 1447 c = new Terminal("everybody"); 1448 l.add(c); 1449 addRule(new Rule(l, true)); 1450 1451 // neg_anon=>[nothing] 1452 l.clear(); 1453 featureHash.clear(); 1454 c = new Nonterminal("neg_anon"); 1455 l.add(c); 1456 c = new Terminal("nothing"); 1457 l.add(c); 1458 addRule(new Rule(l, true)); 1459 1460 // neg_anon=>[nobody] 1461 l.clear(); 1462 featureHash.clear(); 1463 c = new Nonterminal("neg_anon"); 1464 l.add(c); 1465 c = new Terminal("nobody"); 1466 l.add(c); 1467 addRule(new Rule(l, true)); 1468 1469 // num_quant=>['at least'] 1470 l.clear(); 1471 featureHash.clear(); 1472 c = new Nonterminal("num_quant"); 1473 l.add(c); 1474 c = new Terminal("at least"); 1475 l.add(c); 1476 addRule(new Rule(l, true)); 1477 1478 // num_quant=>['at most'] 1479 l.clear(); 1480 featureHash.clear(); 1481 c = new Nonterminal("num_quant"); 1482 l.add(c); 1483 c = new Terminal("at most"); 1484 l.add(c); 1485 addRule(new Rule(l, true)); 1486 1487 // num_quant=>['less than'] 1488 l.clear(); 1489 featureHash.clear(); 1490 c = new Nonterminal("num_quant"); 1491 l.add(c); 1492 c = new Terminal("less than"); 1493 l.add(c); 1494 addRule(new Rule(l, true)); 1495 1496 // num_quant=>['more than'] 1497 l.clear(); 1498 featureHash.clear(); 1499 c = new Nonterminal("num_quant"); 1500 l.add(c); 1501 c = new Terminal("more than"); 1502 l.add(c); 1503 addRule(new Rule(l, true)); 1504 1505 // num_quant=>[exactly] 1506 l.clear(); 1507 featureHash.clear(); 1508 c = new Nonterminal("num_quant"); 1509 l.add(c); 1510 c = new Terminal("exactly"); 1511 l.add(c); 1512 addRule(new Rule(l, true)); 1513 1514 } 1515 1516 private void setFeature(FeatureMap fm, String featureName, int varID, HashMap<Integer, StringRef> featureHash) { 1517 if (featureHash.get(varID) == null) { 1518 StringRef stringRef = new StringRef(); 1519 fm.setFeature(featureName, stringRef); 1520 featureHash.put(varID, stringRef); 1521 } else { 1522 fm.setFeature(featureName, featureHash.get(varID)); 1523 } 1524 } 1525 1526 }