diff --git a/categories.py b/categories.py index 1bfce9a3c..34b4f22ef 100644 --- a/categories.py +++ b/categories.py @@ -262,11 +262,11 @@ def set_hashtag_category(base_dir: str, hashtag: str, category: str, return False -def guess_hashtag_category(tagName: str, hashtag_categories: {}) -> str: +def guess_hashtag_category(tag_name: str, hashtag_categories: {}) -> str: """Tries to guess a category for the given hashtag. This works by trying to find the longest similar hashtag """ - if len(tagName) < 4: + if len(tag_name) < 6: return '' category_matched = '' @@ -274,12 +274,12 @@ def guess_hashtag_category(tagName: str, hashtag_categories: {}) -> str: for category_str, hashtag_list in hashtag_categories.items(): for hashtag in hashtag_list: - if len(hashtag) < 4: + if len(hashtag) < 6: # avoid matching very small strings which often # lead to spurious categories continue - if hashtag not in tagName: - if tagName not in hashtag: + if hashtag not in tag_name: + if tag_name not in hashtag: continue if not category_matched: tag_matched_len = len(hashtag)