Repository navigation
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$weakdoes 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]inPhrases.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.glockis 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.pyreads the version frompyproject.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-PRDis "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_LOClooks for it, so that error is not reported; and "né" between joined question clauses is reported asP_Né, notP_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
ReducerorParseForestReducerthat 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.