Added command parser integration#30
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR integrates a flexible command parser into Jarvis that handles natural language variations, synonyms, and minor typos. It introduces fuzzy matching to map user input to predefined intents and connects these intents to corresponding actions.
Key Changes:
- Added fuzzy matching-based command parser with intent-to-phrase mappings
- Integrated parser with audio hotword detection and command execution flow
- Created text-based testing interface for validating command recognition
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
testing/text_test.py |
Adds interactive text-based test interface for command parser validation |
backend/nlp/command_parser.py |
Implements fuzzy matching command parser with intent mappings for common commands |
backend/feature.py |
Integrates parser into hotword detection flow and refactors command handling logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| # Find best match among all phrases | ||
| best_match, score = process.extractOne(user_input, all_phrases.keys(), scorer=fuzz.token_sort_ratio) | ||
|
|
||
| if score > 70: # Adjust threshold based on testing |
There was a problem hiding this comment.
The hardcoded threshold value of 70 lacks context and may need adjustment for different use cases. Consider extracting this as a named constant (e.g., FUZZY_MATCH_THRESHOLD = 70) at the module level with a comment explaining the rationale for this value.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Great work @ZarrarPeshimam on this PR! The logic for the flexible command parser, synonym handling, and fuzzy matching looks solid and is a fantastic improvement for Jarvis's natural language capabilities. The integration with I see you've already addressed the helpful suggestions from Copilot, which is excellent! Before merging, we just need to resolve the two failing checks:
Once those checks pass, this PR is good to merge! Thanks for the excellent contribution, and happy Hacktoberfest! |
Description:
This PR improves Jarvis’ command parser to handle flexible phrasing, synonyms, and minor typos. It maps multiple expressions of the same command to the correct intent and triggers the corresponding action.
close issue: #2
Changes Made:
command_parserto recognize alternative phrasings for common commands (e.g., “time now”, “current time”)handle_user_text()backend.featurefor handling actions like YouTube playback, WhatsApp messaging/calls, opening apps, and chatbot responseshotword()usingtakecommand()for future testingTesting:
⚠ Note:
Checklist:
@vannu07, plz review my PR for hacktober.