Skip to content

Commit

Permalink
fix(linker): add all titles of match templates, not category
Browse files Browse the repository at this point in the history
  • Loading branch information
nsantacruz committed Oct 28, 2024
1 parent fdff220 commit 64f4443
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sefaria/model/linker/category_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ class CategoryMatcher:
def __init__(self, lang: str, category_registry: list[Category]) -> None:
self._title_to_cat: dict[str, list[Category]] = defaultdict(list)
for cat in category_registry:
for title in cat.get_titles(lang):
self._title_to_cat[title] += [cat]
for match_template in cat.get_match_templates():
for term in match_template.get_terms():
for title in term.get_titles(lang):
self._title_to_cat[title] += [cat]

def match(self, raw_ref: RawRef) -> list[Category]:
return self._title_to_cat[raw_ref.text]
Expand Down

0 comments on commit 64f4443

Please sign in to comment.