mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-09-22 04:50:46 +02:00
feat: complete M3 Web UI Enhancement milestone with include/exclude cards, fuzzy matching, mobile responsive design, and performance optimization
- Include/exclude cards feature complete with 300+ card knowledge base and intelligent fuzzy matching - Enhanced visual validation with warning icons and performance benchmarks (100% pass rate) - Mobile responsive design with bottom-floating controls, two-column layout, and horizontal scroll prevention - Dark theme confirmation modal for fuzzy matches with card preview and alternatives - Dual architecture support for web UI staging system and CLI direct build paths - All M3 checklist items completed: fuzzy match modal, enhanced algorithm, summary panel, mobile responsive, Playwright tests
This commit is contained in:
parent
0516260304
commit
cfcc01db85
37 changed files with 3837 additions and 162 deletions
54
debug_bolt_scoring.py
Normal file
54
debug_bolt_scoring.py
Normal file
|
@ -0,0 +1,54 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Debug the normalization and scoring for Lightning Bolt specifically"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'code'))
|
||||
|
||||
from deck_builder.include_exclude_utils import normalize_punctuation, fuzzy_match_card_name
|
||||
import pandas as pd
|
||||
|
||||
# Test normalize_punctuation function
|
||||
print("=== Testing normalize_punctuation ===")
|
||||
test_names = ["Lightning Bolt", "lightning bolt", "Lightning-Bolt", "Lightning, Bolt"]
|
||||
for name in test_names:
|
||||
normalized = normalize_punctuation(name)
|
||||
print(f"'{name}' → '{normalized}'")
|
||||
|
||||
# Load cards and test fuzzy matching
|
||||
print(f"\n=== Loading cards ===")
|
||||
cards_df = pd.read_csv('csv_files/cards.csv')
|
||||
available_cards = set(cards_df['name'].dropna().unique())
|
||||
|
||||
print(f"Cards loaded: {len(available_cards)}")
|
||||
print(f"Lightning Bolt in cards: {'Lightning Bolt' in available_cards}")
|
||||
|
||||
# Test fuzzy matching for 'bolt'
|
||||
print(f"\n=== Testing fuzzy match for 'bolt' ===")
|
||||
result = fuzzy_match_card_name('bolt', available_cards)
|
||||
print(f"Input: bolt")
|
||||
print(f"Matched: {result.matched_name}")
|
||||
print(f"Confidence: {result.confidence:.3f}")
|
||||
print(f"Auto-accepted: {result.auto_accepted}")
|
||||
print(f"Top suggestions: {result.suggestions[:5]}")
|
||||
|
||||
# Test fuzzy matching for 'lightn'
|
||||
print(f"\n=== Testing fuzzy match for 'lightn' ===")
|
||||
result = fuzzy_match_card_name('lightn', available_cards)
|
||||
print(f"Input: lightn")
|
||||
print(f"Matched: {result.matched_name}")
|
||||
print(f"Confidence: {result.confidence:.3f}")
|
||||
print(f"Auto-accepted: {result.auto_accepted}")
|
||||
print(f"Top suggestions: {result.suggestions[:5]}")
|
||||
|
||||
# Manual check of scores for Lightning cards
|
||||
print(f"\n=== Manual scoring for Lightning cards ===")
|
||||
from difflib import SequenceMatcher
|
||||
|
||||
input_test = "lightn"
|
||||
lightning_cards = [name for name in available_cards if 'lightning' in name.lower()][:10]
|
||||
|
||||
for card in lightning_cards:
|
||||
normalized_card = normalize_punctuation(card)
|
||||
score = SequenceMatcher(None, input_test.lower(), normalized_card.lower()).ratio()
|
||||
print(f"{score:.3f} - {card}")
|
Loading…
Add table
Add a link
Reference in a new issue