Repository navigation
A generated example never changes the learner's meaning; a broken sentence gets another - #902
Merged
Merged
Conversation
mircealungu
force-pushed
the
generated-sentence-keeps-card
branch
from
October 25, 2026 02:20
e86b520 to
24f4f0c
Compare
mircealungu
force-pushed
the
generated-sentence-keeps-card
branch
6 times, most recently
from
October 25, 2026 12:07
e4b8b17 to
c9e64cf
Compare
…tence gets another
validate_and_fix judges the meaning in the word's preferred bookmark, which
is sometimes a generated example. A FIX there moved the learner's word to a
meaning that fit the example: since 1 Jun 2026, 658 fixes were judged on
generated examples (58% of the examples judged, against 13% of learners'
own sentences) and 395 of them changed the word. The example was generated
for the meaning, so when the two disagree, the example is what is wrong
("selv" = "even" must not become "selv om").
A BROKEN_SENTENCE says nothing about the word either. So for both: the
meaning is judged again in another of the learner's own sentences, else in
the next unused example, at most 3 sentences in all; with none left the word
is given up on (a FIX in examples gives up as WORD_NOT_FIT). A generated
example that failed is recorded in example_sentence_misfit and not offered
again: the fragment swap and /alternative_sentences skip it.
Migration: tools/migrations/26-10-25--add_example_sentence_misfit.sql (a new
table; must run before this deploys, the example queries read it).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mircealungu
force-pushed
the
generated-sentence-keeps-card
branch
from
October 25, 2026 12:10
c9e64cf to
362aa17
Compare
mircealungu
changed the base branch from
validator-card-fits-sentence
to
master
October 25, 2026 12:19
…ntence → examples - MAX_SENTENCES_TRIED 3 → 2: the worst case per word is 6 validator calls, not 9. - A reader fragment is context for the meaning, not for study: falling back to the learner's own sentences skips fragments. - When the learner's own sentence is the broken one, the word goes to generated examples only, not to another of their look-ups. Since 1 Oct 88% of validated words already had examples; the rest give up until a new look-up (generating them on the spot is roadmap item 6b). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… method The reason is LLM text, which may hold 4-byte characters that utf8 rejects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Newer examples come from newer prompts and models, so they are the likeliest to fit the meaning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… example link - Examples are shared across learners, so two validations can mark the same one at once; the insert runs in a savepoint and a duplicate is ignored, instead of failing scheduling with an IntegrityError. - /alternative_sentences builds on usable_examples_query instead of repeating the misfit and newest-first rule. - The example behind a bookmark is its first example link: ExampleSentenceContext.find_by_bookmark uses .one(), which raises when a bookmark carries more than one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Builds on #900 (merged).
Problem.
validate_and_fixchecks the meaning in the word's preferred bookmark, and that is sometimes a generated example. A FIX there moved the learner's word to a different meaning, one that fits the example. Since 1 June, 658 fixes were judged on generated examples. That's 58% of the generated examples the validator judged, against 13% of learners' own sentences, and 395 of those fixes changed the word itself (e.g.mennesker→umannedfrom "Dronen er mennesker…"). The example was generated for the meaning, so when the two disagree it's the example that's wrong: "selv" = "even" must not become "selv om".The same goes for a sentence the validator calls
BROKEN_SENTENCE(#900). It says nothing about the word, which may fit any other sentence.Change. In both cases (any non-VALID verdict in a generated example, or
BROKEN_SENTENCEin any sentence),_try_another_sentence:example_sentence_misfittable;[word_not_fit]; broken sentences as[broken_sentence]. The meaning itself is not touched.Examples recorded as misfits are never offered again: the fragment swap (
replace_fragment_with_example) and/alternative_sentencesboth skip them.A FIX in the learner's own sentence still changes the meaning, as before, because that's the sentence they actually looked the word up in.
Deploy: run
tools/migrations/26-10-25--add_example_sentence_misfit.sqlbefore deploying. It creates a new table, so no existing table gets rebuilt, but the example queries read from it.Tests: 6 new DB tests:
Full suite: 1261 passed, 1 failed. The failure is
test_cloze_alternatives::test_a_translation_verdict_is_not_a_cloze_verdict, which passes on its own (3/3) and next to the new tests, and doesn't touch this code. It looks order- or fixture-dependent.Not in this PR:
🤖 Generated with Claude Code