Check for exact matches

merge-requests/30/head
Bob Mottram 2024-01-10 14:04:53 +00:00
parent dbf5a9ecbd
commit f6d11bdc4e
1 changed files with 8 additions and 0 deletions

View File

@ -272,9 +272,17 @@ def guess_hashtag_category(tag_name: str, hashtag_categories: {},
category_matched = ''
tag_matched_len = 0
finished = False
for category_str, hashtag_list in hashtag_categories.items():
if finished:
break
for hashtag in hashtag_list:
if hashtag == tag_name:
# exact match
category_matched = category_str
finished = True
break
if len(hashtag) < min_tag_length:
# avoid matching very small strings which often
# lead to spurious categories