| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!DOCTYPE chapter SYSTEM "docbook-dtd-45/docbookx.dtd"> |
| 3 |
|
| 4 |
<chapter id="cgkeywords"> |
| 5 |
<title>Constraint Grammar Keywords</title> |
| 6 |
|
| 7 |
<para> |
| 8 |
<emphasis>You should avoid using these keywords as set names or similar.</emphasis> |
| 9 |
</para> |
| 10 |
|
| 11 |
<section id="keyword-add"> |
| 12 |
<title>ADD</title> |
| 13 |
<indexterm> |
| 14 |
<primary>ADD</primary> |
| 15 |
<seealso>MAP</seealso> |
| 16 |
</indexterm> |
| 17 |
<para> |
| 18 |
Singles out a reading from the cohort that matches the target, and if all contextual tests are |
| 19 |
satisfied it will add the listed tags to the reading. Unlike MAP it will not block further MAP, |
| 20 |
ADD, or REPLACE rules from operating on the reading. |
| 21 |
</para> |
| 22 |
<screen> |
| 23 |
ADD (tags) targetset (-1* ("someword")) ; |
| 24 |
</screen> |
| 25 |
</section> |
| 26 |
|
| 27 |
<section id="keyword-addcohort"> |
| 28 |
<title>ADDCOHORT</title> |
| 29 |
<indexterm> |
| 30 |
<primary>ADDCOHORT</primary> |
| 31 |
</indexterm> |
| 32 |
<para> |
| 33 |
Inserts a new cohort before or after the target. |
| 34 |
</para> |
| 35 |
<screen> |
| 36 |
ADDCOHORT ("<wordform>" "baseform" tags) BEFORE (@waffles) ; |
| 37 |
ADDCOHORT ("<wordform>" "baseform" tags) AFTER (@waffles) ; |
| 38 |
</screen> |
| 39 |
</section> |
| 40 |
|
| 41 |
<section id="keyword-addrelation"> |
| 42 |
<title>ADDRELATION</title> |
| 43 |
<indexterm> |
| 44 |
<primary>ADDRELATION</primary> |
| 45 |
</indexterm> |
| 46 |
<para> |
| 47 |
ADDRELATION creates a one-way named relation from the current cohort to the found cohort. |
| 48 |
The name must be an alphanumeric string with no whitespace. |
| 49 |
</para> |
| 50 |
<screen> |
| 51 |
ADDRELATION (name) targetset (-1* ("someword")) |
| 52 |
TO (1* (@candidate)) (2 SomeSet) ; |
| 53 |
</screen> |
| 54 |
</section> |
| 55 |
|
| 56 |
<section id="keyword-addrelations"> |
| 57 |
<title>ADDRELATIONS</title> |
| 58 |
<indexterm> |
| 59 |
<primary>ADDRELATIONS</primary> |
| 60 |
</indexterm> |
| 61 |
<para> |
| 62 |
ADDRELATIONS creates two one-way named relation; one from the current cohort to the found cohort, |
| 63 |
and one the other way. The names can be the same if so desired. |
| 64 |
</para> |
| 65 |
<screen> |
| 66 |
ADDRELATIONS (name) (name) targetset (-1* ("someword")) |
| 67 |
TO (1* (@candidate)) (2 SomeSet) ; |
| 68 |
</screen> |
| 69 |
</section> |
| 70 |
|
| 71 |
<section id="keyword-after-sections"> |
| 72 |
<title>AFTER-SECTIONS</title> |
| 73 |
<indexterm> |
| 74 |
<primary>AFTER-SECTIONS</primary> |
| 75 |
</indexterm> |
| 76 |
<para> |
| 77 |
Same as SECTION, except it is only run a single time per window, |
| 78 |
and only after all normal SECTIONs have run. |
| 79 |
</para> |
| 80 |
</section> |
| 81 |
|
| 82 |
<section id="keyword-all"> |
| 83 |
<title>ALL</title> |
| 84 |
<indexterm> |
| 85 |
<primary>ALL</primary> |
| 86 |
</indexterm> |
| 87 |
<para> |
| 88 |
An inline keyword put at the start of a contextual test to mandate that all cohorts found via the |
| 89 |
dependency or relation must match the set. This is a more readable way of saying 'C'. |
| 90 |
</para> |
| 91 |
<screen> |
| 92 |
SELECT targetset (ALL c (tag)) ; |
| 93 |
</screen> |
| 94 |
</section> |
| 95 |
|
| 96 |
<section id="keyword-and"> |
| 97 |
<title>AND</title> |
| 98 |
<indexterm> |
| 99 |
<primary>AND</primary> |
| 100 |
</indexterm> |
| 101 |
<para> |
| 102 |
<emphasis>Deprecated: use "LINK 0" instead.</emphasis> |
| 103 |
An inline keyword put between contextual tests as shorthand for "LINK 0". |
| 104 |
</para> |
| 105 |
</section> |
| 106 |
|
| 107 |
<section id="keyword-append"> |
| 108 |
<title>APPEND</title> |
| 109 |
<indexterm> |
| 110 |
<primary>APPEND</primary> |
| 111 |
</indexterm> |
| 112 |
<para> |
| 113 |
Singles out a reading from the cohort that matches the target, and if all contextual tests are |
| 114 |
satisfied it will create and append a new reading from the listed tags. |
| 115 |
<emphasis>Since this creates a raw reading you must include a baseform in the tag list.</emphasis> |
| 116 |
</para> |
| 117 |
<screen> |
| 118 |
APPEND ("baseform" tags) targetset (-1* ("someword")) ; |
| 119 |
</screen> |
| 120 |
</section> |
| 121 |
|
| 122 |
<section id="keyword-barrier"> |
| 123 |
<title>BARRIER</title> |
| 124 |
<indexterm> |
| 125 |
<primary>BARRIER</primary> |
| 126 |
</indexterm> |
| 127 |
<para> |
| 128 |
An inline keyword part of a contextual test that will halt a scan if the barrier is encountered. |
| 129 |
Only meaningful in scanning contexts. |
| 130 |
</para> |
| 131 |
<screen> |
| 132 |
SELECT targetset (-1* ("someword") BARRIER (tag)) ; |
| 133 |
</screen> |
| 134 |
</section> |
| 135 |
|
| 136 |
<section id="keyword-before-sections"> |
| 137 |
<title>BEFORE-SECTIONS</title> |
| 138 |
<indexterm> |
| 139 |
<primary>BEFORE-SECTIONS</primary> |
| 140 |
</indexterm> |
| 141 |
<para> |
| 142 |
Same as SECTION, except it is only run a single time per window, |
| 143 |
and only before all normal SECTIONs have run. |
| 144 |
</para> |
| 145 |
</section> |
| 146 |
|
| 147 |
<section id="keyword-cbarrier"> |
| 148 |
<title>CBARRIER</title> |
| 149 |
<indexterm> |
| 150 |
<primary>CBARRIER</primary> |
| 151 |
</indexterm> |
| 152 |
<para> |
| 153 |
Careful version of <link linkend="keyword-barrier">BARRIER</link>. |
| 154 |
Only meaningful in scanning contexts. See <link linkend="test-cbarrier">CBARRIER</link>. |
| 155 |
</para> |
| 156 |
<screen> |
| 157 |
SELECT targetset (-1* ("someword") CBARRIER (tag)) ; |
| 158 |
</screen> |
| 159 |
</section> |
| 160 |
|
| 161 |
<section id="keyword-constraints"> |
| 162 |
<title>CONSTRAINTS</title> |
| 163 |
<indexterm> |
| 164 |
<primary>CONSTRAINTS</primary> |
| 165 |
</indexterm> |
| 166 |
<para> |
| 167 |
<emphasis>Deprecated: use SECTION instead.</emphasis> |
| 168 |
A section of the grammar that can contain SELECT, REMOVE, and IFF entries. |
| 169 |
</para> |
| 170 |
</section> |
| 171 |
|
| 172 |
<section id="keyword-copy"> |
| 173 |
<title>COPY</title> |
| 174 |
<indexterm> |
| 175 |
<primary>COPY</primary> |
| 176 |
</indexterm> |
| 177 |
<para> |
| 178 |
Duplicates a reading and adds tags to it. If you don't want to copy previously copied readings, |
| 179 |
you will have to keep track of that yourself by adding a marker tag. |
| 180 |
</para> |
| 181 |
<screen> |
| 182 |
COPY (¤copy tags) TARGET (target) - (¤copy) ; |
| 183 |
</screen> |
| 184 |
</section> |
| 185 |
|
| 186 |
<section id="keyword-corrections"> |
| 187 |
<title>CORRECTIONS</title> |
| 188 |
<indexterm> |
| 189 |
<primary>CORRECTIONS</primary> |
| 190 |
</indexterm> |
| 191 |
<para> |
| 192 |
<emphasis>Deprecated: use BEFORE-SECTIONS instead.</emphasis> |
| 193 |
A section of the grammar that can contain APPEND and SUBSTITUTE entries. |
| 194 |
</para> |
| 195 |
</section> |
| 196 |
|
| 197 |
<section id="keyword-delimit"> |
| 198 |
<title>DELIMIT</title> |
| 199 |
<indexterm> |
| 200 |
<primary>DELIMIT</primary> |
| 201 |
<seealso>DELIMITERS</seealso> |
| 202 |
</indexterm> |
| 203 |
<para> |
| 204 |
If it finds a reading which satisfies the target and the contextual tests, DELIMIT will |
| 205 |
cut the disambituation window immediately after the cohort the reading is in. After delimiting |
| 206 |
in this manner, CG-3 will bail out and disambiguate the newly formed window from the start. |
| 207 |
<emphasis> |
| 208 |
This should not be used instead of DELIMITERS unless you know what you are doing. |
| 209 |
</emphasis> |
| 210 |
</para> |
| 211 |
<screen> |
| 212 |
DELIMIT targetset (-1* ("someword")) ; |
| 213 |
</screen> |
| 214 |
</section> |
| 215 |
|
| 216 |
<section id="keyword-delimiters"> |
| 217 |
<title>DELIMITERS</title> |
| 218 |
<indexterm> |
| 219 |
<primary>DELIMITERS</primary> |
| 220 |
<seealso>SOFT-DELIMITERS</seealso> |
| 221 |
<seealso>TEXT-DELIMITERS</seealso> |
| 222 |
</indexterm> |
| 223 |
<para> |
| 224 |
Sets a list of hard delimiters. If one of these are found the disambuation window is cut |
| 225 |
immediately after the cohort it was found in. |
| 226 |
If no delimiters are defined or the window exceeds the hard limit (defaults to 500 cohorts), |
| 227 |
the window will be cut arbitarily. |
| 228 |
Internally, this is converted to the magic set _S_DELIMITERS_. |
| 229 |
</para> |
| 230 |
<screen> |
| 231 |
DELIMITERS = "<$.>" "<$?>" "<$!>" "<$:>" "<$\;>" ; |
| 232 |
</screen> |
| 233 |
</section> |
| 234 |
|
| 235 |
<section id="keyword-end"> |
| 236 |
<title>END</title> |
| 237 |
<indexterm> |
| 238 |
<primary>END</primary> |
| 239 |
</indexterm> |
| 240 |
<para> |
| 241 |
Denotes the end of the grammar. Nothing after this keyword is read. |
| 242 |
Useful for debugging. |
| 243 |
</para> |
| 244 |
</section> |
| 245 |
|
| 246 |
<section id="keyword-external"> |
| 247 |
<title>EXTERNAL</title> |
| 248 |
<indexterm> |
| 249 |
<primary>EXTERNAL</primary> |
| 250 |
</indexterm> |
| 251 |
<para> |
| 252 |
Opens up a persistent pipe to the program and passes it the current window. |
| 253 |
</para> |
| 254 |
<screen> |
| 255 |
EXTERNAL ONCE /usr/local/bin/waffles (V) (-1 N) ; |
| 256 |
EXTERNAL ALWAYS program-in-path (V) (-1 N) ; |
| 257 |
EXTERNAL ONCE "program with spaces" (V) (-1 N) ; |
| 258 |
</screen> |
| 259 |
</section> |
| 260 |
|
| 261 |
<section id="keyword-if"> |
| 262 |
<title>IF</title> |
| 263 |
<indexterm> |
| 264 |
<primary>IF</primary> |
| 265 |
</indexterm> |
| 266 |
<para> |
| 267 |
An optional inline keyword put before the first contextual test of a rule. |
| 268 |
</para> |
| 269 |
</section> |
| 270 |
|
| 271 |
<section id="keyword-iff"> |
| 272 |
<title>IFF</title> |
| 273 |
<indexterm> |
| 274 |
<primary>IFF</primary> |
| 275 |
</indexterm> |
| 276 |
<para> |
| 277 |
Singles out a reading from the cohort that matches the target, and if all contextual tests are |
| 278 |
satisfied it will behave as a SELECT rule. |
| 279 |
If the tests are not satisfied it will behave as a REMOVE rule. |
| 280 |
</para> |
| 281 |
<screen> |
| 282 |
IFF targetset (-1* ("someword")) ; |
| 283 |
</screen> |
| 284 |
</section> |
| 285 |
|
| 286 |
<section id="keyword-include"> |
| 287 |
<title>INCLUDE</title> |
| 288 |
<indexterm> |
| 289 |
<primary>INCLUDE</primary> |
| 290 |
</indexterm> |
| 291 |
<para> |
| 292 |
Loads and parses another grammar file as if it had been pasted in on the line of the INCLUDE statement. |
| 293 |
<screen> |
| 294 |
INCLUDE other-file-name ; |
| 295 |
</screen> |
| 296 |
</para> |
| 297 |
</section> |
| 298 |
|
| 299 |
<section id="keyword-link"> |
| 300 |
<title>LINK</title> |
| 301 |
<indexterm> |
| 302 |
<primary>LINK</primary> |
| 303 |
</indexterm> |
| 304 |
<para> |
| 305 |
An inline keyword part of a contextual test that will chain to another contextual test |
| 306 |
if the current is satisfied. The chained contextual test will operate from the current position |
| 307 |
in the window, as opposed to the position of the original cohort that initiated the chain. |
| 308 |
The chain can be extended to any depth. |
| 309 |
</para> |
| 310 |
<screen> |
| 311 |
SELECT targetset (-1* ("someword") LINK 3 (tag)) ; |
| 312 |
</screen> |
| 313 |
</section> |
| 314 |
|
| 315 |
<section id="keyword-list"> |
| 316 |
<title>LIST</title> |
| 317 |
<indexterm> |
| 318 |
<primary>LIST</primary> |
| 319 |
</indexterm> |
| 320 |
<para> |
| 321 |
Defines a new set based on a list of tags, or appends to an existing set. |
| 322 |
</para> |
| 323 |
<screen> |
| 324 |
LIST setname = tag othertag (mtag htag) ltag ; |
| 325 |
|
| 326 |
LIST setname += even more tags ; |
| 327 |
</screen> |
| 328 |
</section> |
| 329 |
|
| 330 |
<section id="keyword-map"> |
| 331 |
<title>MAP</title> |
| 332 |
<indexterm> |
| 333 |
<primary>MAP</primary> |
| 334 |
<seealso>ADD</seealso> |
| 335 |
</indexterm> |
| 336 |
<para> |
| 337 |
Singles out a reading from the cohort that matches the target, and if all contextual tests are |
| 338 |
satisfied it will add the listed tags to the reading and block further MAP, |
| 339 |
ADD, or REPLACE rules from operating on the reading. |
| 340 |
</para> |
| 341 |
<screen> |
| 342 |
MAP (tags) targetset (-1* ("someword")) ; |
| 343 |
</screen> |
| 344 |
</section> |
| 345 |
|
| 346 |
<section id="keyword-mappings"> |
| 347 |
<title>MAPPINGS</title> |
| 348 |
<indexterm> |
| 349 |
<primary>MAPPINGS</primary> |
| 350 |
</indexterm> |
| 351 |
<para> |
| 352 |
<emphasis>Deprecated: use BEFORE-SECTIONS instead.</emphasis> |
| 353 |
A section of the grammar that can contain MAP, ADD, and REPLACE entries. |
| 354 |
</para> |
| 355 |
</section> |
| 356 |
|
| 357 |
<section id="keyword-mapping-prefix"> |
| 358 |
<title>MAPPING-PREFIX</title> |
| 359 |
<indexterm> |
| 360 |
<primary>MAPPING-PREFIX</primary> |
| 361 |
<seealso>MAP</seealso> |
| 362 |
</indexterm> |
| 363 |
<para> |
| 364 |
Defines the single prefix character that should determine whether a tag is considered a mapping tag |
| 365 |
or not. Defaults to @. |
| 366 |
</para> |
| 367 |
<screen> |
| 368 |
MAPPING-PREFIX = @ ; |
| 369 |
</screen> |
| 370 |
</section> |
| 371 |
|
| 372 |
<section id="keyword-move"> |
| 373 |
<title>MOVE</title> |
| 374 |
<indexterm> |
| 375 |
<primary>MOVE</primary> |
| 376 |
<seealso>SWITCH</seealso> |
| 377 |
</indexterm> |
| 378 |
<para> |
| 379 |
Moves cohorts and optionally all children of the cohort to a different position in the window. |
| 380 |
</para> |
| 381 |
<screen> |
| 382 |
MOVE targetset (-1* ("someword")) AFTER (1* ("buffalo")) (-1 ("water")) ; |
| 383 |
MOVE WITHCHILD (*) targetset (-1* ("someword")) BEFORE (1* ("buffalo")) (-1 ("water")) ; |
| 384 |
MOVE targetset (-1* ("someword")) AFTER WITHCHILD (*) (1* ("buffalo")) (-1 ("water")) ; |
| 385 |
MOVE WITHCHILD (*) targetset (-1* ("someword")) BEFORE WITHCHILD (*) (1* ("buffalo")) (-1 ("water")) ; |
| 386 |
</screen> |
| 387 |
</section> |
| 388 |
|
| 389 |
<section id="keyword-negate"> |
| 390 |
<title>NEGATE</title> |
| 391 |
<indexterm> |
| 392 |
<primary>NEGATE</primary> |
| 393 |
<seealso>NOT</seealso> |
| 394 |
</indexterm> |
| 395 |
<para> |
| 396 |
An inline keyword put at the start of a contextual test to invert the combined result of all |
| 397 |
following contextual tests. |
| 398 |
Similar to, but not the same as, NOT. |
| 399 |
</para> |
| 400 |
<screen> |
| 401 |
SELECT targetset (NEGATE -1* ("someword") LINK NOT 1 (tag)) ; |
| 402 |
</screen> |
| 403 |
</section> |
| 404 |
|
| 405 |
<section id="keyword-none"> |
| 406 |
<title>NONE</title> |
| 407 |
<indexterm> |
| 408 |
<primary>NONE</primary> |
| 409 |
</indexterm> |
| 410 |
<para> |
| 411 |
An inline keyword put at the start of a contextual test to mandate that none of the cohorts found via the |
| 412 |
dependency or relation must match the set. This is a more readable way of saying 'NOT'. |
| 413 |
</para> |
| 414 |
<screen> |
| 415 |
SELECT targetset (NONE c (tag)) ; |
| 416 |
</screen> |
| 417 |
</section> |
| 418 |
|
| 419 |
<section id="keyword-not"> |
| 420 |
<title>NOT</title> |
| 421 |
<indexterm> |
| 422 |
<primary>NOT</primary> |
| 423 |
<seealso>NEGATE</seealso> |
| 424 |
</indexterm> |
| 425 |
<para> |
| 426 |
An inline keyword put at the start of a contextual test to invert the result of it. |
| 427 |
Similar to, but not the same as, NEGATE. |
| 428 |
</para> |
| 429 |
<screen> |
| 430 |
SELECT targetset (NEGATE -1* ("someword") LINK NOT 1 (tag)) ; |
| 431 |
</screen> |
| 432 |
</section> |
| 433 |
|
| 434 |
<section id="keyword-null-section"> |
| 435 |
<title>NULL-SECTION</title> |
| 436 |
<indexterm> |
| 437 |
<primary>NULL-SECTION</primary> |
| 438 |
</indexterm> |
| 439 |
<para> |
| 440 |
Same as SECTION, except it is not actually run. |
| 441 |
Used for containing ANCHOR'ed lists of rules that you don't want run in the normal course of rule application. |
| 442 |
</para> |
| 443 |
</section> |
| 444 |
|
| 445 |
<section id="keyword-options"> |
| 446 |
<title>OPTIONS</title> |
| 447 |
<indexterm> |
| 448 |
<primary>OPTIONS</primary> |
| 449 |
</indexterm> |
| 450 |
<para> |
| 451 |
Global options that affect the grammar parsing. |
| 452 |
</para> |
| 453 |
<screen> |
| 454 |
OPTIONS += no-inline-sets ; |
| 455 |
</screen> |
| 456 |
</section> |
| 457 |
|
| 458 |
<section id="keyword-preferred-targets"> |
| 459 |
<title>PREFERRED-TARGETS</title> |
| 460 |
<indexterm> |
| 461 |
<primary>PREFERRED-TARGETS</primary> |
| 462 |
</indexterm> |
| 463 |
<para> |
| 464 |
If the preferred targets are defined, this will influence SELECT, REMOVE, and IFF rules. |
| 465 |
Normally, these rules will operate until one reading remains in the cohort. |
| 466 |
If there are preferred targets, these rules are allowed to operate until there are no readings left, |
| 467 |
after which the preferred target list is consulted to find a reading to "bring back from the dead" |
| 468 |
and pass on as the final reading to survive the round. |
| 469 |
<emphasis> |
| 470 |
Due to its nature of defying the rule application order, this is bad voodoo. |
| 471 |
I recommend only using this if you know what you are doing. |
| 472 |
</emphasis> |
| 473 |
<emphasis>This currently has no effect in CG-3, but will in the future.</emphasis> |
| 474 |
</para> |
| 475 |
<screen> |
| 476 |
PREFERRED-TARGETS = tag othertag etctag ; |
| 477 |
</screen> |
| 478 |
</section> |
| 479 |
|
| 480 |
<section id="keyword-remcohort"> |
| 481 |
<title>REMCOHORT</title> |
| 482 |
<indexterm> |
| 483 |
<primary>REMCOHORT</primary> |
| 484 |
</indexterm> |
| 485 |
<para> |
| 486 |
If it finds a reading which satisfies the target and the contextual tests, REMCOHORT will |
| 487 |
remove the cohort and all its readings from the current disambiguation window. |
| 488 |
</para> |
| 489 |
<screen> |
| 490 |
REMCOHORT targetset (-1* ("someword")) ; |
| 491 |
</screen> |
| 492 |
</section> |
| 493 |
|
| 494 |
<section id="keyword-remove"> |
| 495 |
<title>REMOVE</title> |
| 496 |
<indexterm> |
| 497 |
<primary>REMOVE</primary> |
| 498 |
</indexterm> |
| 499 |
<para> |
| 500 |
Singles out a reading from the cohort that matches the target, and if all contextual tests are |
| 501 |
satisfied it will delete the mached reading. |
| 502 |
</para> |
| 503 |
<screen> |
| 504 |
REMOVE targetset (-1* ("someword")) ; |
| 505 |
</screen> |
| 506 |
</section> |
| 507 |
|
| 508 |
<section id="keyword-remrelation"> |
| 509 |
<title>REMRELATION</title> |
| 510 |
<indexterm> |
| 511 |
<primary>REMRELATION</primary> |
| 512 |
</indexterm> |
| 513 |
<para> |
| 514 |
Destroys one direction of a relation previously created with either |
| 515 |
<link linkend="keyword-setrelation">SETRELATION</link> or |
| 516 |
<link linkend="keyword-setrelations">SETRELATIONS</link>. |
| 517 |
</para> |
| 518 |
<screen> |
| 519 |
REMRELATION (name) targetset (-1* ("someword")) |
| 520 |
TO (1* (@candidate)) (2 SomeSet) ; |
| 521 |
</screen> |
| 522 |
</section> |
| 523 |
|
| 524 |
<section id="keyword-remrelations"> |
| 525 |
<title>REMRELATIONS</title> |
| 526 |
<indexterm> |
| 527 |
<primary>REMRELATIONS</primary> |
| 528 |
</indexterm> |
| 529 |
<para> |
| 530 |
Destroys both directions of a relation previously created with either |
| 531 |
<link linkend="keyword-setrelation">SETRELATION</link> or |
| 532 |
<link linkend="keyword-setrelations">SETRELATIONS</link>. |
| 533 |
</para> |
| 534 |
<screen> |
| 535 |
REMRELATIONS (name) (name) targetset (-1* ("someword")) |
| 536 |
TO (1* (@candidate)) (2 SomeSet) ; |
| 537 |
</screen> |
| 538 |
</section> |
| 539 |
|
| 540 |
<section id="keyword-replace"> |
| 541 |
<title>REPLACE</title> |
| 542 |
<indexterm> |
| 543 |
<primary>REPLACE</primary> |
| 544 |
<seealso>SUBSTITUTE</seealso> |
| 545 |
</indexterm> |
| 546 |
<para> |
| 547 |
Singles out a reading from the cohort that matches the target, and if all contextual tests are |
| 548 |
satisfied it will remove all existing tags from the reading, then add the listed tags to the reading |
| 549 |
and block further MAP, ADD, or REPLACE rules from operating on the reading. |
| 550 |
</para> |
| 551 |
<screen> |
| 552 |
REPLACE (tags) targetset (-1* ("someword")) ; |
| 553 |
</screen> |
| 554 |
</section> |
| 555 |
|
| 556 |
<section id="keyword-section"> |
| 557 |
<title>SECTION</title> |
| 558 |
<indexterm> |
| 559 |
<primary>SECTION</primary> |
| 560 |
</indexterm> |
| 561 |
<para> |
| 562 |
A section of the grammar that can contain all types of rule and set definition entries. |
| 563 |
</para> |
| 564 |
</section> |
| 565 |
|
| 566 |
<section id="keyword-select"> |
| 567 |
<title>SELECT</title> |
| 568 |
<indexterm> |
| 569 |
<primary>SELECT</primary> |
| 570 |
</indexterm> |
| 571 |
<para> |
| 572 |
Singles out a reading from the cohort that matches the target, and if all contextual tests are |
| 573 |
satisfied it will delete all other readings except the matched one. |
| 574 |
</para> |
| 575 |
<screen> |
| 576 |
SELECT targetset (-1* ("someword")) ; |
| 577 |
</screen> |
| 578 |
</section> |
| 579 |
|
| 580 |
<section id="keyword-set"> |
| 581 |
<title>SET</title> |
| 582 |
<indexterm> |
| 583 |
<primary>SET</primary> |
| 584 |
</indexterm> |
| 585 |
<para> |
| 586 |
Defines a new set based on operations between existing sets. |
| 587 |
</para> |
| 588 |
<screen> |
| 589 |
SET setname = someset + someotherset - (tag) ; |
| 590 |
</screen> |
| 591 |
</section> |
| 592 |
|
| 593 |
<section id="keyword-setchild"> |
| 594 |
<title>SETCHILD</title> |
| 595 |
<indexterm> |
| 596 |
<primary>SETCHILD</primary> |
| 597 |
</indexterm> |
| 598 |
<para> |
| 599 |
Attaches the matching reading to the contextually targetted cohort as the parent. |
| 600 |
The last link of the contextual test is used as target. |
| 601 |
</para> |
| 602 |
<screen> |
| 603 |
SETCHILD targetset (-1* ("someword")) |
| 604 |
TO (1* (step) LINK 1* (candidate)) (2 SomeSet) ; |
| 605 |
</screen> |
| 606 |
</section> |
| 607 |
|
| 608 |
<section id="keyword-setparent"> |
| 609 |
<title>SETPARENT</title> |
| 610 |
<indexterm> |
| 611 |
<primary>SETPARENT</primary> |
| 612 |
</indexterm> |
| 613 |
<para> |
| 614 |
Attaches the matching reading to the contextually targetted cohort as a child. |
| 615 |
The last link of the contextual test is used as target. |
| 616 |
</para> |
| 617 |
<screen> |
| 618 |
SETPARENT targetset (-1* ("someword")) |
| 619 |
TO (1* (step) LINK 1* (candidate)) (2 SomeSet) ; |
| 620 |
</screen> |
| 621 |
</section> |
| 622 |
|
| 623 |
<section id="keyword-setrelation"> |
| 624 |
<title>SETRELATION</title> |
| 625 |
<indexterm> |
| 626 |
<primary>SETRELATION</primary> |
| 627 |
</indexterm> |
| 628 |
<para> |
| 629 |
Creates a one-way named relation from the current cohort to the found cohort. |
| 630 |
The name must be an alphanumeric string with no whitespace. |
| 631 |
</para> |
| 632 |
<screen> |
| 633 |
SETRELATION (name) targetset (-1* ("someword")) |
| 634 |
TO (1* (@candidate)) (2 SomeSet) ; |
| 635 |
</screen> |
| 636 |
</section> |
| 637 |
|
| 638 |
<section id="keyword-setrelations"> |
| 639 |
<title>SETRELATIONS</title> |
| 640 |
<indexterm> |
| 641 |
<primary>SETRELATIONS</primary> |
| 642 |
</indexterm> |
| 643 |
<para> |
| 644 |
Creates two one-way named relation; one from the current cohort to the found cohort, |
| 645 |
and one the other way. The names can be the same if so desired. |
| 646 |
</para> |
| 647 |
<screen> |
| 648 |
SETRELATIONS (name) (name) targetset (-1* ("someword")) |
| 649 |
TO (1* (@candidate)) (2 SomeSet) ; |
| 650 |
</screen> |
| 651 |
</section> |
| 652 |
|
| 653 |
<section id="keyword-sets"> |
| 654 |
<title>SETS</title> |
| 655 |
<indexterm> |
| 656 |
<primary>SETS</primary> |
| 657 |
</indexterm> |
| 658 |
<para> |
| 659 |
<emphasis>Deprecated: has no effect in CG-3.</emphasis> |
| 660 |
A section of the grammar that can contain SET and LIST entries. |
| 661 |
</para> |
| 662 |
</section> |
| 663 |
|
| 664 |
<section id="keyword-soft-delimiters"> |
| 665 |
<title>SOFT-DELIMITERS</title> |
| 666 |
<indexterm> |
| 667 |
<primary>SOFT-DELIMITERS</primary> |
| 668 |
<seealso>DELIMITERS</seealso> |
| 669 |
<seealso>TEXT-DELIMITERS</seealso> |
| 670 |
</indexterm> |
| 671 |
<para> |
| 672 |
Sets a list of soft delimiters. If a disambiguation window is approaching the soft-limit |
| 673 |
(defaults to 300 cohorts), CG-3 will begin to look for a soft delimiter to cut the window after. |
| 674 |
Internally, this is converted to the magic set _S_SOFT_DELIMITERS_. |
| 675 |
</para> |
| 676 |
<screen> |
| 677 |
SOFT-DELIMITERS = "<$,>" ; |
| 678 |
</screen> |
| 679 |
</section> |
| 680 |
|
| 681 |
<section id="keyword-static-sets"> |
| 682 |
<title>STATIC-SETS</title> |
| 683 |
<indexterm> |
| 684 |
<primary>STATIC-SETS</primary> |
| 685 |
</indexterm> |
| 686 |
<para> |
| 687 |
A list of set names that need to be preserved at runtime to be used with |
| 688 |
<link linkend="variable-strings">advanced variable strings</link>. |
| 689 |
</para> |
| 690 |
<screen> |
| 691 |
STATIC-SETS = VINF ADV ; |
| 692 |
</screen> |
| 693 |
</section> |
| 694 |
|
| 695 |
<section id="keyword-strict-tags"> |
| 696 |
<title>STRICT-TAGS</title> |
| 697 |
<indexterm> |
| 698 |
<primary>STRICT-TAGS</primary> |
| 699 |
</indexterm> |
| 700 |
<para> |
| 701 |
A whitelist of allowed tags. |
| 702 |
</para> |
| 703 |
<screen> |
| 704 |
STRICT-TAGS += N V ADJ ; |
| 705 |
</screen> |
| 706 |
</section> |
| 707 |
|
| 708 |
<section id="keyword-substitute"> |
| 709 |
<title>SUBSTITUTE</title> |
| 710 |
<indexterm> |
| 711 |
<primary>SUBSTITUTE</primary> |
| 712 |
<seealso>REPLACE</seealso> |
| 713 |
</indexterm> |
| 714 |
<para> |
| 715 |
Singles out a reading from the cohort that matches the target, and if all contextual tests are |
| 716 |
satisfied it will remove the tags from the search list, then add the listed tags to the reading. |
| 717 |
<emphasis> |
| 718 |
No guarantee is currently made as to where the replacement tags are inserted, but in the future |
| 719 |
the idea is that the tags will be inserted in place of the last found tag from the search list. |
| 720 |
This is a moot point for CG-3 as the tag order does not matter internally, but external tools may |
| 721 |
expect a specific order. |
| 722 |
</emphasis> |
| 723 |
</para> |
| 724 |
<screen> |
| 725 |
SUBSTITUTE (search tags) (new tags) targetset (-1* ("someword")) ; |
| 726 |
</screen> |
| 727 |
</section> |
| 728 |
|
| 729 |
<section id="keyword-switch"> |
| 730 |
<title>SWITCH</title> |
| 731 |
<indexterm> |
| 732 |
<primary>SWITCH</primary> |
| 733 |
<seealso>MOVE</seealso> |
| 734 |
</indexterm> |
| 735 |
<para> |
| 736 |
Switches the position of two cohorts in the window. |
| 737 |
</para> |
| 738 |
<screen> |
| 739 |
SWITCH targetset (-1* ("someword")) WITH (1* ("buffalo")) (-1 ("water")) ; |
| 740 |
</screen> |
| 741 |
</section> |
| 742 |
|
| 743 |
<section id="keyword-target"> |
| 744 |
<title>TARGET</title> |
| 745 |
<indexterm> |
| 746 |
<primary>TARGET</primary> |
| 747 |
</indexterm> |
| 748 |
<para> |
| 749 |
An optional inline keyword put before the target of a rule. |
| 750 |
</para> |
| 751 |
</section> |
| 752 |
|
| 753 |
<section id="keyword-template"> |
| 754 |
<title>TEMPLATE</title> |
| 755 |
<indexterm> |
| 756 |
<primary>TEMPLATE</primary> |
| 757 |
</indexterm> |
| 758 |
<para> |
| 759 |
Sets up templates of alternative contextual tests which can later be referred to by multiple rules |
| 760 |
or templates. |
| 761 |
</para> |
| 762 |
<screen> |
| 763 |
TEMPLATE name = (1 (N) LINK 1 (V)) OR (-1 (N) LINK 1 (V)) ; |
| 764 |
TEMPLATE other = (T:name LINK 1 (P)) OR (1 (C)) ; |
| 765 |
SELECT (x) IF ((T:name) OR (T:other)) ; |
| 766 |
</screen> |
| 767 |
</section> |
| 768 |
|
| 769 |
<section id="keyword-text-delimiters"> |
| 770 |
<title>TEXT-DELIMITERS</title> |
| 771 |
<indexterm> |
| 772 |
<primary>TEXT-DELIMITERS</primary> |
| 773 |
<seealso>DELIMITERS</seealso> |
| 774 |
<seealso>SOFT-DELIMITERS</seealso> |
| 775 |
</indexterm> |
| 776 |
<para> |
| 777 |
Sets a list of non-CG text delimiters. |
| 778 |
If any of the patterns match non-CG text between cohorts, the window will be delimited at that point. |
| 779 |
Internally, this is converted to the magic set _S_TEXT_DELIMITERS_. |
| 780 |
If cmdline flag <code>-T</code> is passed, that will override any pattern set in the grammar. |
| 781 |
</para> |
| 782 |
<screen> |
| 783 |
TEXT-DELIMITERS = /(^|\n)<s/r ; |
| 784 |
</screen> |
| 785 |
</section> |
| 786 |
|
| 787 |
<section id="keyword-to"> |
| 788 |
<title>TO</title> |
| 789 |
<indexterm> |
| 790 |
<primary>TO</primary> |
| 791 |
<seealso>SETPARENT</seealso> |
| 792 |
<seealso>SETCHILD</seealso> |
| 793 |
</indexterm> |
| 794 |
<para> |
| 795 |
An inline keyword put before the contextual target of a SETPARENT or SETCHILD rule. |
| 796 |
</para> |
| 797 |
</section> |
| 798 |
|
| 799 |
<section id="keyword-undef-sets"> |
| 800 |
<title>UNDEF-SETS</title> |
| 801 |
<indexterm> |
| 802 |
<primary>UNDEF-SETS</primary> |
| 803 |
</indexterm> |
| 804 |
<para> |
| 805 |
A list of set names that will be undefined and made available for redefinition. |
| 806 |
See <link linkend="set-manipulation">set manipulation</link>. |
| 807 |
</para> |
| 808 |
<screen> |
| 809 |
UNDEF-SETS = VINF ADV ; |
| 810 |
</screen> |
| 811 |
</section> |
| 812 |
|
| 813 |
<section id="keyword-unmap"> |
| 814 |
<title>UNMAP</title> |
| 815 |
<indexterm> |
| 816 |
<primary>UNMAP</primary> |
| 817 |
<seealso>MAP</seealso> |
| 818 |
</indexterm> |
| 819 |
<para> |
| 820 |
Removes the mapping tag of a reading and lets ADD and MAP target the reading again. |
| 821 |
By default it will only act if the cohort has exactly one reading, but marking the rule UNSAFE |
| 822 |
lets it act on multiple readings. |
| 823 |
</para> |
| 824 |
<screen> |
| 825 |
UNMAP (TAG) ; |
| 826 |
UNMAP UNSAFE (TAG) ; |
| 827 |
</screen> |
| 828 |
</section> |
| 829 |
|
| 830 |
</chapter> |