Grammalecte  Diff

Differences From Artifact [ae64accd19]:

To Artifact [27f6e428ae]:


343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369

`morph(n, "regex"[, "neg_regex"][, trim_left=0][, trim_right=0])`
`analyse(n, "regex"[, "neg_regex"][, trim_left=0][, trim_right=0])`

>   Same action with `morph()` and `morph0()` for regex rules.
>   Parameters <trim_left> and <trim_right> removed n characters at left or the right of the token before performing an analyse.

`space_after(n, min_space[, max_space])`

>   Returns True if the next token after token n is separated with at least <min_space> blank spaces and at most with <max_space> blank spaces.

`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__`








|







|



|







343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369

`morph(n, "regex"[, "neg_regex"][, trim_left=0][, trim_right=0])`
`analyse(n, "regex"[, "neg_regex"][, trim_left=0][, trim_right=0])`

>   Same action with `morph()` and `morph0()` for regex rules.
>   Parameters <trim_left> and <trim_right> removed n characters at left or the right of the token before performing an analyse.

`space(n, min_space[, max_space])`

>   Returns True if the next token after token n is separated with at least <min_space> blank spaces and at most with <max_space> blank spaces.

`tag(n, tag)`

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

`tagbefore(n, tag)`

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

`tagafter(n, tag)`

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

### Functions for regex and token rules

`__also__`

599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644

>   At reference n, select morphologies that match the pattern.

`exclude(n, pattern)`

>   At reference n, exclude morphologies that match the pattern.

`define(n, [morph_list])`

>   At reference n, set the listed morphologies (a list of strings).

`add_morph(n, [morph_list])`

>   At reference n, add the listed morphologies (a list of strings).

Examples:

    =>> select(\1, "po:noun is:pl")
    =>> 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.
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.







|

|

|

|





|







|
|









|







599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644

>   At reference n, select morphologies that match the pattern.

`exclude(n, pattern)`

>   At reference n, exclude morphologies that match the pattern.

`define(n, morph_list as string)`

>   At reference n, set the listed morphologies.

`addmorph(n, morph_list as string)`

>   At reference n, add the listed morphologies.

Examples:

    =>> select(\1, "po:noun is:pl")
    =>> 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.
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 `tagbefore()` and `tagafter()`.

### 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.