Grammalecte  Diff

Differences From Artifact [9d8b7e574a]:

To Artifact [ae64accd19]:


354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
`tag(n, tag)`

>   Returns True if <tag> exists on taken the nth token.

`tag_before(n, tag)`

>   Returns True if <tag> is found any token before the nth tag.
   
`tag_after(n, tag)`

>   Returns True if <tag> is found any token after the nth tag.

### Functions for regex and token rules

`__also__`







|







354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
`tag(n, tag)`

>   Returns True if <tag> exists on taken the nth token.

`tag_before(n, tag)`

>   Returns True if <tag> is found any token before the nth tag.

`tag_after(n, tag)`

>   Returns True if <tag> is found any token after the nth tag.

### Functions for regex and token rules

`__also__`
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
    =>> exclude(\1, "po:verb")
    =>> exclude(\1, "po:verb") and define(\2, ["po:adv"]) and select(\3, "po:adv")

Note: All these functions ALWAYS return True.

If `select()` and `exclude()` generate an empty list, nothing change.

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.







|


|







617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
    =>> exclude(\1, "po:verb")
    =>> exclude(\1, "po:verb") and define(\2, ["po:adv"]) and select(\3, "po:adv")

Note: All these functions ALWAYS return True.

If `select()` and `exclude()` generate an empty list, nothing change.

With `define()` and `addmorph()`, you must set a list of POS tags. Example:

    =>> define(\1, ["po:nom is:plur", "po:adj is:sing", "po:adv"])
    =>> addmorph(\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.
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679

    DEF: name definition

Usage: `{name}` will be replaced by its definition

Example:

    DEF: word_3_letters     \w\w\w+  
    DEF: uppercase_token    ~^[A-Z]+$
    DEF: month_token        [January|February|March|April|May|June|July|August|September|October|November|december]

    ({word_3_letters}) (\w+) <<- condition ->> suggestion     && message|URL

    {uppercase_token} {month_token}
        <<- condition ->> message                             && message|URL







|







665
666
667
668
669
670
671
672
673
674
675
676
677
678
679

    DEF: name definition

Usage: `{name}` will be replaced by its definition

Example:

    DEF: word_3_letters     \w\w\w+
    DEF: uppercase_token    ~^[A-Z]+$
    DEF: month_token        [January|February|March|April|May|June|July|August|September|October|November|december]

    ({word_3_letters}) (\w+) <<- condition ->> suggestion     && message|URL

    {uppercase_token} {month_token}
        <<- condition ->> message                             && message|URL