-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: fallback parser #15
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
Conversation
indirect support for unimplemented languages via unicode-rbnf
Warning Rate limit exceeded@JarbasAl has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 33 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThe pull request updates language support status in the README, modifies number pronunciation functions to include a fallback mechanism, and adds a new dependency. The README now marks several languages with an “imperfect placeholder” for ordinal pronunciation and notes the fallback use of the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Parser as NumberParser
participant Engine as RbnfEngine
User->>Parser: Call pronounce_number / pronounce_ordinal
Parser->>Engine: Attempt formatting with RbnfEngine (try block)
alt Engine supports language
Engine-->>Parser: Return formatted number
Parser-->>User: Return result
else Engine does not support language
Engine-->>Parser: Raises error
Parser-->>User: Raise NotImplementedError
end
Possibly related PRs
Suggested labels
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (5)
requirements.txt (1)
1-2
: Consider pinning the unicode-rbnf version for production stability.The addition of unicode-rbnf is good for implementing the fallback parser, but without a version constraint, you might encounter compatibility issues in the future when the library updates.
quebra_frases>=0.3.7 -unicode-rbnf +unicode-rbnf>=0.3.0README.md (1)
19-19
: Fix hyphenation in "language-agnostic".The term "language-agnostic" should be hyphenated when used as a modifier.
-🚧 - imperfect placeholder, usually a language agnostic implementation or external library +🚧 - imperfect placeholder, usually a language-agnostic implementation or external library🧰 Tools
🪛 LanguageTool
[uncategorized] ~19-~19: When ‘language-agnostic’ is used as a modifier, it is usually spelled with a hyphen.
Context: ...- 🚧 - imperfect placeholder, usually a language agnostic implementation or external library | ...(SPECIFIC_HYPHEN)
ovos_number_parser/__init__.py (3)
280-280
: Fix typo in error message.There's a typo in the error message - "languags" should be "language".
-raise NotImplementedError(f"Unsupported languags: '{lang}'") +raise NotImplementedError(f"Unsupported language: '{lang}'")
301-301
: Fix the same typo in another error message.The same typo "languags" appears in this error message as well.
-raise NotImplementedError(f"Unsupported languags: '{lang}'") +raise NotImplementedError(f"Unsupported language: '{lang}'")
129-134
: Consider adding logging for fallback attempts.Adding logging when the fallback mechanism is activated would help with debugging and provide visibility into when the fallback is being used.
# fallback to unicode RBNF try: + import logging + logging.debug(f"Using RBNF fallback for language '{lang}'") engine = RbnfEngine.for_language(lang.split("-")[0]) fmt = FormatPurpose.ORDINAL if ordinals else FormatPurpose.CARDINAL return engine.format_number(number, fmt).text🧰 Tools
🪛 Ruff (0.8.2)
134-134: Do not use bare
except
(E722)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
README.md
(1 hunks)ovos_number_parser/__init__.py
(3 hunks)requirements.txt
(1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md
[uncategorized] ~19-~19: When ‘language-agnostic’ is used as a modifier, it is usually spelled with a hyphen.
Context: ...- 🚧 - imperfect placeholder, usually a language agnostic implementation or external library | ...
(SPECIFIC_HYPHEN)
🪛 Ruff (0.8.2)
ovos_number_parser/__init__.py
134-134: Do not use bare except
(E722)
135-135: Within an except
clause, raise exceptions with raise ... from err
or raise ... from None
to distinguish them from errors in exception handling
(B904)
169-169: Do not use bare except
(E722)
170-170: Within an except
clause, raise exceptions with raise ... from err
or raise ... from None
to distinguish them from errors in exception handling
(B904)
🔇 Additional comments (2)
README.md (1)
45-46
: Well-documented fallback mechanism.Good addition to the documentation explaining the fallback mechanism using unicode-rbnf. This makes it clear to users what happens when a language isn't directly supported.
ovos_number_parser/__init__.py (1)
3-3
: LGTM: Import for fallback mechanism.The import of
RbnfEngine
andFormatPurpose
from unicode-rbnf appropriately supports the new fallback functionality.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
indirect support for unimplemented languages via unicode-rbnf
Summary by CodeRabbit
New Features
Documentation
Chores