Skip to content

Annotate postposed adjectives that do not agree in case; reynir 3.7 compatibility - #69

Merged
vthorsteinsson merged 4 commits into
masterfrom
adj-agreement
Jul 31, 2026
Merged

Annotate postposed adjectives that do not agree in case; reynir 3.7 compatibility#69
vthorsteinsson merged 4 commits into
masterfrom
adj-agreement

Conversation

@vthorsteinsson

Copy link
Copy Markdown
Member

Summary

  • New error annotation P_NT_LoEftirNlMeðAndlagi: flags a postposed adjective (typically a past participle) with a case-governed complement that does not agree with its head noun phrase in case, e.g. "Þórsmörk ehf., móðurfélag Árvakurs hf., útgáfufélags Morgunblaðsins og fleiri félaga tengdum rekstri Morgunblaðsins, tapaði 346 milljónum á síðasta ári." — where "tengdum" should be "tengdra" (genitive, agreeing with "félaga"). This error commonly arises from attraction to the dative complement of the participle. The handler generates a corrected word form via BinPackage lookup_variants(), preserving number, gender and degree while replacing the case. Note that strong/weak declension variants must not be passed to lookup_variants(), as they do not map onto the FSB/FVB inflection marks.
  • Compatibility with reynir >= 3.7: Greynir.__init__() now rejects unknown keyword arguments, so GreynirCorrect filters its own options (one_sent, all_errors, ...) against Greynir._KNOWN_OPTIONS before delegating. Without this, the test suite does not even collect against reynir 3.7.x.

Dependencies

The grammar half of the new rule (VillaLoEftirNlMeðAndlagi in the $if(include_errors) section of Greynir.grammar) lives in GreynirEngine and will arrive with its next release. The handler is inert until then (the nonterminal never occurs in a parse), and the new test skips itself when the installed reynir lacks the rule, so CI stays green against current PyPI reynir.

Test plan

  • Full test suite passes locally (84 tests) against a local GreynirEngine checkout that includes the grammar rule.
  • New test test_adjective_agreement covers: erroneous sentence annotated with the right span/code, correct counterpart not annotated, and the suggestion ("tengdum" → "tengdra").
  • Spot-checked ordinary sentences for false positives (none observed); the error production carries $score(-999) and low priority, so it only participates when no valid parse exists.

🤖 Generated with Claude Code

vthorsteinsson and others added 4 commits July 31, 2026 17:07
Greynir (reynir >= 3.7) raises TypeError on unknown keyword arguments,
so GreynirCorrect's own options (one_sent, all_errors, ...) can no
longer be forwarded to it verbatim. Filter the options against
Greynir._KNOWN_OPTIONS when available.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
New VillaLoEftirNlMeðAndlagi annotation handler for the corresponding
error grammar rule (upcoming in GreynirEngine): a postposed adjective
with a case-governed complement that does not agree with its head
noun phrase in case, e.g. 'móðurfélag fleiri félaga tengdum rekstri
Morgunblaðsins' where 'tengdum' should be 'tengdra'. The suggestion
is generated with BinPackage lookup_variants(), keeping number,
gender and degree while replacing the case. The new test skips when
the installed reynir version lacks the grammar rule.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Drop Python 3.9 and 3.10 from the CI matrix and from the project
metadata; move the ruff/mypy CI gates from 3.9 to 3.11. Also pin the
ruff lint rule selection to the E4/E7/E9/F set, which was ruff's
default selection before version 0.15 — CI installs ruff unpinned,
and the broader default selection of newer ruff versions broke the
lint step with hundreds of stylistic complaints.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Newer transformers versions have pipeline() overloads that mypy
cannot match for this call; the result is assigned to Any anyway.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vthorsteinsson
vthorsteinsson merged commit e46db33 into master Jul 31, 2026
10 checks passed
@vthorsteinsson
vthorsteinsson deleted the adj-agreement branch July 31, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant