A unit is read, not assumed - #600
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.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.
Follow-up to #598, from four waves of end-to-end tests on an isolated base (each document pressing one rule) and two rehearsals of a Chinese enterprise corpus. Findings are recorded in 0037 under "What the test waves found".
Four defects, four fixes
A wrong currency is worse than none.
Gamma Capital invested €30 million in Delta Analyticscame out asamount = 30000000 $, and腾讯以15亿元人民币投资了智谱AIas1500000000 $: the model normalises the figure to a bare number, or writes the currency as a sibling key ("currency": "CNY"), and the write path fell back to the attribute's declared unit. Now the prompt asks for the figure as written, currency and all; the quantity scanner reads currency symbols, ISO codes, currency words and CJK magnitudes (2亿美元,15亿元人民币,EUR 30 million,30 million euros); a siblingcurrency/币种key becomes the unit of the numeric qualifier instead of aqualifier_unknowndrop; and the declared default unit is used only when the text carries no unit token at all.A listed attribute keeps its magnitude too. Rule 10 told the model that a number is "a plain number without unit symbols", and rule 8a told it to keep a literal "as written, units and all". For a listed attribute the model obeyed rule 10 and wrote
86for86亿元人民币— the magnitude went with the unit. Rule 10 now says the same as 8a: the figure as the text writes it, the server converts. On the Chinese rehearsal营业收入went from86 ¥to8600000000 ¥,净利润from9.2to920000000,注册资本to500000000.A qualifier the base already defines is declared from the corpus. With nothing declared on
invested_in, the model still wroteamount,stakeandround— eight values into the drop report while the three attribute definitions sat in the base. When an unknown key matches an attribute of this base, the relation now declares it and the value is written, under the sameauto_extend_ontologyswitch as the rest of the growth loop. The declaration is additive (add_relation_qualifier,ON CONFLICT DO NOTHING): documents extract in parallel and the replace-all write lost one document's declaration to another's.A
nullqualifier is "not stated", not a bad value. The model writes"stake": nullfor a sentence with no stake; that used to be aqualifier_datatypedrop, four per corpus. And a magnitude-multiplied value is rounded to a whole number:9.2亿is920000000, not919999999.9999999.What the waves showed after the fixes
Isolated base (
utopia_edges, migrated by the server), model on DeepSeek-V3:Two things the waves found that this PR does not fix, both recorded in 0037: two documents describing the same edge extracted in parallel can both insert (the dedup is a read-then-write with no unique index behind it) — the "two rows plus a conflict" cut has to close that first; and the model dates "earlier this year" to a concrete day, minting a moment the text never gave.
A word on method: half a day of contradictory results turned out to be another session's server attached to the same database and job queue, processing some documents with an older binary. The waves moved to their own base after that.
Tests
parse_quantity/parse_leading_quantity: currencies as symbol, code and word; CJK magnitudes; rounding; strictness unchanged (3M,1,250 people,2025 Atlantic hurricane season).add_relation_qualifieris idempotent, additive, and refuses a non-attribute.🤖 Generated with Claude Code