Fix #159: Resolve AttributeError in design_system and search blindnes…#160
Open
YangKuoshih wants to merge 1 commit intonextlevelbuilder:mainfrom
Open
Fix #159: Resolve AttributeError in design_system and search blindnes…#160YangKuoshih wants to merge 1 commit intonextlevelbuilder:mainfrom
YangKuoshih wants to merge 1 commit intonextlevelbuilder:mainfrom
Conversation
… search blindness in core
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.
Closes #159
Description of Changes
This PR addresses the two specific bugs reported in issue #159 that were causing the design system generator to crash and search queries to fail for short acronyms.
1.
AttributeErrorFix (design_system.py)The Problem: When calling persist_design_system without an explicit
project_name(defaulting toNone), the execution attempted to runproject_name.lower(), resulting in anAttributeError.The Fix: Added explicit handling to fallback checking
if project_name is not None else "default", ensuring a valid string is always present before string manipulation occurs.2. Search Blindness Fix (core.py)
The Problem: The BM25 algorithm's tokenize function was dropping any search query terms with a length of 2 or less. This created "search blindness" for critical industry acronyms like
UI,UX,3D, andAI.The Fix: Updated the length filter constraint in core.py from
> 2to> 1to allow 2-letter tokens to be properly indexed and searched against the CSV database.QA & Testing Instructions
To verify these fixes locally, the following tests were conducted:
1. Testing
project_name=NoneFallback:Ran a generation pass strictly passing no project name:
generate_design_system('SaaS dashboard', project_name=None, persist=True)
./design-system/default/directory and wroteMASTER.mdwithout crashing.2. Testing Search Blindness Fix:
Ran design system generations using 2-letter queries that were previously ignored:
generate_design_system('UI dashboard', persist=True)
generate_design_system('UX dashboard', persist=True)