Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul hanzi2num #413

Merged
merged 9 commits into from
Dec 29, 2019
Merged

Overhaul hanzi2num #413

merged 9 commits into from
Dec 29, 2019

Conversation

statementreply
Copy link
Contributor

@statementreply statementreply commented Dec 27, 2019

Goals

Behavior Changes

  • 塵埃渺漠 are now 10x each
  • The character for 10^28 is changed to (U+7A70).
  • 一百一 = 101 now
  • Multi-character multipliers are no longer supported.
  • Omitting before fractional multipliers is no longer allowed. It's unclear whether 五毫絲 means 0.0051 or 5e-7, so I just disallowed it for now.
  • Allow multiple multipliers: 一萬萬 = 1e+8, 一百絲 = 0.01.
  • Add support for positional notation: 一三三七 = 1337
  • Add digit zero (exactly one digit of zero) and decimal separator ·: 三五〇〇·〇一 = 3500.01
  • "又" can be used at more places: 三十又六 = 36

@LingDong-
Copy link
Member

Sounds awesome, looking forward to it 👍

@LingDong- LingDong- mentioned this pull request Dec 28, 2019
@statementreply statementreply changed the title [WIP] Overhaul hanzi2num Overhaul hanzi2num Dec 29, 2019
@statementreply
Copy link
Contributor Author

statementreply commented Dec 29, 2019

Done

  • hanzi2num: readout format
  • hanzi2num: positional format
  • num2hanzi: readout format

Future

  • hanzi2num: reject positional format with mismatching multipliers (一萬二三四)
  • hanzi2num: support omitting 一 before fractional miltipliers at the beginning (分五釐)
  • hanzi2num: support 廿 etc.

Distant Future (?)

  • num2hanzi: positional format, full format (no omitted zeros)
  • hanzi2num and num2hanzi: scientific notation?

@LingDong- LingDong- merged commit 0c2f8b9 into wenyan-lang:master Dec 29, 2019
@LingDong-
Copy link
Member

LingDong- commented Dec 29, 2019

👍Looks very sophisticated, thanks so much! Will take a closer peek tomorrow :)

@antfu antfu mentioned this pull request Dec 29, 2019
@statementreply statementreply deleted the hanzi2num branch January 11, 2020 11:32
LingDong- added a commit that referenced this pull request Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some number keywords in hanzi2num.js are not included in parser.js bug in converting some hanzi to numbers
2 participants