Repository navigation
A full-width yen sign is read as the currency, so "¥5,000万" is 50000000 instead of no value - #1442
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
…00 instead of no value Signed-off-by: Rudy Celekli <rudy@gradiahq.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.
Why
currency_unitmaps the symbols it knows to one canonical symbol. Chinese financial text (contracts, invoices, prospectuses, price lists) usually writes amounts with the full-width yen sign¥(U+FFE5), not¥(U+00A5).¥is not in the table, soscan_quantityfinds no currency, the number scan starts at¥and reads nothing:"¥5,000万"under a number attribute is no value, while"¥5,000万"is 50000000."¥5,000万"under 万元 is no value instead of 5000.literal_object("¥5000万")is false, so an amount written as an object becomes an entity named "¥5000万".What changes
¥is read as¥, the same symbol in its full-width form. Nothing else changes: "¥" stays ambiguous between yen and yuan as before, and a mismatch with a declared currency ("¥5,000万" under 万美元) is still no value.How it was checked
a_full_width_yen_sign_is_read_as_the_currency, covers "¥5,000万" with no unit and under 万元, "¥1,280" under 元, the mismatch under 万美元, andliteral_object("¥5000万").left: None right: Some(Number(50000000.0)).cargo test -p utopia-extract --lib: 113 passed.cargo fmt -p utopia-extract --checkandcargo clippy -p utopia-extract --all-targets -- -D warningspass.Before review
git commit -s)cargo fmt --all --check,cargo clippyandcargo testpass for the touched crate