Skip to content

Commit 3a6e05f

Browse files
committed
📝 Doc how we use co&error to avoid a reading matching LIST Errors
1 parent af919a2 commit 3a6e05f

File tree

1 file changed

+42
-11
lines changed

1 file changed

+42
-11
lines changed

README.md

+42-11
Original file line numberDiff line numberDiff line change
@@ -890,15 +890,16 @@ cohort. There is no way from this output to know that "dego" should
890890
not also be deleted from the `SUGGEST` reading.
891891

892892
So when there are such multiple alternative interpretations for errors
893-
spanning multiple words, the less central parts ("dego" above) need a
894-
"co-error tag" (using `co&` as a prefix instead of `&`) to say which
895-
error tag goes with which non-central reading.
893+
spanning multiple words, the less central parts ("dego" above) also
894+
need a matching error tag to say which error tag goes with which
895+
non-central or suggestion reading. We often use the `co&` prefix
896+
instead of `&` which indicates that this is not the main reading of
897+
the complex error:
896898

897899
ADD (co&syn-not-dego) ("dego") IF (1 (&syn-not-dego));
898900

899-
Without the `co`, this would be treated as a separate error, while
900-
without `&syn-not-dego`, we would suggest deleting this word in
901-
the suggestions for `&syn-dego-nom` too.
901+
Without `co&syn-not-dego`, we would suggest deleting "dego" in the
902+
suggestions for `&syn-dego-nom` too.
902903

903904
By using `co&error-tags`, we can have multiple alternative
904905
interpretations of an error, while avoiding generating bad
@@ -965,6 +966,20 @@ In this sentence in South Sámi there are two alternative suggestions:
965966
Here too, we need to ensure that there are `co&errortags` to match
966967
relations to readings.
967968

969+
Often we change all `&error` tags to `co&error` tags at the end of a
970+
rule section:
971+
972+
```
973+
SUBSTITUTE (&syn-kánske) (co&syn-kánske) TARGET (SUGGEST) ;
974+
MAP:LOCK_READING (SUGGEST) (SUGGEST); # avoid rules looping
975+
```
976+
977+
This is so we can have a
978+
`LIST Errors = &syn-kánske &syn-soahtit-vfin+inf &etc; `
979+
that will not match the suggestions (the
980+
suggestions are correct, so they should not be matched by the `Errors`
981+
set).
982+
968983

969984
## Avoiding mismatched words in multiple suggestions on ambiguous readings
970985

@@ -1281,6 +1296,19 @@ but is recommended in case we can have several error types and need to
12811296
keep replacements separate (to avoid silly combinations of
12821297
suggestions).
12831298

1299+
Another use for the `co&errtag` is to have a way to relate corrected
1300+
`SUGGEST` readings within complex errors, without the correct reading
1301+
being matched by sets which look for error tags. For example, say that
1302+
you have a `LIST Errors = &missing &typo …;` and a rule which looks
1303+
for an error-tagged pronoun to the left `(-1 Pron + Errors)`. Now
1304+
earlier in the grammar checker rules you may have added a new
1305+
suggestion cohort with a reading `Pron SUGGEST` – if you gave that
1306+
reading the tag `&missing` to relate it to the central word, the
1307+
context `(-1 Pron + Errors)` would match, which is probably not what
1308+
you want. But if you instead give the suggestion the tag `co&missing`,
1309+
then you can rely on tags like `&missing` being only on actual
1310+
mistakes in the input.
1311+
12841312
When we have a `DELETE` relation from a reading with an `&errtag` and
12851313
there are be multiple source-cohort error tags, the deletion target
12861314
needs to have a `co&errtag`, so that we only delete in the replacement
@@ -1355,11 +1383,14 @@ don't conflict with the below special tags.
13551383
See [Including spelling errors](#org26182db).
13561384
- `<spelled>` is added by `divvun-cgspell` to any suggestions it
13571385
makes. See [Including spelling errors](#org26182db).
1358-
- `co&` is a tag prefix – `co&` marks a reading as a non-central
1359-
part of the underline of `&errtag`, see [Deleting words](#org4d2c8ef)
1360-
and related sections. (You may also see `COERROR &errtag` or `&LINK
1361-
&errtag` in older rules; this was the old way of writing
1362-
`co&errtag`.)
1386+
- `co&` is a tag prefix – `co&` is often used to mark a reading as a
1387+
non-central part of the underline of `&errtag`, see [Deleting
1388+
words](#org4d2c8ef) and related sections. (You may also see
1389+
`COERROR &errtag` or `&LINK &errtag` in older rules; this was the
1390+
old way of writing `co&errtag`.) We also often add `co&` error
1391+
tags to `SUGGEST` readings in order to relate a suggestion to a
1392+
complex error without that (correct) reading being matched by sets
1393+
which match error readings.
13631394
- `&ADDED` means this cohort was added (typically with `ADDCOHORT`)
13641395
and should be a part of the suggestion for the error. It will appear
13651396
after the blank of the preceding cohort, and will not be the central

0 commit comments

Comments
 (0)