Eighteen laws, an address of its own, and a gentleman who never answers

Three weeks of Lectorium: twelve new Estonian acts, its own domain, a pure-Go engine - and a new character who only ever asks one question.

Eighteen laws, an address of its own, and a gentleman who never answers
Eighteen laws, an address of its own, and a gentleman who never answers

The last time we wrote here was 15 July. Lectorium read six Estonian laws, and we ended that post with a confession and a promise: it stumbled on plain definition questions inside very large acts, and we'd go fix it.

Three weeks later it reads eighteen laws, lives at its own address, runs on an engine we rewrote from scratch, and has gained a new inhabitant who has never answered a single question in his life. Here's the short version of what happened.

Twelve more laws

They arrived in batches, and most of them came from you.

Consumer protection first, because it touches everyone who buys anything. Then inheritance and family law - the only two we picked ourselves, because they cover the moments in life when nobody is in a state to go reading statutes. Then, through the end of July: personal data protection, apartment ownership and housing associations (that one was asked for loudly and often), child protection, non-profit associations, property law, social welfare, animal protection, the General Part of the Civil Code Act, and the Building Code with both of its annexes.

That's eighteen acts and 3,255 provisions, indexed as 4,212 searchable pieces. Every single addition followed the same ritual as before: pull the current text straight from Riigi Teataja, fold it in, then re-run the whole scoreboard and compare question by question. Not "it feels fine" - a diff.

The part we'd rather not write

That ritual is also how we found something unpleasant. Riigi Teataja's API has a field that tells you which version of an act is currently in force. We trusted it. It lies - it can point at a redaction that has since been superseded, and when we finally checked properly, seven of our nine acts were serving text that was no longer current.

Nobody reported it. We found it ourselves, and it is exactly the kind of failure that matters most in this domain: not a wrong answer that looks wrong, but a correct-looking quote of a law that has moved on. Ingest now resolves the act group and asks explicitly which redaction is in force, and every act was re-ingested.

The same audit turned up three more: our long-section splitter had never actually fired, so 414 sections were being indexed as single unwieldy blobs; 66 repealed sections were sitting in the index and could be returned as answers; and superscript section numbers were being flattened, so a citation to § 46⁴ pointed at § 464 - a provision that doesn't exist. All fixed, all re-measured.

Its own address, and its own engine

Lectorium used to live as a subpage of this site, like a guest. It now has its own home at lectorium.ee, with the app at app.lectorium.ee and an API that other services can call with a key.

Underneath, the query path was rewritten. Answering used to involve Python; now it doesn't. The service is a single Go binary that runs the embedding model in-process through ONNX Runtime. There is no Python at query time, no external AI service in the loop, and your question never leaves the server it arrived at.

The question that isn't in any section

The most common building question in Estonia is "do I need a permit for this?" - and the answer is in none of the Building Code's sections. The act says a notice is required "for the structures named in Annex 1", and Annex 1 is a table. Riigi Teataja ships those annexes as PDFs buried inside the act's XML. We had been downloading them every time and throwing them away, because our parser only looked at sections. Now they are extracted and indexed, so asking about an 18-square-metre shed gets you the row from the table itself.

Related, and just as human: people don't speak statute. The law never says "shed", it says "auxiliary building". It never says "noise", it says "harmful effects". If your word appears in no provision, the right provision never reaches the search at all - and no amount of clever ranking helps, because there is nothing to rank. So questions are now quietly expanded with the law's own vocabulary before the search runs. Only the search sees it; the question shown back to you and the citation you get are untouched.

The promise from last time

We ended the July post with a librarian metaphor: you ask for the book on sales contracts, and the librarian keeps pointing at the enormous reference volume called simply Contracts. General sections crowding out specific ones.

That is fixed now, and the fix is pleasingly boring. A provision whose heading contains one of your question's content words earns a small extra weight. Similarity across a whole section washes that signal out; a direct look at the title does not. Estonian being Estonian, this needed a hand-built table for consonant gradation - "ehitusluba" and "ehitusloa" are the same word but diverge at the eighth character - and a damping rule, because a one-word question would otherwise match every heading containing that word.

Measured over our test set: the correct provision is now ranked first for 79% of questions (was 74) and in the top three for 93% (was 91).

And Sebastian

Some questions have two correct answers, depending on who is asking. "How long must the daily rest period be?" means one thing under the Employment Contracts Act and another under the Civil Service Act, and the two candidates can sit four thousandths apart. Lectorium used to just pick - quietly, and not always right.

Now Sebastian asks. He appears below the answer, once the law has already been quoted and cited, and offers one choice: are you asking as an employee or as an official? Tap it and the search runs again knowing what you meant. Ignore him and the first answer stands.

The hard rule we built him under: he is not a lawyer, he is a middleman. He never answers, never interprets, never summarises - and he doesn't write his own sentences either. Every question and option he offers is authored by hand in advance; no language model generates his text. He shows up on about four questions in a hundred, and only when two acts are genuinely tied.

Where things stand

Eighteen acts. A scoreboard of 251 questions - including five traps whose correct outcome is silence, because the answer lives in a law we don't index. Right provision first 79% of the time, in the top three 93%, in the top five 96%.

Still open, and we'd rather say so: our reranker isn't in production yet, so a handful of questions still land on the right topic in the wrong act. Half of Estonian data-protection law lives in an EU regulation that isn't in Riigi Teataja, so those answers carry a warning. And Sebastian can only help where the search is undecided - when it is confidently wrong, there is no tie for him to notice.

Same principle as day one: real law, quoted, with a link to the source - or an honest "I'm not sure". Everything else is detail.

More soon, from the Crowned Phoenix workshop.

Open Lectorium

READ NEXT

More from the newsroom.