-
Notifications
You must be signed in to change notification settings - Fork 16
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:standardize_lang #568
fix:standardize_lang #568
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #568 +/- ##
==========================================
+ Coverage 75.33% 75.41% +0.07%
==========================================
Files 15 15
Lines 3094 1570 -1524
==========================================
- Hits 2331 1184 -1147
+ Misses 763 386 -377
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
WalkthroughThe pull request introduces modifications to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used🔇 Additional comments (4)
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: 1
🧹 Outside diff range and nitpick comments (10)
test/end2end/routing/test_sched.py (1)
Line range hint
14-101
: Consider refactoring the test method for improved maintainability.While not directly related to the current change, the
test_no_session
method is quite long and complex. Consider the following improvements for future refactoring:
- Split the method into smaller, more focused test cases.
- Replace the custom wait mechanism with a more robust solution, possibly using a library designed for asynchronous testing.
- Consider extracting the list of expected messages to a separate constant or configuration file for easier maintenance.
These suggestions are meant for future consideration and are not blocking issues for the current PR.
test/end2end/session/test_sched.py (1)
Inconsistent Language Code Usage Detected
The verification script identified multiple instances of the lowercase language code "en-us" across the codebase. These inconsistencies need to be addressed to ensure uniformity in language handling. The affected files include:
test/integrationtests/test_workshop.py
test/unittests/xformers.py
test/unittests/test_intent_service.py
test/integrationtests/test_selene_api.py
test/integrationtests/common_query/test_continuous_dialog.py
test/end2end/session/test_stop.py
test/end2end/session/test_session.py
test/end2end/session/test_transformers.py
test/end2end/session/test_complete_failure.py
test/end2end/session/test_converse.py
test/backwards_compat/test_ocp.py
test/end2end/routing/test_sched.py
test/end2end/session/test_blacklist.py
test/end2end/session/test_get_response.py
mycroft/deprecated/enclosure/mark1/__init__.py
mycroft/dialog/dialog.py
ovos_core/intent_services/stop_service.py
Please update all instances of "en-us" to the standardized "en-US" to maintain consistency across the project.
🔗 Analysis chain
Line range hint
1-240
: Summary: Successful standardization of language codesThe changes in this file consistently update the language code from "en-us" to "en-US" across both test methods (
test_no_session
andtest_explicit_session
). This standardization affects:
- Default session language settings
- Assertions for message contexts
- Assertions for 'speak' message data
These modifications align with the PR objective of ensuring that intents match regardless of the case used in language codes. The changes maintain the overall structure and logic of the tests while enhancing the verification of standardized language codes.
To ensure that these changes are consistent across the entire codebase, please run the following script:
This script will help identify any inconsistencies in language code usage across the project.
To address the issue with the previous script, please run the updated verification script below:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of standardized language codes across the codebase # Search for any remaining instances of lowercase 'us' in language codes echo "Searching for lowercase 'us' in language codes:" rg -i '\ben-us\b' --type python # Search for the new standardized format to confirm its usage echo "Confirming usage of standardized 'en-US' format:" rg '\ben-US\b' --type python # Check for any mixed case variations that might have been missed echo "Checking for any mixed case variations:" rg -i '\ben-[uU][sS]\b' --type python | grep -v 'en-US'Length of output: 526
Script:
#!/bin/bash # Description: Verify the usage of standardized language codes across the codebase # Search for any remaining instances of lowercase 'us' in language codes echo "Searching for lowercase 'us' in language codes:" rg -i '\ben-us\b' --glob '*.py' # Search for the new standardized format to confirm its usage echo "Confirming usage of standardized 'en-US' format:" rg '\ben-US\b' --glob '*.py' # Check for any mixed case variations that might have been missed echo "Checking for any mixed case variations:" rg -i '\ben-[uU][sS]\b' --glob '*.py' | grep -v 'en-US'Length of output: 14923
ovos_core/intent_services/__init__.py (8)
213-215
: LGTM: Standardized language tag usage.The use of
standardize_lang_tag(get_message_lang())
ensures consistent language tag formatting. Consider extracting this to a separate line for improved readability:- lang = standardize_lang_tag(get_message_lang()) - return [parser.__dict__ - for parser in self._adapt_service.engines[lang].intent_parsers] + lang = standardize_lang_tag(get_message_lang()) + intent_parsers = self._adapt_service.engines[lang].intent_parsers + return [parser.__dict__ for parser in intent_parsers]This change would make the code slightly more readable and easier to debug if needed.
Line range hint
267-274
: LGTM: Improved language handling in transformers.The use of
standardize_lang_tag
and explicit setting of the language in the message context improves consistency. Consider adding error handling for the transformation process:utterances, message.context = self.utterance_plugins.transform(utterances, message.context) if original != utterances: message.data["utterances"] = utterances LOG.debug(f"utterances transformed: {original} -> {utterances}") - message.context = self.metadata_plugins.transform(message.context) + try: + message.context = self.metadata_plugins.transform(message.context) + except Exception as e: + LOG.error(f"Error during metadata transformation: {e}") return messageThis change would make the method more robust by catching and logging any errors that might occur during the metadata transformation process.
Line range hint
285-300
: LGTM: Consistent language standardization in disambiguation.The use of
standardize_lang_tag
for the default language is appropriate. Consider adding more detailed logging for better debugging:for k in lang_keys: if k in message.context: v = get_full_lang_code(message.context[k]) if v in valid_langs: if v != default_lang: - LOG.info(f"replaced {default_lang} with {k}: {v}") + LOG.info(f"Language disambiguated: replaced {default_lang} with {k}: {v}") return v else: - LOG.warning(f"ignoring {k}, {v} is not in enabled languages: {valid_langs}") + LOG.warning(f"Ignoring {k}: {v} is not in enabled languages: {valid_langs}")These changes provide more context in the log messages, which can be helpful for debugging language-related issues.
356-358
: LGTM: Consistent language standardization in session validation.The use of
standardize_lang_tag(lang)
at the beginning of the method ensures consistent language tag formatting. Consider extracting the standardized language to a named variable for improved readability:- lang = standardize_lang_tag(lang) - sess = SessionManager.get(message) - if sess.session_id == "default": + standardized_lang = standardize_lang_tag(lang) + sess = SessionManager.get(message) + if sess.session_id == "default":This change makes it clearer that we're working with a standardized language tag throughout the method.
530-533
: LGTM: Consistent language standardization in vocabulary registration.The use of
standardize_lang_tag(get_message_lang())
ensures consistent language tag formatting. Consider adding error handling for the vocabulary registration process:lang = standardize_lang_tag(get_message_lang()) - self._adapt_service.register_vocabulary(entity_value, entity_type, - alias_of, regex_str, lang) - self.registered_vocab.append(message.data) + try: + self._adapt_service.register_vocabulary(entity_value, entity_type, + alias_of, regex_str, lang) + self.registered_vocab.append(message.data) + except Exception as e: + LOG.error(f"Error registering vocabulary: {e}")This change would make the method more robust by catching and logging any errors that might occur during the vocabulary registration process.
607-609
: LGTM: Consistent language standardization in intent handling.The use of
standardize_lang_tag(get_message_lang())
ensures consistent language tag formatting. Consider adding more detailed logging for better debugging:- lang = standardize_lang_tag(get_message_lang()) + lang = standardize_lang_tag(get_message_lang()) + LOG.debug(f"Handling get_intent for utterance: '{utterance}' in language: {lang}") sess = SessionManager.get(message)This change provides more context in the log messages, which can be helpful for debugging intent-related issues.
Line range hint
658-662
: LGTM: Consistent language standardization in Adapt intent handling.The use of
standardize_lang_tag(get_message_lang())
ensures consistent language tag formatting. Consider adding error handling for the intent matching process:lang = standardize_lang_tag(get_message_lang()) - intent = self._adapt_service.match_intent((utterance,), lang, message.serialize()) - intent_data = intent.intent_data if intent else None - self.bus.emit(message.reply("intent.service.adapt.reply", - {"intent": intent_data})) + try: + intent = self._adapt_service.match_intent((utterance,), lang, message.serialize()) + intent_data = intent.intent_data if intent else None + self.bus.emit(message.reply("intent.service.adapt.reply", + {"intent": intent_data})) + except Exception as e: + LOG.error(f"Error matching Adapt intent: {e}") + self.bus.emit(message.reply("intent.service.adapt.reply", + {"intent": None, "error": str(e)}))This change would make the method more robust by catching and logging any errors that might occur during the Adapt intent matching process, and also inform the caller about the error.
Line range hint
89-157
: LGTM: Consistent deprecation warnings for properties.The deprecation warnings for properties and their setters are well-implemented. For consistency, consider using a constant for the deprecation version:
+DEPRECATION_VERSION = "1.0.0" @property def adapt_service(self): log_deprecation("direct access to self.adapt_service is deprecated, " - "pipelines are in the progress of being replaced with plugins", "1.0.0") + "pipelines are in the progress of being replaced with plugins", DEPRECATION_VERSION) return self._adapt_service # Apply similar changes to other properties and settersThis change would make it easier to update the deprecation version across all warnings in the future.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (16)
- ovos_core/intent_services/init.py (8 hunks)
- ovos_core/intent_services/converse_service.py (3 hunks)
- ovos_core/intent_services/stop_service.py (6 hunks)
- requirements/lgpl.txt (1 hunks)
- requirements/requirements.txt (1 hunks)
- test/end2end/routing/test_sched.py (1 hunks)
- test/end2end/routing/test_session.py (1 hunks)
- test/end2end/session/test_blacklist.py (3 hunks)
- test/end2end/session/test_complete_failure.py (4 hunks)
- test/end2end/session/test_converse.py (5 hunks)
- test/end2end/session/test_fallback.py (3 hunks)
- test/end2end/session/test_get_response.py (15 hunks)
- test/end2end/session/test_sched.py (7 hunks)
- test/end2end/session/test_session.py (5 hunks)
- test/end2end/session/test_stop.py (2 hunks)
- test/end2end/session/test_transformers.py (2 hunks)
🧰 Additional context used
🔇 Additional comments (65)
requirements/lgpl.txt (1)
1-1
: LGTM! Verify the new version's availability and contents.The update to
ovos_padatious>=0.1.3,<1.0.0
is consistent with the PR objectives and likely includes necessary changes for standardizing language handling. This minor version bump suggests new features or non-breaking improvements.Please ensure that:
- Version 0.1.3 of
ovos_padatious
is available in the package repository.- The changes in version 0.1.3 include the required updates for standardizing language code handling.
You can verify this by running:
requirements/requirements.txt (7)
6-6
: LGTM:padacioso
version updateThe update to
padacioso>=0.2.4,<1.0.0
is appropriate. This minor version bump likely includes improvements related to the standardization of language handling, which aligns with the PR objectives.
7-7
: LGTM:ovos-adapt-parser
version updateThe update to
ovos-adapt-parser>=0.1.3,<1.0.0
is appropriate. This patch version bump likely includes bug fixes or minor improvements related to the standardization of language handling, which aligns with the PR objectives.
8-8
: LGTM:ovos_ocp_pipeline_plugin
version updateThe update to
ovos_ocp_pipeline_plugin>=0.1.3,<1.0.0
is appropriate. This patch version bump likely includes changes related to the standardization of language handling. This update corresponds to the companion PR ovos-ocp-pipeline-plugin#12 mentioned in the PR objectives.
9-9
: LGTM:ovos-common-query-pipeline-plugin
version updateThe update to
ovos-common-query-pipeline-plugin>=0.1.4,<1.0.0
is appropriate. This minor version bump likely includes new features or improvements related to the standardization of language handling. This update corresponds to the companion PR ovos-common-query-pipeline-plugin#9 mentioned in the PR objectives.
11-11
: LGTM:ovos-utils
version updateThe update to
ovos-utils>=0.3.5,<1.0.0
is appropriate. This significant minor version bump indicates substantial new features or improvements, likely related to the standardization of language handling. This update corresponds to the companion PRs ovos-utils#281 and ovos-utils#283 mentioned in the PR objectives.
12-12
: LGTM:ovos_bus_client
version updateThe update to
ovos_bus_client>=0.1.4,<1.0.0
is appropriate. This patch version bump likely includes bug fixes or minor improvements related to the standardization of language handling. This update corresponds to the companion PR ovos-bus-client#128 mentioned in the PR objectives.
6-12
: Summary: Dependency updates align with PR objectivesThe updates to
padacioso
,ovos-adapt-parser
,ovos_ocp_pipeline_plugin
,ovos-common-query-pipeline-plugin
,ovos-utils
, andovos_bus_client
are all appropriate and align with the PR objectives. These updates contribute to the standardization of language handling across the OpenVoiceOS ecosystem while maintaining compatibility within the current major versions. The changes correspond to the companion PRs mentioned in the PR objectives, ensuring a coordinated update across multiple repositories.test/end2end/routing/test_sched.py (1)
19-19
: Approved: Language code standardization aligns with PR objectives.The change from "en-us" to "en-US" for the default session language is consistent with the pull request's objective of standardizing language handling. This modification ensures that the test uses the correct format for language codes, which is crucial for maintaining consistency across the codebase.
test/end2end/session/test_transformers.py (3)
35-35
: Approved: Language code standardizationThe change from "en-us" to "en-US" standardizes the language code format, aligning with the BCP 47 language tag standard. This modification supports the PR's objective of ensuring intents match regardless of the case used in language codes.
108-108
: Approved: Consistent language code standardizationThe change from "en-us" to "en-US" in the
test_meta
method maintains consistency with the earlier change in thetest_cancel
method. This ensures uniform language code formatting across test methods, supporting the PR's goal of standardizing language handling.
Line range hint
1-168
: Verify test execution with standardized language codesThe changes to this file are minimal and focused, updating the language code format from "en-us" to "en-US" in two test methods. These modifications align with the PR's objective of standardizing language inputs and should not affect the overall functionality of the tests.
To ensure the changes haven't inadvertently impacted test behavior:
This will help confirm that the tests still pass with the standardized language codes.
test/end2end/routing/test_session.py (1)
24-24
: Approve: Standardized language code formatThis change correctly updates the language code from "en-us" to "en-US", adhering to the ISO 639-1 and ISO 3166-1 alpha-2 standards. This modification aligns with the PR's objective of standardizing language inputs and ensures that the tests accurately reflect the expected format for language codes in the system.
The standardization is crucial for:
- Consistency across the codebase
- Accurate testing of language-dependent features
- Potential identification of case-sensitivity issues in language code handling
This change contributes to more robust and reliable tests, which is essential for maintaining the quality of the language processing capabilities in the OpenVoiceOS ecosystem.
test/end2end/session/test_sched.py (6)
19-19
: LGTM: Language code standardizationThe change from "en-us" to "en-US" aligns with the PR objective of standardizing language codes and follows the ISO 639-1 standard.
77-77
: LGTM: Consistent language code in assertionThe assertion has been updated to use "en-US", maintaining consistency with the earlier change and ensuring that the test correctly validates the standardized language code.
97-97
: LGTM: Standardized language code in 'speak' message assertionThe assertion for the 'speak' message has been updated to use "en-US", maintaining consistency with the standardized language code throughout the test case.
125-125
: LGTM: Consistent language code in second 'speak' message assertionThe assertion for the second 'speak' message has been updated to use "en-US", ensuring consistency with the standardized language code throughout the test case.
134-134
: LGTM: Standardized language code intest_explicit_session
The default session language code has been updated to "en-US" in the
test_explicit_session
method, maintaining consistency with thetest_no_session
method and adhering to the standardized language code format.
215-215
: LGTM: Consistent language code intest_explicit_session
'speak' message assertionsThe assertions for 'speak' messages in the
test_explicit_session
method have been updated to use "en-US", ensuring consistency with the standardized language code throughout both test methods.Also applies to: 232-232
ovos_core/intent_services/stop_service.py (6)
13-13
: LGTM: Import of standardize_lang_tag functionThe addition of
standardize_lang_tag
fromovos_utils.lang
aligns with the PR's objective to standardize language handling. This import will help ensure consistent formatting of language tags throughout the code.
131-131
: LGTM: Consistent language tag standardizationThe use of
standardize_lang_tag(lang)
in thematch_stop_high
method maintains consistency with the earlier changes and ensures that the language tag used for vocabulary matching is standardized.
182-182
: LGTM: Consistent language tag standardization in match_stop_mediumThe use of
standardize_lang_tag(lang)
in thematch_stop_medium
method maintains consistency with the earlier changes and ensures that the language tag used for vocabulary matching is standardized across all stop-related methods.
209-209
: LGTM: Consistent language tag standardization in match_stop_lowThe use of
standardize_lang_tag(lang)
in thematch_stop_low
method maintains consistency with the earlier changes and ensures that the language tag used for vocabulary matching is standardized across all stop-related methods.
Line range hint
1-286
: Summary: Standardized language handling implemented consistentlyThe changes in this file successfully implement standardized language handling using the
standardize_lang_tag
function across all relevant methods. This aligns well with the PR objectives and should improve the robustness of language-related operations in theStopService
class.To ensure the changes work correctly and maintain backwards compatibility, please consider the following:
- Add comprehensive tests covering various language tag formats (e.g., 'en', 'en-US', 'pt-BR') to verify that all stop-related functionality works as expected.
- Verify that these changes don't introduce any breaking changes for existing implementations that might rely on the previous language tag format.
- Update the documentation to reflect the new standardized language handling, if applicable.
You can use the following script to identify potential areas that might need additional testing or documentation updates:
#!/bin/bash # Description: Identify areas for potential testing and documentation updates # Search for language-related functionality in the codebase rg --type python 'lang.*=|language.*=' ovos_core/ # Search for existing language-related tests rg --type python 'def test_.*lang' ovos_core/test/ # Search for language-related documentation rg --type markdown 'language|lang' docs/
270-270
: LGTM: Consistent language tag standardization in voc_matchThe use of
standardize_lang_tag(lang)
in thevoc_match
method maintains consistency with the earlier changes and ensures that the language tag used for vocabulary matching is standardized across all methods that interact with the vocabulary cache.To ensure the changes work correctly across different language codes and dialects, please add comprehensive tests that cover various language tag formats (e.g., 'en', 'en-US', 'pt-BR') and verify that the vocabulary matching works as expected for all cases. You can use the following script to check the current test coverage for language handling:
#!/bin/bash # Description: Check test coverage for language handling in StopService # Search for test files related to StopService rg --type python 'class.*Test.*StopService' ovos_core/test/ # Search for language-related test cases within these files rg --type python '(def test_.*lang|lang.*=)' ovos_core/test/ | grep -i stoptest/end2end/session/test_complete_failure.py (5)
22-22
: Approved: Standardized language code formatThe change from "en-us" to "en-US" for
SessionManager.default_session.lang
is correct and aligns with the PR objective of standardizing language handling. This format follows the ISO 639-1 (language code) and ISO 3166-1 (country code) standards, ensuring consistency across the codebase.
108-108
: Approved: Consistent language code standardizationThe change from "en-us" to "en-US" for
SessionManager.default_session.lang
in this test method is consistent with the previous change. This ensures that language code standardization is applied uniformly across different test scenarios.
147-147
: Approved: Comprehensive language code standardizationThe update of the
valid_languages
list to include "en-US" instead of "en-us" is consistent with the overall standardization effort. This change ensures that all references to language codes within the test suite follow the same format.
Line range hint
1-250
: Summary of changes and recommendations
The changes in this file consistently standardize language codes from "en-us" to "en-US", which aligns with the PR objectives and improves adherence to ISO standards.
The standardization is applied comprehensively, including the
valid_languages
list and individual language assignments.A potential issue was identified in the
test_complete_failure_lang_detect
method, where the session language is reset at the end of the test. This might interfere with verifying the persistence of language changes.Recommendation: Review the test logic, particularly the final language reset, to ensure it doesn't compromise the test's ability to verify language change persistence.
Overall, the changes improve code consistency and standardization, contributing positively to the project's language handling capabilities.
250-250
:⚠️ Potential issueConsider removing or updating the final language reset
While the change from "en-us" to "en-US" is correct, there's a potential issue with the test logic:
- The test sets the session language to "pt-pt" on line 218.
- It then verifies this change on line 249.
- Finally, it resets the language to "en-US" on line 250.
This reset might interfere with verifying the persistence of the language change across sessions. Consider either removing this reset or updating the test to verify that the language change persists even after attempting to reset it to a different value.
To verify the impact of this reset, you can run the following script:
This will help determine if there are any assertions or verifications that might be affected by the language reset.
test/end2end/session/test_session.py (5)
23-23
: LGTM: Language code standardizationThe update from "en-us" to "en-US" aligns with the PR objective of standardizing language codes. This change ensures consistency with the IETF language tag format (ISO 639-1 for language code, ISO 3166-1 alpha-2 for country code, separated by a hyphen).
76-76
: LGTM: Consistent language code assertionThe update of the assertion from "en-us" to "en-US" maintains consistency with the earlier change to the default session language. This ensures that the test correctly verifies the standardized language code format throughout the message pipeline.
108-108
: LGTM: Consistent language code updateThe change from "en-us" to "en-US" for the explicit default session is consistent with the updates made in the
test_no_session
method. This ensures that all test cases use the standardized language code format, maintaining consistency across the test suite.
209-209
: LGTM: Comprehensive language code standardizationThe updates from "en-us" to "en-US" in both the default session setup (line 209) and the speak message assertion (line 298) complete the standardization of language codes across all test cases. This comprehensive approach ensures consistency throughout the test suite and aligns with the PR's objective of standardizing language handling.
Also applies to: 298-298
Line range hint
23-298
: Summary: Successful standardization of language codes in test suiteThe changes made to this test file consistently update the language code from "en-us" to "en-US" across all test methods. This standardization aligns with the PR objective and ensures that the test suite accurately reflects and verifies the expected behavior of the system with regard to language code handling. The updates contribute to maintaining a robust and consistent testing environment for the OpenVoiceOS system.
test/end2end/session/test_stop.py (3)
23-23
: Approved: Language code standardizationThe change from "en-us" to "en-US" aligns with the PR objective of standardizing language codes. This modification ensures compliance with ISO 639-1 and ISO 3166-1 standards for language and country codes, respectively. It's a small but important change that contributes to consistency across the codebase.
199-199
: Approved: Consistent language code standardizationThe change from "en-us" to "en-US" in the
test_new_stop
method is consistent with the earlier modification intest_old_stop
. This ensures uniform language code formatting throughout the test file, contributing to the overall objective of standardizing language handling across the codebase.
Line range hint
1-458
: Summary: Changes align with PR objectivesThe modifications in this file are minimal and precisely targeted at standardizing language codes. Both instances of "en-us" have been updated to "en-US", which is in line with the PR's objective of ensuring intents match regardless of the case used in language codes. These changes contribute to the overall goal of standardizing language handling within the OpenVoiceOS ecosystem.
The updates are consistent and do not introduce any unintended side effects or issues. They maintain the existing test structure while enhancing the accuracy of language code representation.
test/end2end/session/test_fallback.py (4)
22-22
: LGTM: Language code standardizationThe change from "en-us" to "en-US" aligns with the PR objective of standardizing language codes. This modification ensures consistency across the codebase and more accurately represents real-world language tags.
145-145
: LGTM: Consistent language code standardizationThis change from "en-us" to "en-US" is consistent with the previous modification and maintains the standardization of language codes throughout the test cases. It improves the overall consistency of the codebase.
319-319
: LGTM: Completed language code standardizationThis final change from "en-us" to "en-US" completes the standardization of language codes across all test cases in this file. These consistent modifications improve the overall code quality and align with the PR's objective of ensuring intents match regardless of the case used in language codes.
Line range hint
22-319
: Summary: Successful language code standardizationThe changes in this file consistently update the language code from "en-us" to "en-US" across all test cases. These modifications:
- Align with the PR objective of standardizing language code handling.
- Improve code consistency without altering the test logic.
- Contribute to ensuring intents match regardless of the case used in language codes.
These changes are part of a larger effort to standardize language handling across the OpenVoiceOS ecosystem, as evidenced by the companion pull requests mentioned in the PR objectives.
test/end2end/session/test_blacklist.py (4)
24-24
: Approved: Language code standardizationThe change from "en-us" to "en-US" aligns with the PR objective of standardizing language inputs. This modification ensures consistency with the IETF language tag format (BCP 47), which is the standard for language codes.
312-312
: Approved: Consistent language code standardizationThe change from "en-us" to "en-US" in the TestFallback class is consistent with the previous modification in the TestSessions class. This change further contributes to the standardization of language inputs across the codebase, aligning with the PR objectives.
403-403
: Approved: Completed language code standardizationThe change from "en-us" to "en-US" in the TestCommonQuery class completes the standardization of language inputs across all test classes in this file. This consistent approach ensures that all tests use the correct IETF language tag format, aligning with the PR objectives and improving the overall quality of the test suite.
Line range hint
24-403
: Summary: Successful standardization of language codesThe changes in this file consistently update the language code from "en-us" to "en-US" across all test classes (TestSessions, TestFallback, and TestCommonQuery). These modifications:
- Align with the PR objective of standardizing language inputs.
- Ensure consistency with the IETF language tag format (BCP 47).
- Improve the overall quality and consistency of the test suite.
These changes contribute to more robust and standardized language handling in the OpenVoiceOS ecosystem, which should help prevent potential issues related to inconsistent language code formatting.
ovos_core/intent_services/converse_service.py (4)
12-12
: LGTM: Import statement forstandardize_lang_tag
added correctly.The import of
standardize_lang_tag
fromovos_utils.lang
is correctly placed and necessary for the subsequent usage in the class methods.
283-283
: LGTM: Language tag standardization implemented inconverse
method.The use of
standardize_lang_tag(lang)
ensures consistent formatting of language tags before they are used in the session. This change aligns with the PR objective of standardizing language handling across the system.
388-388
: LGTM: Language tag standardization implemented inreset_converse
method.The use of
standardize_lang_tag(get_message_lang())
ensures consistent formatting of language tags when resetting the conversation. This change aligns with the PR objective and is consistent with the modification in theconverse
method.
Line range hint
1-413
: Summary: Successful implementation of language tag standardization.The changes in this file successfully implement the standardization of language tags in the
ConverseService
class. The modifications are minimal, focused, and consistent, affecting only the necessary parts of the code. These changes align well with the PR objectives and should improve the consistency of language handling across the system.Key points:
- Proper import of
standardize_lang_tag
function.- Consistent usage in both
converse
andreset_converse
methods.- No unintended alterations to the class structure or functionality.
The implementation looks solid and ready for integration.
test/end2end/session/test_converse.py (5)
24-24
: Approved: Standardized language code formatThe change from "en-us" to "en-US" standardizes the language code format, aligning it with ISO 639-1 and ISO 3166-1 alpha-2 standards. This modification supports the PR's objective of ensuring consistent language handling across the system.
88-88
: Approved: Consistent language code format in assertionsThis change maintains consistency with the earlier modification, updating the assertion to check for the standardized "en-US" language code. It ensures that the tests accurately verify the correct language code format throughout the system.
253-253
: Approved: Maintaining consistency in language code assertionsThis change continues the pattern of updating language code assertions from "en-us" to "en-US". It's crucial for maintaining consistency across all test assertions, ensuring that the entire test suite is aligned with the standardized language code format.
342-342
: Approved: Completed standardization of language code assertionsThis final change to "en-US" completes the standardization of language code assertions throughout the test file. These consistent updates ensure that all parts of the test suite are aligned with the new standardized language handling, supporting more reliable and accurate testing of language-related functionality.
Line range hint
24-342
: Summary: Successful standardization of language codes in test fileThe changes made to this test file consistently update the language code format from "en-us" to "en-US" across all assertions. This standardization aligns with the PR's objective of ensuring consistent language handling throughout the system. The modifications improve the accuracy and reliability of the tests without altering the core test logic or structure. These changes contribute to a more robust testing environment for language-related functionality in the OpenVoiceOS system.
ovos_core/intent_services/__init__.py (2)
32-32
: LGTM: New import for language standardization.The addition of
standardize_lang_tag
fromovos_utils.lang
is appropriate for the changes made throughout the file to standardize language handling.
Line range hint
1-758
: Overall assessment: Improved language handling and API deprecation.The changes made to this file significantly improve the consistency of language handling by using
standardize_lang_tag
throughout theIntentService
class. The addition of deprecation warnings for several properties is a good practice for maintaining backwards compatibility while encouraging users to migrate to new APIs.Some minor suggestions for improvements have been made, including:
- Enhancing error handling in some methods.
- Improving logging for better debugging.
- Using a constant for deprecation versions.
These changes contribute to the overall goal of standardizing language inputs and introducing support for dynamic dialects in pipeline plugins, as mentioned in the PR objectives.
test/end2end/session/test_get_response.py (8)
23-23
: LGTM: Language code standardizationThe update from "en-us" to "en-US" is correct and aligns with the standardization of language codes.
103-103
: LGTM: Consistent language code in assertionThe assertion has been correctly updated to use "en-US", maintaining consistency with the standardized language code format.
128-129
: LGTM: Consistent language code in speak message assertionThe assertion for the 'speak' message has been correctly updated to use "en-US", maintaining consistency with the standardized language code format.
145-146
: LGTM: Consistent language code in additional assertionThe assertion has been correctly updated to use "en-US", maintaining consistency with the standardized language code format throughout the test method.
166-167
: LGTM: Consistent language code for default sessionThe default session language code has been correctly updated to use "en-US", maintaining consistency with the standardized language code format.
311-312
: LGTM: Consistent language code in speak message assertionThe assertion for the speak message in this test method has been correctly updated to use "en-US", maintaining consistency with the standardized language code format across different test methods.
632-633
: LGTM: Consistent language code standardization across all test methodsThe assertion for the speak message in this test method has been correctly updated to use "en-US", maintaining consistency with the standardized language code format.
Overall, these changes ensure that all language code references in the test file use the standardized "en-US" format. This consistency is crucial for accurate testing and aligns with the PR objective of standardizing language handling across the system.
Line range hint
1-1161
: Summary: Successful implementation of language code standardizationThis review has confirmed that all instances of the language code have been successfully updated from "en-us" to "en-US" throughout the test file. These changes are consistent and align perfectly with the PR objective of standardizing language handling.
The updates ensure that:
- All test methods use the standardized language code format.
- All assertions related to language codes have been updated.
- The default session language code has been standardized.
These changes contribute to the overall goal of ensuring that intents match regardless of the case used in language codes, as stated in the PR objectives.
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: 1
🧹 Outside diff range and nitpick comments (1)
test/unittests/test_intent_service.py (1)
114-116
: LGTM: Comprehensive language code standardizationThe changes from 'de-de' to 'de-DE' and 'sv-se' to 'sv-SE' complete the standardization of language codes across the test suite. This ensures consistency and aligns with the PR objective of case-insensitive intent matching for language codes.
Consider adding a comment explaining the standardized format (e.g., "ISO 639-1 language code + ISO 3166-1 alpha-2 country code") to provide context for future developers.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- test/unittests/test_intent_service.py (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
test/unittests/test_intent_service.py (2)
106-106
: LGTM: Standardized language code formatThe change from 'it-it' to 'it-IT' standardizes the language code format, using uppercase country codes. This aligns with the ISO 639-1 language code standard and is consistent with the PR objective of standardizing language handling.
108-108
: LGTM: Consistent language code standardizationThe change from 'en-us' to 'en-US' maintains consistency with the previous change, standardizing the language code format across different languages in the test.
makes intents match regardless of upper or lowercase being used in lang code, and brings initial support for dynamic dialects in the pipeline plugins
companion PRs:
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Chores