Repository navigation
feat: read more set codes in the collector line - #511
Merged
Merged
Conversation
The reader maps Cyrillic look-alike letters to Latin, takes the code before the language code with spaces removed, allows more separators and one stray digit before EN, and reads no collector number from the language line. The decision matches a set code only against the sets of the image shortlist, with ordered match levels, drops a number read before a rarity letter when it names a printing the image does not support, and shows the one same-art printing with a read number first. Three guards keep set-code accepts safe: the next card must be the art margin behind, a set with two printings of the card needs a number, and an older frame with a read set code does not accept by unique art. Refs #507
Gate 1 has 217 correct accepts, up from 207, and 241 right printings first, up from 230. Gate 2 has 2,161 exact accepts, up from 2,134, and 2,542 right printings first, up from 2,531. No gate records a wrong-card accept. Refs #507
README.md (Card recognizer) describes how the reader takes a set code and how the decision matches it. docs/research/collector-line-set-codes.md keeps the research behind #507 and the replay of the built rules. Refs #507
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.
Closes #507
Summary
The reader takes more set codes from the line with the language code, and
decidematches them only against the sets of the image shortlist.README.md(Card recognizer) describes the rules. The research and the replay are indocs/research/collector-line-set-codes.md.Evidence
Swift tests:
swift testwith the fixture model, 88 passed (22 new). Each new rule has a mutation check. I broke each rule on purpose and its test failed: the language line number, the two-set tie, the margin guard, the older-frame guard, the set guard, the dropped number, the number-first rule, the separator level, and the joined code in lowercase text.Local recognizer replay
bun run recognizer:replayon the owner's Mac (Apple M3, macOS 27.0.1), withRECOGNIZER_GALLERY_DIR=~/Library/Caches/mtgscan/gallery/installed/20261021-c38f43. I ran it onmain(a6fcfaf, exit 0, 0 changes against the expected files) and on this branch (68ffac7, exit 2, every gate passes). Feature print parity: lowest cosine 1 over 24 references.Exact accepts / right printing first:
main)The expected files are recorded again with 68ffac7. A replay against them now has 0 changes.
Changed results:
Guard 6c (a set with two printings of the top card needs a number) costs 1 exact accept, Swamp MID 382, on Gate 2. It costs none on Gate 1 or the S07 crops. That is below "a few", so I did not run a replay without it.
The S07 crops stay outside the repo. I ran them through the recognizer command on
mainand on this branch, with the true printing of each card from the S07 run.Merge Danger
Door: two-way
Reverting the commits restores the old rules and the old expected files.
Blast Radius: recognition
Every scan goes through the new parser and decision. The gates show no wrong-card accept on the Mac. The phone reads the strip at another scale (research section 1), so Gate 3 and the next phone session are the check there.