Skip to content

Refactor learning engine to V2: weighted keyword matching and scenario-aware evaluation - #46

Open
ananya092302 wants to merge 2 commits into
vicharanashala:mainfrom
ananya092302:main
Open

Refactor learning engine to V2: weighted keyword matching and scenario-aware evaluation#46
ananya092302 wants to merge 2 commits into
vicharanashala:mainfrom
ananya092302:main

Conversation

@ananya092302

Copy link
Copy Markdown

What this PR does:

changeLog.md

Rewrites the core learning engine (learningEngine.js) to fix incorrect concept mapping and make evaluation context-aware.

Problem

The V1 engine used flat .includes() matching on a single keyword list. Common words like "store" and "value" triggered incorrect concepts (lists and dictionaries) even when the learner was clearly describing a variable assignment. The engine also had no awareness of what the active scenario actually expected.

Changes

learningEngine.js

  • Split keywords into primary (technical terms) and secondary (conversational terms) tiers
  • Primary keywords trigger instantly; secondary keywords require at least two matches to activate
  • Pre-compiled regex with word boundaries replaces .includes() for accurate matching
  • Added a dedicated Data storage rule for variable-related reasoning
  • Engine now receives the active scenario object and cross-references detected concepts against expected ones
  • Over-engineering feedback now suggests what the learner should try instead
  • Code generation builds output dynamically based on detected concept combinations
  • Prompt evaluation checks whether the learner mentioned scenario-relevant Python concepts
  • Added concept-specific misconception detection (e.g., warns against manual repetition when a loop is expected)

sessions.js

  • Updated route handlers to pass the scenario object into all engine functions

Docs

  • Added CHANGELOG.md
  • Updated README.md to reflect the V2 engine

Testing

Tested locally against the Bag Weight Label scenario. Verified that typing "I will store the value in x" now correctly maps to variables instead of lists/dictionaries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant