Repository navigation
Conversation
…onds A time with a seconds field always read the seconds, so 10:30:00 became "ten thirty and zero seconds", and it skipped the o'clock branch, so 10:00:05 became "ten and five seconds". Read the seconds only when they are not zero and apply the o'clock rule whether or not seconds follow. Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
|
A comment: think about handling 24-hour format. For example 1:00 PM would be "thirteen hundred" in English military use. In German (whatever became of that branch?) it would be "dreizehn uhr" (i.e., different languages, different protocols). I can see where this issue could become a rather deep rabbit hole, best not explored. |
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.
EnglishNormalizer.timesreadsH:MM:SSin two wrong ways:It was 10:30:00Starts at 3:00:00Alarm at 10:00:05Logged at 9:00:00 amThe seconds field was always read, even when it was
00. Because theo'clockrule sat in theelifof the seconds branch, a whole hour followed by seconds was read as "ten and five seconds", so the minutes disappeared. Seconds are now read only when they are not zero, and theo'clockrule (no am/pm, minute 0) applies whether or not seconds follow. Times with nonzero minutes and seconds, such as1:02:03and12:30:15 pm, read the same as before.Testing
uv run pytestpasses locally (API changes). I ranapi/tests/test_normalizer*.pyin a light venv without torch: 234 passed. The 2 failures intest_normalizer_redos.pyare imports that venv does not have, and they fail the same way onmaster.npm run test:webpasses locally (web player changes)test_normalizer.py. All four fail onmasterand pass with this change.npm run cpu:up/gpu:up), for inference or docker changesCHANGELOG.mdentry, if users will notice the changeruff format --checkandruff checkare clean on the touched files.AI disclosure: written with the help of Claude Code, reviewed and tested by me.