Skip to content

Release 4.2.0 - #93

Merged
vthorsteinsson merged 1 commit into
masterfrom
release-4.2.0
Nov 26, 2026
Merged

vthorsteinsson merged 1 commit into
masterfrom
release-4.2.0

Conversation

@vthorsteinsson

Copy link
Copy Markdown
Member

Version bump to 4.2.0, with a CLAUDE.md backlog update. The work itself is already on master: #87 (no PyPy wheels for x86_64 macOS), #88 (filelock 4.2.1, glock removed), #89 (documentation build), #90 (question clauses, prepositional phrases, subjects of subordinate clauses, "á"), #91 (names) and #92 (the head noun of a noun phrase). This PR only prepares the release.

4.1.0 against this branch

4.1.0 4.2.0
News sample: unparsed of 5,000 404 346
News sample: trees that differ 1,148
Development set: labelled bracket F1 0.7287 0.7462
Development set: all brackets right 407 459
Development set: PPs in the gold standard's place 3,965 of 5,841 (67.9%) 4,475 of 6,127 (73.0%)
Test set (held out): labelled bracket F1 0.7633 0.7760
Test set: all brackets right 65 72
Test set: PPs in the gold standard's place 451 of 624 (72.3%) 480 of 642 (74.8%)
1,000 news sentences, warm pass 1.58 s 1.69 s
1,000 news sentences, first pass 2.57 s 2.69 s

4.1.0 was measured from a worktree of the tag with its own environment. The speed figures are from benchmarks/bench_parse.py, run twice for each version with the same result; 14 more of the 1,000 sentences parse with 4.2.0. The core takes 0.65 s of the warm pass, against 0.63 s, so most of the difference is outside it. It has not been profiled; this is in the backlog.

Checks

  • This branch: ruff check, mypy and uv lock --check are clean. The suite passes on CPython 3.14 (173 passed, 1 skipped), also with GREYNIR_MATCHING_PARITY=1 GREYNIR_REDUCER_PARITY=1; on free-threaded 3.14t (174 passed), also with --parallel-threads=8; on CPython 3.10 and on PyPy 3.11.
  • The two reducers agree on 2,500 sentences of the news sample (0 mismatches, in matching as well).
  • Wheel workflow: run on a test tag at the head of this branch (since deleted). All 18 wheels were built, installed and used to parse a sentence: abi3, cp314t and cp315t on Linux x86_64, Windows AMD64, and macOS x86_64 and arm64, and PyPy 3.11 for PyPy 7.3 and 8.0 on all of those but x86_64 macOS. The sdist was built, and publishing was skipped.
  • Source distribution: contains NounPredicates.conf, the new NounPrepositions.conf and both C++ files, and has no glock.py. Installed from source into a clean free-threaded 3.14t environment, it compiles, generates the grammar and parses with the GIL off.
  • Dependencies: Tokenizer 3.7.0, BinPackage 2.1.0 and cffi 2.1.1 in uv.lock are the current releases.

Packages that use this one

Both were run against a wheel of this branch, and against 4.1.0 as a baseline. Neither breaks, but each has one or two expectations that depend on a tree that has changed.

  • GreynirCorrect (master, 4.2.0): 86 of 88 tests pass (88 with reynir 4.1.0). It requires reynir>=3.7.0 with no upper bound, so its users get these changes with a fresh install:
    • "Ég keypti þetta út í búð" no longer gets P_DIR_LOC. The pattern looks for the phrase inside the object, VP > { VP > { %verb } NP > { PP > ... } }, where 4.1.0 hung it on "þetta". It now hangs on the verb, which is right, so the pattern needs a variant with the PP directly in the VP.
    • "Ég hugsa ekki um hvað Bretland gerir né hvað Ísland gerir" gets P_Né instead of P_NT_Né, at the same token and with the same text. The two question clauses are now joined; 4.1.0 had no sensible tree for the sentence.
  • GreynirServer (master): 106 of 107 tests pass (107 with reynir 4.1.0, which its lock file pins, so nothing changes there until it is upgraded). test_entities expects the definition ("Fosshótel", "var", "rekin með tapi") from "Fosshótel, stór hótelkeðja, var rekin með tapi í fyrra". "með tapi" was inside the NP-PRD and now hangs on the verb phrase, as it already did in simple sentences ("Hún er stolt af honum"), so the definition lacks "með tapi".

Against the gold standard, the phrases after an adjective that changed place are about even: 10 moved away from where the gold standard has them ("sýknaðir af kröfu", "líklegri til að ...") and 8 moved to it ("áfrýjað til Hæstaréttar", "aðskilin frá foreldrum sínum").

After the merge

Tagging 4.2.0 on master starts the wheel workflow, which publishes to PyPI. The release notes below are for the GitHub release of that tag.

Draft release notes for the 4.2.0 GitHub release

Highlights

More sentences parse, and more of them parse right. This release is about the quality of the trees. Two measurements, each made with 4.1.0 and with 4.2.0:

4.1.0 4.2.0
News sentences that do not parse (a fixed sample of 5,000 from 2026) 404 (8.1%) 346 (6.9%)
Gold standard, test set: labelled bracket F1 0.763 0.776
Gold standard, test set: prepositional phrases in the gold standard's place 72.3% 74.8%
Gold standard, test set: sentences with every bracket right 65 72
Gold standard, development set: labelled bracket F1 0.729 0.746
Gold standard, development set: prepositional phrases in the gold standard's place 67.9% 73.0%

The gold standard is the hand-corrected part of GreynirCorpus. The changes were tuned on its development set (4,239 sentences) and the test set (455 sentences) was held out, so the test figures are the ones to go by. The figures are a baseline to follow over time, not an error rate: part of the difference from the gold standard is convention.

The public API is unchanged. The trees are not: about one news sentence in four gets a different tree (see Upgrading).

Changes

Prepositional phrases

The largest single kind of difference from the gold standard was a prepositional phrase attached in the wrong place.

  • Nouns that take a preposition. A phrase attached to a noun phrase gets a bonus if the head noun takes its preposition ("áhrif á", "þátttaka í"). The nouns are in NounPredicates.conf, which was not read before, and in a new generated table, NounPrepositions.conf (about 6,600 entries, from a million parsed news sentences and the development set). A strong entry outweighs a verb that lists the same preposition ("hafa áhrif á"); an entry marked $weak does not ("Hún setti bókina í hillu" keeps its phrase on the verb).
  • The head noun is the one that counts, as it is read in the tree. It need not stand directly before the phrase ("áhrif stjórnvalda á málið"), and a word that is only a noun in another reading gives nothing ("áttað sig á því": "sig" is a pronoun there).
  • A phrase after a personal pronoun or a name is penalised. "Hann hitti hana í viðtalinu" and "Hún hitti Jón í búðinni" have the phrase on the verb. It stays where there is no verb for it ("Þeir í nefndinni vildu það ekki").
  • "á meðal" and "á milli": "á" is no longer read as a noun there ("Þeir voru ekki á meðal markaskorara").
  • "á" as a preposition or as the verb "eiga". "Píratar ræða vaxtarverki og viðburðaríkt ár á aðalfundi" was two clauses, the second with a year that owns meetings. Against the development set, the preposition was read as the verb in 136 places and is in 73. "Hver á bílinn?" was a question without a verb and now has one.

Clauses

  • Question clauses can be joined, with each other and with a noun phrase:

    Construction Example
    Joined question clauses Ég veit hvar hann býr og hvenær hún fór.
    Two question words, one clause Enginn veit hvar og hvenær þetta gerðist.
    Noun phrase + question clause after a preposition Hún spurði um verðið og hvenær varan kæmi.
    The same as a verb object Hún veit nafn mannsins og hvar hann býr.
    Question clause after a preposition other than "um" Það fer eftir hvort veðrið verður gott.
    Question clause without a subject Hún spurði hvernig mætti koma í veg fyrir fleiri slys.
    Joined direct questions Hvað kostar þetta og hvar fæst það?

    Before, such sentences failed to parse or were read some other way, often as two main clauses.

  • The subject of a subordinate clause. "Ég held að fjölskyldan sé að brenna inni" and "að málið sé í skoðun" had no subject: the noun phrase was read as a predicate or an object standing in front of the verb. Those readings remain in relative clauses ("konurnar sem leikarar voru").

Names

Names were behind more parse failures in the news sample than any other single cause.

  • A capitalized word that BÍN only knows in lower case can be a name: "Herinn felldi El Mencho", "Þeir réðust á Pars", "EFLA hækkaði gjaldið". At the start of a sentence, only a word in all capitals qualifies.
  • An unknown name can follow a qualifier: "Hinn 29 ára gamli Sanches varð Evrópumeistari".
  • Names do not make a sentence foreign. "Manchester United og Chelsea fylgjast vel með Tomas Araujo" was rejected before parsing.
  • Names in the static phrases ([static_phrases] in Phrases.conf) are names in all cases and at the start of a sentence, whatever BÍN has for the word form: "Adams", "von der Leyen", "Rolling Stones" and others are added.
  • The longest static phrase wins. A phrase that begins with a shorter one never matched, so nine entries were dead, among them "Manchester United", "New York Times" and "þvert á móti". If the longer phrase does not follow, the shorter one still matches ("San Antonio Spurs", "San Antonio").

Packaging

  • filelock 4.2.1 or newer is required on Python 3.11 and newer. It fixes a number of security advisories, one of them in the lock type that the grammar lock uses. Python 3.10 keeps filelock>=3.9.0, as no fixed version supports it.
  • The module reynir.glock is removed. It was not used within the package, exported or documented.
  • No PyPy wheels for x86_64 macOS. PyPy on an Intel Mac installs from the source distribution, which needs the Xcode command-line tools. All other wheels are as in 4.1.0.
  • The documentation builds again (doc/conf.py reads the version from pyproject.toml).

Upgrading

  • Tree shapes change. In the sample of 5,000 news sentences, 1,148 trees differ from those of 4.1.0, mostly in where a prepositional phrase hangs and in subordinate clauses that gain a subject. Code that matches on tree shapes should be tested against this release. One change to look for: a phrase after an adjective that stands alone as a predicate now hangs on the verb phrase in sentences where it was inside the predicate ("Fosshótel, stór hótelkeðja, var rekin með tapi": NP-PRD is "rekin", not "rekin með tapi"), as it already did in simple ones ("Hún er stolt af honum").
  • GreynirCorrect 4.2.0 runs with this release, and 86 of its 88 tests pass. The two differences come from changed trees: in "Ég keypti þetta út í búð" the phrase now hangs on the verb and not on "þetta", where the pattern behind P_DIR_LOC looks for it, so that error is not reported; and "né" between joined question clauses is reported as P_Né, not P_NT_Né.
  • Parsing is about 7% slower than with 4.1.0 on a warm pass over 1,000 news sentences (10,600 tokens per second against 11,300), and about 5% slower on the first pass.
  • A few sentences no longer parse: 1 of the 5,000 in the news sample (59 parse that did not), and 2 of the 4,500 trees of the development set (20 parse that did not). The three had parsed through a wrong reading; in two of them "á" in "á meðal" was read as a noun.
  • Known costs: where two nouns in a row take the preposition equally strongly, the nearer one gets the phrase ("skýrsla nefndarinnar um málið" hangs it on "nefnd"); and a verb-first clause at the end of a statement that ends with a question mark can be split off as a question of its own.
  • A class derived from Reducer or ParseForestReducer that overrides the scoring of prepositions falls back on the Python reducer, as before; noun_prep_bonus() is a new method that can be overridden in the same way.
  • The binary grammar is regenerated the first time the package is used after the upgrade, which takes a few seconds.
  • Tested with Tokenizer 3.7.0 and BinPackage 2.1.0, on CPython 3.10–3.15, free-threaded CPython 3.14t and 3.15t, and PyPy 3.11.

🤖 Generated with Claude Code

Update the CLAUDE.md backlog: the heading, the share of news sentences
that do not parse with 4.2.0 (346 of 5,000, against 404 with 4.1.0),
and the parse speed against 4.1.0 (about 7% slower on a warm pass over
1,000 news sentences).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vthorsteinsson
vthorsteinsson merged commit 19bb8da into master Nov 26, 2026
17 checks passed
@vthorsteinsson
vthorsteinsson deleted the release-4.2.0 branch November 26, 2026 18:18
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