Skip to content

Added command parser integration#30

Merged
vannu07 merged 5 commits intovannu07:mainfrom
ZarrarPeshimam:feature/parser-integration
Oct 22, 2025
Merged

Added command parser integration#30
vannu07 merged 5 commits intovannu07:mainfrom
ZarrarPeshimam:feature/parser-integration

Conversation

@ZarrarPeshimam
Copy link
Copy Markdown
Contributor

@ZarrarPeshimam ZarrarPeshimam commented Oct 22, 2025

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:

  • Updated command_parser to recognize alternative phrasings for common commands (e.g., “time now”, “current time”)
  • Added intent-action mapping via handle_user_text()
  • Added fuzzy matching for minor misspellings
  • Integrated text-based testing for 10+ common commands
  • Connected parser to backend.feature for handling actions like YouTube playback, WhatsApp messaging/calls, opening apps, and chatbot responses
  • Audio input hook added in hotword() using takecommand() for future testing

Testing:

  • All new command variations successfully recognized in text-based testing
  • Tested at least 10 common commands including synonyms and minor typos
image

Note:

  • Audio input testing not performed due to microphone/setup issues
  • However, Logic is still fully verified; audio → text conversion workflow is expected to work once audio is enabled

Checklist:

  • Text-based commands recognized correctly
  • Synonyms and minor typos handled
  • Intent mapped to corresponding actions
  • Feature integration ready for audio input

@vannu07, plz review my PR for hacktober.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Message that will be displayed on users' first pull request

@vannu07 vannu07 requested a review from Copilot October 22, 2025 11:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread backend/feature.py Outdated
Comment thread backend/feature.py Outdated
Comment thread backend/feature.py Outdated
vannu07 and others added 3 commits October 22, 2025 16:44
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>
@vannu07 vannu07 added enhancement New feature or request help wanted Extra attention is needed hacktoberfest hacktoberfest-accepted labels Oct 22, 2025
@vannu07
Copy link
Copy Markdown
Owner

vannu07 commented Oct 22, 2025

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 backend/feature.py is well-structured.

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: Black Code Formatter and isort. These are standard checks to maintain consistent code style across the project.

Please run the following commands locally on your branch, commit the changes, and push again:

  1. For Black (Code Formatting):

    black .
  2. For isort (Import Sorting):

    isort .

Once those checks pass, this PR is good to merge! Thanks for the excellent contribution, and happy Hacktoberfest!

@vannu07 vannu07 merged commit 7e49633 into vannu07:main Oct 22, 2025
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request hacktoberfest hacktoberfest-accepted help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants