Skip to content

Commit

Permalink
Changed the code logic and deleted subject_code category from the top…
Browse files Browse the repository at this point in the history
…ics.py
  • Loading branch information
Thanuboyapati committed Nov 1, 2024
1 parent 2fd4b13 commit 4587fb0
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions src/poprox_recommender/topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,8 @@ def extract_locality_topics(article: Article) -> set[str]:
return article_topics.intersection(locality_topics)


def extract_locality_codes(article: Article) -> set[str]:
if "raw_data" in article and "subject" in article.raw_data:
article_codes = set([sub.code for sub in article.raw_data.subject if sub.code and len(sub.code) == 1])
locality_codes = ["a", "i", "w"]
return article_codes.intersection(locality_codes)
return []


def extract_locality(article: Article) -> list[str]:
topics = extract_general_topics(article)
codes = extract_locality_codes(article)

us_criteria = ("U.S. news" in topics) or ("a" in codes)

Check failure on line 28 in src/poprox_recommender/topics.py

View workflow job for this annotation

GitHub Actions / Report lint failures

Ruff (F821)

src/poprox_recommender/topics.py:28:54: F821 Undefined name `codes`
world_criteria = ("World news" in topics) or ("i" in codes)

Check failure on line 29 in src/poprox_recommender/topics.py

View workflow job for this annotation

GitHub Actions / Report lint failures

Ruff (F821)

src/poprox_recommender/topics.py:29:58: F821 Undefined name `codes`
Expand Down

0 comments on commit 4587fb0

Please sign in to comment.