Skip to content

Fix Polish agreement for men's plural nouns - #502

Merged
bartekplus merged 11 commits into
masterfrom
fix/polish-virile-adjective-agreement
Oct 13, 2026
Merged

bartekplus merged 11 commits into
masterfrom
fix/polish-virile-adjective-agreement

Conversation

@bartekplus

@bartekplus bartekplus commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

What changed

polishCaseAgreement, adjective + noun (adjectiveClash in agreement.ts)

  • A soft-stem adjective in its masculine form ("nastoletni", "ostatni") now agrees with a men's nominative plural noun. This form is also the men's plural.
  • An "-e" adjective before a men's nominative plural is now an error ("nastoletnie synowie"). The fix is the men's form from virileAdjective.
  • Ambiguous adjective forms ("nowe", "dobre") are checked in this one case only. Before, the check skipped them always.
  • With no preposition, a locative reading cannot be: "różne ludzie" is flagged although "ludzie" is also the locative of "lud".

polishCaseAgreement, subject + verb and predicate (subjects.ts)

  • pluralSubjects: a noun is a men's subject only when menOnlyPlural is true. Before, "Kolejne metry były trudne" got "byli".
  • predicateAdjectives: "Praktyki były trudni" is now flagged ("trudne"). "Powody byli ważne" no longer gets "ważni", because the verb is the error there.

New menOnlyPlural(word) in lexicon.ts

  • The lexicon merges the tags of nouns with the same spelling, so the men's tag of "praktyk", "powód" and "metr" also marks "praktyki", "powody" and "metry".
  • menOnlyPlural is true only when every noun that reads the word as a nominative plural names men, and the word has a men's-plural shape (-owie, -cy, -rzy, -dzy, -e, or -i not after k/g).

Run-on predicate (runOn in agreement.ts)

  • A pair after a copula (or "się", optionally with a degree word) is skipped when a verb follows the noun: "Zadania były trudne uczniowie narzekali" has a missing comma, not an agreement error. "To są nowe studenci" has no verb after the noun and is still flagged.

New check: adjective before a genitive-only object (genitiveObjectAdjectives)

  • "verb + adjective + noun" where the noun has only genitive readings. The existing verb lists tell which word to change:
    • accusative verb (NEGATED_VERBS): the noun, "Widzę czyste talerzy" → "czyste talerze"; for a man's noun the adjective, "brudne żołnierzy" → "brudnych żołnierzy";
    • partitive verb ("kupić", "jeść", "pić", "brać", "chcieć"): both fixes;
    • genitive verb (GENITIVE_VERBS) or a negated verb: the adjective, "Szukam czyste talerzy" → "czystych talerzy".
  • Adjectives that govern the genitive (pełny, pozbawiony, warty, …) and ambiguous adjective forms are not checked. Thus "Kupiłem nowe talerzy" is still not flagged ("nowe" is ambiguous, like "dane" in "Mam dane klientów").

Older bugs found on the way (separate commits)

  • Lexicon generator: the "-rzy" form of "-rz" nouns is the genitive plural ("żołnierzy", "harcerzy", "talerzy"), not the nominative. Before, master flagged "Widziałem polskich żołnierzy." and offered "polskie żołnierzy".
  • "lutego" (February) was read as the adjective "luty" (fierce): "15 lutego uczniowie wrócili" got "lute uczniowie".

False alarms found by a scan of real text (separate commits)

  • Adjectives used as nouns, with a genitive after them: "dla podopiecznych trenera" got "podopiecznego trenera". The dictionary does not mark these adjectives as nouns, so a list (NOMINAL_ADJECTIVES) names the common ones: podopieczny, znajomy, bliski, oskarżony, przełożony, dany, średni, pochodny, …
  • "o szóstej rano" (no fix): "rano" is now also a non-noun.
  • "na poniższym wideo" → "poniższe wideo", "w polskim show": the dictionary declines these loans like native nouns. "wideo", "show" and "kakao" now read in every case.
  • "przedstawione krok po kroku" → "przedstawiony krok": a pair before "po" + a form of the same noun ("dzień po dniu") is skipped.
  • "z ogarniętej wojną Ukrainy" → "ogarniętą wojną": a passive participle before an instrumental-only noun (its agent) is skipped.

Before and after

Text master This PR
nastoletni synowie → nastoletnie synowie no finding
Ostatni goście wyszli. → Ostatnie goście no finding
Nowy synowie → Nowe synowie → Nowi synowie
Nastoletnie synowie no finding → Nastoletni synowie
Nowe studenci / Dobre lekarze no finding → Nowi studenci / Dobrzy lekarze
Różne ludzie no finding → Różni ludzie
Praktyki były trudni. no finding → trudne
Powody byli ważne. → ważni no finding
Kolejne metry były trudne. → byli no finding
Widziałem polskich żołnierzy. → polskie żołnierzy no finding
15 lutego uczniowie wrócili. → lute uczniowie no finding
Zadania były trudne uczniowie narzekali. → trudni uczniowie no finding
Widzę czyste talerzy. no finding → czyste talerze
Mam prezenty dla podopiecznych trenera. → podopiecznego trenera no finding
Wstaję o szóstej rano. / Zobacz na poniższym wideo. flagged no finding
przedstawione krok po kroku / z ogarniętej wojną Ukrainy flagged no finding
Szukam czyste talerzy. / Nie mam czyste talerzy. no finding → czystych talerzy

How I checked the false-alarm risk

  1. On the bigrams of the shipped Polish n-gram data (HPLT), the "-e adjective + men's noun" pairs that each test flags:

    Men's-noun test Frequent pairs flagged Real errors
    Merged men's tag 55 ("najlepsze praktyki", "ważne powody", …) about 0
    All readings are men's 11 ("główne powody", "kolejne metry", …) 0
    menOnlyPlural (all readings + shape) 0 —
  2. I ran the real detector on all 3,335 frequent bigrams that end in a men's plural, on master, the PR before this round, and this PR. The ambiguous-adjective, locative and predicate changes add no findings. The lexicon and "lutego" fixes take the count from 34 to 9. The 9 that remain come from the test frame, or they are real errors ("kolejny uczniowie").

  3. I ran the real detector on the 16,771 n-gram sequences (3 and 4 words) that have an adjective before a genitive noun. The new check gives no findings. The 2 findings there are older and also on master.

  4. I ran the real detector on all 37,784 n-gram sequences that have an adjective before a noun. Before the scan fixes, it gave 60 agreement findings. After them, the remaining findings are n-gram artifacts (lowercased names such as "europie", cut-off phrases such as "krok."), real typos ("z cała pewnością", "za wszelka cenę") or colloquial "tą" for "tę".

Notes for the reviewer

  • "Kupiłem nowe talerzy" is no longer flagged. Before, it was flagged only because "talerzy" was tagged as a nominative.
  • Tests: new cases in tests/grammar/ReviewPolishAgreement.test.ts. bun run check, bun run test, bun run test:e2e and check:e2e:coverage pass.

🤖 Generated with Claude Code

The agreement check read a soft-stem adjective ("nastoletni", "ostatni")
only as the masculine singular. This form is also the men's plural, so
the check flagged correct phrases such as "nastoletni synowie" and
"ostatni goście".

For a men's plural noun, the check also gave the "-e" form as the fix
("nowe synowie"). It now gives the men's form ("nowi synowie").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

The agreement check accepted "nastoletnie synowie", because the "-e"
plural agrees with any plural noun. It now flags "-e" before a men's
nominative plural and gives the men's form ("nastoletni synowie").

The lexicon merges the tags of nouns with the same spelling, so the
men's tag of "praktyk", "powód" or "metr" also marks "praktyki",
"powody" and "metry". The new menOnlyPlural helper is true only when
every noun that reads the word as a nominative plural names men and the
word has a men's-plural shape. On the Polish n-gram bigrams it flags
none of the frequent correct pairs ("najlepsze praktyki",
"ważne powody").

The subject-verb check now uses the same helper. Before, it changed
"Kolejne metry były trudne" to "byli".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bartekplus bartekplus changed the title Fix Polish agreement false alarm on men's plural adjectives Fix Polish agreement for men's plural nouns Oct 13, 2026
bartekplus and others added 9 commits October 13, 2026 22:24
The dictionary flag "s" adds "-y" to a stem ("dom" -> "domy"), and the
lexicon generator read every such form as a nominative plural. After a
"-rz" stem the "-y" form is the genitive plural ("żołnierzy",
"harcerzy", "talerzy"); the nominative is "-rze".

Thus the agreement check flagged "Widziałem polskich żołnierzy." and
offered "polskie żołnierzy".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"lutego" and "lutym" are forms of the month (February) and of the
adjective "luty" (fierce). The agreement check read them as the
adjective, so "15 lutego uczniowie wrócili" got the fix "lute
uczniowie".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The agreement check skipped every adjective form that another word also
spells ("nowe", "dobre"), so "nowe studenci" and "dobre lekarze" were
not flagged. It now checks these forms in one case only: "-e" before a
noun that menOnlyPlural reads as a men's plural. It also flags
"różne ludzie": with no preposition, the locative reading of "ludzie"
("o ludzie") cannot be.

The predicate-adjective check used the merged men's tag of its subject:
- "Praktyki były trudni" was skipped, because "praktyki" looked like
  men's. It now gives "trudne".
- "Powody byli ważne" gave "ważni", but the verb is the error. A
  masculine subject now counts as men's only with a men's-plural shape.

The real detector, run on 3,335 frequent bigrams that end in a men's
plural, gives no new findings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Zadania były trudne uczniowie narzekali" has a missing comma: the
adjective ends the clause of "były" and "uczniowie" opens the next. The
agreement check read "trudne uczniowie" as one phrase and offered
"trudni uczniowie".

A pair after a copula (or "się", optionally with a degree word) is now
skipped when a verb follows the noun. "To są nowe studenci" has no verb
after the noun and is still flagged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Widzę czyste talerzy" was not flagged: the agreement check skips a noun
with a genitive reading, because some adjectives govern the genitive
("pełne wody"). A new check reads "verb + adjective + noun" when the
noun has only genitive readings. The verb lists that already exist
tell which word to change:

- an accusative verb (NEGATED_VERBS): the noun, "czyste talerze";
  for a man's noun the adjective, "brudnych żołnierzy";
- a partitive verb ("kupić", "jeść", "pić", "brać", "chcieć"): both;
- a genitive verb (GENITIVE_VERBS) or a negated one: the adjective,
  "czystych talerzy".

Adjectives that govern the genitive (pełny, pozbawiony, warty, …) and
ambiguous adjective forms ("nowe", "dane") are not checked. On 16,771
n-gram sequences of real text the check gives no findings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"dla podopiecznych trenera" ("for the coach's wards") was flagged with
the fix "podopiecznego trenera". After a preposition, an adjective used
as a noun and its genitive attribute look like a pair that does not
agree. The dictionary does not mark these adjectives as nouns, so a
list now names the common ones: people ("podopieczny", "znajomy",
"bliski", "oskarżony", "przełożony") and terms ("dany", "średni",
"pochodny"). With such an adjective, a noun with a genitive reading
after it is no clash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dictionary lists "rano" only as a noun and declines the loans
"wideo", "show" and "kakao" like native nouns. Thus the lexicon read
"wideo" only as a nominative or accusative, and the agreement check
flagged correct text:

- "o szóstej rano" (no fix);
- "na poniższym wideo" -> "poniższe wideo";
- "w polskim show" (no fix).

"rano" is now also a non-noun, and the three loans read in every case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Wszystko zostało przedstawione krok po kroku" was flagged with the fix
"przedstawiony krok". "krok po kroku", "dzień po dniu" and "słowo po
słowie" are adverbial phrases, so the noun is not the adjective's. A
pair is now skipped when "po" and a form of the same noun follow it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Uciekli z ogarniętej wojną Ukrainy" was flagged with the fix
"ogarniętą wojną". After "z", the participle "ogarniętej" is genitive
and "wojną" is the instrumental of its agent, not its noun. A passive
participle before an instrumental-only noun is now no clash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bartekplus
bartekplus merged commit 6001564 into master Oct 13, 2026
13 checks passed
@bartekplus
bartekplus deleted the fix/polish-virile-adjective-agreement branch October 13, 2026 21:09
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