feat: scaffold FastAPI backend with ports-and-adapters layout
This commit is contained in:
parent
adcf4b9df6
commit
1f40d064ad
25 changed files with 973 additions and 22 deletions
13
backend/app/domain/matching.py
Normal file
13
backend/app/domain/matching.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"""Fuzzy grounding: decide whether a search hit matches an LLM candidate."""
|
||||
|
||||
from difflib import SequenceMatcher
|
||||
|
||||
|
||||
def normalize(text: str) -> str:
|
||||
"""Lowercase and strip decorations that vary across releases."""
|
||||
return text.lower().strip()
|
||||
|
||||
|
||||
def title_similarity(candidate_title: str, catalog_title: str) -> float:
|
||||
"""Ratio in [0, 1] between a proposed title and a catalog title."""
|
||||
return SequenceMatcher(None, normalize(candidate_title), normalize(catalog_title)).ratio()
|
||||
Loading…
Add table
Add a link
Reference in a new issue