Skip to content

Fix seven parse coverage gaps; add error rule for non-agreeing postposed adjectives - #68

Merged
vthorsteinsson merged 3 commits into
masterfrom
fix/parse-coverage
Jul 31, 2026
Merged

Fix seven parse coverage gaps; add error rule for non-agreeing postposed adjectives#68
vthorsteinsson merged 3 commits into
masterfrom
fix/parse-coverage

Conversation

@vthorsteinsson

@vthorsteinsson vthorsteinsson commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary

Seven parse coverage fixes, each motivated by a real-world sentence that failed to parse, plus one new error-grammar rule for GreynirCorrect.

Parse fixes (each with a regression test)

  1. Phrases.conf — impersonal passive "er bent á" + NP: the [ambiguous_phrases] rule "vera* bent á" so so ao stripped the preposition meaning of "á", so "Í skýrslunni er bent á kostina" could not parse. Now so so fs/ao, matching sibling rules like "tala* við" so fs/ao.
  2. bintokenizer — uninflected foreign names in genitive position: BÍN gives e.g. "Paul" only nf/þf/þgf (ef is "Pauls"), so "Samtök Paul Watson" had no genitive reading. Names with identical forms in all of nf/þf/þgf now also receive an ef interpretation. Inflecting Icelandic names are unaffected ("Samtök Guðmundur Jónsson" still correctly fails, which matters for GreynirCorrect).
  3. Grammar — role complement in relative clauses: SamanburðurNl? added to EinSetningÁnF, enabling "...sem starfar sem sérfræðingur hjá Eflingu".
  4. Grammar — oblique subject + perfect infinitive under segja/telja: two new SagnarBotn alternatives mirroring the finite SetningAukafall patterns, enabling "segir Spáni hafa mistekist að..." (mm route) and "segir mig hafa dreymt vel" (subj route).
  5. Grammar — postposed "vegna": new FsVegnaEftirNl → Nl_ef 'vegna:fs'_ef in FsMeðFallstjórn, enabling "sýningarinnar vegna", "mín vegna". Previously such phrases only "parsed" via a bogus adjective reading of "vegna".
  6. Grammar — pronoun + agreeing adjective NP: Pfn LoEftirNl alternative in NlStak_p3, enabling "með hann fremstan í fararbroddi".
  7. Grammar — designation numerals: new NúmerTala alternative in Númer, enabling an uninflected neuter nominative numeral as a designation after a noun: "í umdæmi lögreglustöðvar tvö", "stofa fimm". Score-penalized so agreeing numerals ("mennina þrjá") are still preferred wherever agreement is possible.

Error grammar rule (separate commit)

VillaLoEftirNlMeðAndlagi in the $if(include_errors) section: flags a postposed adjective with a case-governed complement that does not agree with its head NP in case ("móðurfélag fleiri félaga tengdum rekstri" → "tengdra"). The annotation handler and a guarded test are already merged in GreynirCorrect (mideind/GreynirCorrect#69); the handler is inert until this rule ships in a reynir release.

Test plan

  • Full suite passes: 135 tests (seven new test functions in test_parse.py, most with exact flat-tree assertions, also exercised via test_no_multiply_numbers.py).
  • ruff check src/reynir and mypy src/reynir both clean.
  • GreynirCorrect's suite (84 tests) passes against this branch, including the new test_adjective_agreement.

Known issue (not addressed here)

A separate reducer-level attachment issue was diagnosed with the same source sentence as fix 7: in "...í umdæmi lögreglustöðvar tvö, sem sér um Hafnarfjörð og Garðabæ", the um-PP attaches to the main clause instead of inside the relative clause when the main verb is e.g. "eiga"/"lesa" (correct for "gerast"/"verða"/"búa"/"gefa"). The correct derivation exists in the forest and receives the verb-preposition bonus; a structural score difference > 40 points overrides it. Needs reducer score tracing; to be investigated separately.

🤖 Generated with Claude Code

vthorsteinsson and others added 3 commits July 31, 2026 17:47
- Phrases.conf: the "vera* bent á" ambiguous phrase forced 'á' to be
  an adverb, making the impersonal passive "er bent á" + Nl unparseable;
  now fs/ao ("Í skýrslunni er bent á kostina")
- bintokenizer: non-inflecting (foreign) person names, with identical
  forms in nf/þf/þgf, now also get an ef interpretation, so they work
  as genitive qualifiers ("Samtök Paul Watson"); inflecting Icelandic
  names are unaffected
- Grammar: allow a SamanburðurNl ("sem" + Nl_nf role complement)
  inside subject-gap relative clauses ("...sem starfar sem
  sérfræðingur hjá Eflingu")
- Grammar: allow an oblique subject with a perfect infinitive in the
  complement of segja/telja/álíta ("segir Spáni hafa mistekist að...",
  "segir mig hafa dreymt vel")
- Grammar: support the postposed order genitive-Nl + "vegna"
  ("sýningarinnar vegna", "mín vegna") as a prepositional phrase;
  previously only misparsed as an adjective
- Grammar: allow a personal pronoun followed by an agreeing adjective
  phrase as a noun phrase ("með hann fremstan í fararbroddi")

Each fix has a regression test in test_parse.py, mostly with exact
flat-tree assertions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
New VillaLoEftirNlMeðAndlagi rule in the $if(include_errors) section,
used by GreynirCorrect: matches 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. 'móðurfélag fleiri félaga
tengdum rekstri Morgunblaðsins' where 'tengdum' should be 'tengdra'.
The corresponding annotation handler is in GreynirCorrect PR #69
(already merged; the handler is inert until this rule ships).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
An uninflected neuter nominative numeral used as a designation
('lögreglustöð tvö', 'stofa fimm', 'hlið átta') had no grammar
production; digit forms only parsed via a spurious genitive reading.
Added a NúmerTala alternative to the Númer slot in NlKjarni, with a
score penalty so that agreeing numerals ('mennina þrjá') are still
preferred wherever agreement is possible.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vthorsteinsson vthorsteinsson changed the title Fix six parse coverage gaps; add error rule for non-agreeing postposed adjectives Fix seven parse coverage gaps; add error rule for non-agreeing postposed adjectives Jul 31, 2026
@vthorsteinsson
vthorsteinsson merged commit add11a8 into master Jul 31, 2026
8 checks passed
@vthorsteinsson
vthorsteinsson deleted the fix/parse-coverage branch July 31, 2026 18:29
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