Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 75 additions & 8 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ The public API is defined by the exports in `src/reynir/__init__.py`.
value: `Tilvísunarsetning/tala/p3/kyn` unifies with the `p3` slice of a
`/tala/pers/kyn` definition, since variant expansion is purely textual
name generation. The value must be declared as a variant first.
- A lemma literal with the variant `_ángr` (`'stig:hk'_et_þgf_ángr`) does
not match a form with the definite article ("stigi", not "stiginu");
without it, and without `_gr`, both match. Only lemma literals take it
(a `GrammarError` otherwise). It is matched natively (`TF_NO_ARTICLE`)
and is not in the terminal names of the simple tree
(`simplify_terminal()`).
- Ruff line length is 88; `E731` (lambda assignment) is ignored.
- CI (`.github/workflows/python-package.yml`) runs ruff + pytest via
`uv sync --locked` on Python 3.10–3.15, free-threaded 3.14t and 3.15t
Expand All @@ -289,14 +295,14 @@ repeated before and after a change (the data and scripts are outside
the repository; ask for the coverage study):

- *Sentences that do not parse*: 404 of a fixed sample of 5,000 news
sentences of 2026 (8.1%) with 4.1.0, and 346 (6.9%) with 4.2.0. Of
the 404, 232 are gaps in the grammar or the
sentences of 2026 (8.1%) with 4.1.0, 346 (6.9%) with 4.2.0, and 326
(6.5%) since the work on dates, numbers and measures (December 2026).
Of the 404, 232 are gaps in the grammar or the
vocabulary, each diagnosed with a minimal failing sentence and a
minimal parsing one. By size: names (43, of which 26 parse since the
work on names described below), dates, numbers and measures (23: a
weekday after "í gær"
or "á morgun", "tímabil" as a time noun, "um það bil"/"yfir hundrað"
before a numeral), fixed phrases (20: "af hálfu", "eitthvað slíkt"),
work on names described below), dates, numbers and measures (23, of
which 20 parse since the work described below), fixed phrases (20:
"af hálfu", "eitthvað slíkt"),
punctuation (19: a clause in parentheses), verb frames (13), word
order after a fronted element (13: "Þá kasta læknarnir fram tölum",
"Í dag er spáð rigningu"), gapping (12), agreement stricter than usage
Expand Down Expand Up @@ -331,6 +337,69 @@ the repository; ask for the coverage study):
the subject ("Í júní birti SKE umræðuskjal": SKE umræðuskjal, as with
KSÍ); photo credits ("EPA / Nafn Nafnsson") now parse, as a noun with
a possessor.
- *Dates, numbers and measures*: a weekday in apposition to "í gær",
"á morgun", "í gærkvöldi" (VikudagurViðurlag); "tímabil" and "leiktíð"
as time nouns, also with a year or two ("tímabilið 2015/16": the
parser never sees a slash, see `BIN_Token._UNDERSTOOD_PUNCTUATION`, so
the rule is a year followed by a number); "allan seinni hálfleikinn";
"lengur en þrjá mánuði", "í meira en 500 daga"; "um það bil" as a
static phrase (with "sem" it is a conjunction, "um það bil sem vélin
lenti": Tíðartenging); "hundrað" where plural number words stand (BÍN has it
in the singular only), "á annað hundrað"; ranges of number words
("þrjár til fjórar bækur", TöluorðBil); fractions ("tveir þriðju
þeirra", NlBrot); "einn og hálfan dag"; a measure in the genitive or a
percentage between a determiner and its noun ("fyrsta tveggja mínútna
brottvísunin", "allan 12% hlut sinn": EfLiðurMagn); an ordinal number
after a determiner ("sitt 24. tímabil"); "á eftir"/"á undan" as one
preposition with the difference in front ("tveimur stigum á eftir
Val", FsÁEftirUndan: only what a difference is measured in may stand
there, MunurNafnorð, or the objects of verbs are taken: "fylgdi
tveimur mönnum á eftir bílnum"); the same difference before a
comparative ("tveimur árum eldri en hann", "sæti ofar", "15 krónum
dýrari": MiðstigMunur, with the same list of units, and any noun
before "fleiri"/"færri": "manni færri"), which was read as a dative
object of the verb. A difference does not have the definite article
(`_ángr` on the units): "lauk leiknum fyrr" and "fagnaði markinu á
undan félögum sínum" have objects, and "frá árinu á undan" is the year
before. The exceptions are "skrefinu" ("skrefinu á undan", "skrefinu
lengra": MunurMeðGreini) and the fixed phrases "árinu eldri",
"deginum eldri", "höfðinu hærri" (MiðstigMeðGreini); a sample of 161
sentences with such a noun has 40 of the former kind and 25 of the
latter. Two number words in a row are no
longer multiplied into one number ("einn þriggja sakborninga" was 3;
`parse_phrases_1()` in `bintokenizer.py`), except after a product,
where the old behaviour remains and the value is wrong ("þrjú hundruð
fjörutíu" is 12,000: numbers written out in full should be added up,
with their "og"). A duration in the bare accusative is a time phrase
only as a last resort (TímabilÍÞolfalli, -36: "var frá þrjá mánuði"),
as it otherwise takes the objects of "taka", "fá" and others. A
range with "til" whose upper bound the tokenizer has joined with its
unit: amounts ("200 til 460 milljónir króna", FjárhæðarBil, also in
the genitive before a noun: "200 til 300 milljóna króna kostnaður"),
percentages ("20 til 30 prósent atkvæða", "5,1 til 5,4 prósenta
verðbólgu": PrósentubilTil, which has the case of the percentage, as a
caseless range becomes a possessor of the noun before it), measures
("40 til 70 km/klst") and "200 til 300 manns"; "á bilinu" is a prefix
of a number. The `amount` and `prósenta` terminals take a case
(`amount_þf_kvk`, `prósenta_ef`). The
targeted samples (17 constructions, 2,016 sentences) went from 398
unparsed to 160, and a sample of 450 ranges with "til" from 80 to 37.
Left: "11 til 13 milljónir rúmmetra", where "til" stays a preposition
(a number token matches a `tala` terminal in any case, whatever case
its number word has, so "13 milljónir" passes for a genitive; a
percentage does the same as `töl`); a number and a unit before a comparative
adverb, after a verb with a dative object, which is read as a
difference ("treysta tveimur flokkum betur en áður"; the object is
right there, but in "kom tveimur dögum fyrr" the difference is);
"F-35 og F-16 orrustuþotur"; a noun phrase
joined with a measure before "síðar" ("tuttugu árum og fjölda
umfjallana síðar"); "milli tveir og þrír að stærð"; a difference
before a comparative that stands alone as a noun phrase ("Valur er
með stigi minna") or after a verb with a dative object ("lék tveimur
mönnum færri"); "Liðið er tveimur leikjum á eftir", where "liðið" is still
the supine of "líða" (Prefs.conf has it as a noun first, which is
enough for "Liðið er í öðru sæti"; the stronger preference loses "Það
hefur liðið langur tími").
- *Sentences that parse wrongly*: against the hand-corrected gold
standard of GreynirCorpus (4,500 development trees; keep the 500 test
trees for final figures), labelled bracket F1 is 0.75 and 73% of the
Expand Down Expand Up @@ -390,8 +459,6 @@ Older items:
("höfðu dáið og 23 særst"); smaller items — "var lýst sem" passives,
"hann/hún" + name, repeated "sem", þykja-subject-first; the pronoun
"hinn" cluster ("allir hinir", "okkur hinum"); "Ætli …?" questions.
- **Tokenizer**: amount ranges ("200 til 460 milljónir króna" strands
"200 til").
- **Relative clauses** (left over from 3.10.0): stranded preposition
after "vera" ("húsið sem hann hefur verið í"); multi-word stranded
prepositions ("sem hún tók á móti"); "fundurinn sem halda á í dag";
Expand Down
Loading
Loading