Normalize CPE guessing/indexing for dashed and underscored names#30
Open
adulau wants to merge 1 commit into
Open
Normalize CPE guessing/indexing for dashed and underscored names#30adulau wants to merge 1 commit into
adulau wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
rocket-launcher,rocket_launcher, androcket launcherto miss matches.-,_, or spaces.Description
_normalize_keywordstoCPEGuesserwhich lowercases and splits input keywords on spaces, underscores, and dashes usingre.split(r"[\s_-]+", ...), and use the normalized tokens for set intersection and scoring.canonizeinlib/cpeimport/base.pyto split vendor/product strings with the samere.split(r"[\s_-]+", ...)rule so hyphenated names are indexed as component words.tests/test_cpeguesser.pyto verify guessing works forrocket-launcher,rocket_launcher, androcket launcher.tests/test_nvd_json.pyto verify hyphenated vendor/product values are split and indexed into component words.Testing
PYTHONPATH=. pytest -q tests/test_cpeguesser.py tests/test_nvd_json.pyand the tests passed (both files green).PYTHONPATH=. pytest -qand observed all tests passing (12 passed).pytest -qrun withoutPYTHONPATH=.failed to import thelibpackage in this environment, so test runs shown above use the correctPYTHONPATHto validate changes.Codex Task