Overview
Comment: | [doc] syntax update |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | doc |
Files: | files | file ages | folders |
SHA3-256: |
b26524e4781da89601d5c96ad07f8b5d |
User & Date: | olr on 2020-04-13 17:48:05 |
Other Links: | manifest | tags |
Context
2020-04-13
| ||
17:52 | [doc] syntax update check-in: 080bcb8fa0 user: olr tags: trunk, doc | |
17:48 | [doc] syntax update check-in: b26524e478 user: olr tags: trunk, doc | |
11:12 | [doc] syntax update check-in: cdc40fbad0 user: olr tags: trunk, doc | |
Changes
Modified doc/syntax.txt from [1e3f6930d4] to [f8fea95d48].
︙ | ︙ | |||
451 452 453 454 455 456 457 | With the rule B, only the first group is underlined: ying and yang ^^^^ | | > > | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | With the rule B, only the first group is underlined: ying and yang ^^^^ ### Errors and suggestions The command to suggest something is: `->>`. #### Multiple suggestions Use `|` in the replacement text to add multiple suggestions: Example. Foo, FOO, Bar and BAR suggestions for the input word "foo". |
︙ | ︙ | |||
490 491 492 493 494 495 496 497 498 499 500 | <<- ->> ='"' + \1.upper() + '"' # With uppercase letters and quotation marks <<- ~>> =\1.upper() ### Text rewriting Example. Replacing a string by another. Mr. [A-Z]\w+ <<- ~>> Mister | > > > > > < < < | 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | <<- ->> ='"' + \1.upper() + '"' # With uppercase letters and quotation marks <<- ~>> =\1.upper() ### Text rewriting **WARNING**: The replacing text must be shorter than the replaced text or have the same length. Breaking this rule will misplace following error reports. You have to ensure yourself the rules comply with this constraint, the text processor won’t do it for you. The command for text rewriting is: `~>>`. Example. Replacing a string by another. Mr. [A-Z]\w+ <<- ~>> Mister Specific commands for text rewriting: `~>> *` > Replace by whitespaces `~>> @` |
︙ | ︙ | |||
582 583 584 585 586 587 588 589 590 591 592 593 594 595 | (Mrs?)[.] <<- ~>> \1 ### Disambiguation When the grammar checker analyses a token with `morph()`, before requesting the POS tags to the dictionary, it checks if there is a stored marker for the position of the token. If a marker is found, it uses the stored data and don’t make request to the dictionary. There are 4 commands for disambiguation. `select(n, pattern)` > At reference n, select morphologies that match the pattern. `exclude(n, pattern)` | > > | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | (Mrs?)[.] <<- ~>> \1 ### Disambiguation When the grammar checker analyses a token with `morph()`, before requesting the POS tags to the dictionary, it checks if there is a stored marker for the position of the token. If a marker is found, it uses the stored data and don’t make request to the dictionary. Command for disambiguation is: `=>>`. No positioning allowed. There are 4 commands for disambiguation. `select(n, pattern)` > At reference n, select morphologies that match the pattern. `exclude(n, pattern)` |
︙ | ︙ | |||
617 618 619 620 621 622 623 | With `define()` and `add_morph()`, you must set a list of POS tags. Example: =>> define(\1, ["po:nom is:plur", "po:adj is:sing", "po:adv"]) =>> add_morph(\1, ["po:adv"]) ### Tagging | | > > > > > > < < | | | 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | With `define()` and `add_morph()`, you must set a list of POS tags. Example: =>> define(\1, ["po:nom is:plur", "po:adj is:sing", "po:adv"]) =>> add_morph(\1, ["po:adv"]) ### Tagging **Only for token rules**. Tagging can be done with the command `/>>`. You can set one or several tags at once. Use `|` as a separator. Example: `/>> a_tag` to set the same tag on all takens of the rule. Example: `/3>> a_tag` to set the tag on the third token. Example: `/>> a_tag|another_tag` to set two tags. You can know if a token is tagged with eh function `tag()` and you can know if tags have been set on previous or following tokens with `tag_before()` and `tag_after()`. ### Immunity **Only for token rules**. A immunity rule set a flag on token(s) who are not supposed to be considered as an error. If any other rules find an error, it will be ignored. If an error has already been found, it will be removed. Example: `!2>>` means no error can be set on the second token. Example: `!>>` means all tokens will be considered as correct. The immunity rules are useful to create simple antipattern that will simplify writing of other rules. ## OTHER COMMANDS ## |
︙ | ︙ |