Skip to content

Fix: Preserve punctuation in tokenization to prevent skill collisions… - #1187

Open
desireddymohithreddy0925 wants to merge 12 commits into
komalharshita:mainfrom
desireddymohithreddy0925:fix/issue-1169-tokenize-punctuation
Open

Fix: Preserve punctuation in tokenization to prevent skill collisions…#1187
desireddymohithreddy0925 wants to merge 12 commits into
komalharshita:mainfrom
desireddymohithreddy0925:fix/issue-1169-tokenize-punctuation

Conversation

@desireddymohithreddy0925

Copy link
Copy Markdown

Summary

This PR fixes issue #1169 where the ML similarity tokenization function stripped out critical punctuation from skills like "C++" and "C#". The _tokenize() function was using a regex (r"[a-z0-9]+") that ignored symbols like +, #, ., and -, causing different skills to incorrectly match as identical tokens. By updating the regex to r"[a-z0-9\+#\.-]+", meaning-bearing symbols in programming languages are now correctly preserved, resulting in accurate similarity scoring.

Related Issue

Closes #1169

Type of Change

  • Bug fix — resolves a broken behaviour
  • Feature — adds new functionality
  • Data — adds new projects to data/projects.json
  • Documentation — updates docs, README, or code comments only
  • Style — CSS or visual changes only, no logic change
  • Refactor — restructures code without changing behaviour
  • Test — adds or updates tests

What Was Changed

File Change made
src/utils/recommender.py Updated the regex in _tokenize() from r"[a-z0-9]+" to r"[a-z0-9\+#\.-]+" to preserve important symbols commonly found in programming languages.

How to Test This PR

  1. Clone this branch: git checkout fix/issue-1169-tokenize-punctuation
  2. Install dependencies: pip install -r requirements.txt
  3. Run the app: python app.py
  4. Add a test project that requires "C++", then submit a user request with the skill "C#". The similarity score should no longer incorrectly return a near 100% match.
  5. Run the tests: python tests/test_basic.py (or pytest tests/test_basic.py)

Expected test output:

27 passed, 0 failed out of 27 tests

Test Results

============================= test session starts ==============================
platform darwin -- Python 3.x.x, pytest-x.x.x, pluggy-x.x.x
rootdir: /Users/desireddymohithreddy/GSSOC2026DevPath/DevPathMRD
collected 27 items                                                             

tests/test_basic.py ...........................                          [100%]

============================== 27 passed in 0.12s ==============================

Self-Review Checklist

  • I have read CONTRIBUTING.md and followed all guidelines
  • My branch name follows the convention: feat/, fix/, docs/, data/, style/, test/
  • I have run python tests/test_basic.py and all 27 tests pass
  • I have run flake8 . locally and there are no errors
  • I have not introduced any print() or console.log() debug statements
  • Every new function I wrote has a docstring
  • I have not modified files outside the scope of the linked issue
  • If I changed the UI, I tested it at 375px (mobile) and 1280px (desktop)
  • If I added a project to the dataset, it has all required JSON fields

Notes for Reviewer

None

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc-2026 type:bug Something isn't working labels Jun 26, 2026
@komalharshita komalharshita added the need review Further information is requested label Jul 30, 2026
@komalharshita

Copy link
Copy Markdown
Owner

@desireddymohithreddy0925 kindly resolve the merge conflicts asap

@desireddymohithreddy0925

Copy link
Copy Markdown
Author

@komalharshita done mam

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

Labels

data gssoc-2026 need review Further information is requested type:bug Something isn't working type:testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: _tokenize strips punctuation causing critical skills like C++ and C# to collide

2 participants