This commit is contained in:
OneNewDev 2022-05-28 15:17:33 +02:00
parent fba3f789bb
commit f09d42433f

View file

@ -11,7 +11,7 @@ OUTPUT_FILE = 'tags.json'
TAGS_PER_ARTICLE = 5
JSON_INDENT = 2
upper_check = re.compile(r'[A-Z]')
UPPER_CHECK = re.compile(r'[A-Z]')
@dataclass
@ -48,7 +48,7 @@ class FileScanner(HTMLParser):
score *= 4
if len(word) <= 3:
score //= 2
upper_letters_count = len(upper_check.findall(tag_name))
upper_letters_count = len(UPPER_CHECK.findall(tag_name))
score += upper_letters_count * 5
if word not in words_with_usage:
words_with_usage[word] = Tag(name=tag_name, score=score)