-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix: voc_match ignore case #312
Conversation
WalkthroughThe changes focus on enhancing the vocabulary matching functionality in the Changes
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 (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #312 +/- ##
==========================================
- Coverage 49.89% 49.66% -0.23%
==========================================
Files 37 37
Lines 4341 4357 +16
==========================================
- Hits 2166 2164 -2
- Misses 2175 2193 +18 ☔ View full report in Codecov by Sentry. |
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: 0
🧹 Nitpick comments (1)
ovos_workshop/skills/ovos.py (1)
2175-2175
: Usere.escape()
for special characters
When building a regular expression from external strings, it is safer to usere.escape(i)
to avoid unintended behavior ifi
contains special regex characters (e.g., punctuation or parentheses). As a small performance improvement, consider passing a generator toany()
, instead of a pre-built list.- match = any([re.match(r'.*\b' + i + r'\b.*', utt, re.IGNORECASE) - for i in _vocs]) + match = any( + re.match(r'.*\b' + re.escape(i) + r'\b.*', utt, re.IGNORECASE) + for i in _vocs + )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ovos_workshop/skills/ovos.py
(1 hunks)
🔇 Additional comments (3)
ovos_workshop/skills/ovos.py (3)
2160-2160
: Good fallback usage for language selection
The inline assignment ensures that if lang
is not provided, self.lang
is used as a fallback. This is clear and concise.
2165-2165
: Great logging for missing vocabulary files
Logging a warning is a good approach to keep track of missing vocab resources. Consider confirming that higher-level application logic or catch blocks handle this scenario appropriately, so users understand why a vocabulary match fails.
2171-2171
: Correct case-insensitive exact match check
By comparing both the vocab entry and the utterance in lowercase, the code reliably performs exact matching without case issues. This effectively addresses the PR objective.
Summary by CodeRabbit
New Features
Bug Fixes