Annotate postposed adjectives that do not agree in case; reynir 3.7 compatibility - #69
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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 BinPackagelookup_variants(), preserving number, gender and degree while replacing the case. Note that strong/weak declension variants must not be passed tolookup_variants(), as they do not map onto the FSB/FVB inflection marks.Greynir.__init__()now rejects unknown keyword arguments, soGreynirCorrectfilters its own options (one_sent,all_errors, ...) againstGreynir._KNOWN_OPTIONSbefore delegating. Without this, the test suite does not even collect against reynir 3.7.x.Dependencies
The grammar half of the new rule (
VillaLoEftirNlMeðAndlagiin the$if(include_errors)section ofGreynir.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
test_adjective_agreementcovers: erroneous sentence annotated with the right span/code, correct counterpart not annotated, and the suggestion ("tengdum" → "tengdra").$score(-999)and low priority, so it only participates when no valid parse exists.🤖 Generated with Claude Code