fix: correct title keywords extraction to return proper word-frequency pairs
Co-authored-by: aider (ollama_chat/qwen3-coder:30b) <aider@aider.chat>
This commit is contained in:
@@ -83,13 +83,12 @@ def extract_title_keywords(data):
|
|||||||
re_word = re.sub(r"[^a-zA-Z\-]", "", word.lower())
|
re_word = re.sub(r"[^a-zA-Z\-]", "", word.lower())
|
||||||
if re_word not in stop_words and re_word != "":
|
if re_word not in stop_words and re_word != "":
|
||||||
title_keywords.append(re_word)
|
title_keywords.append(re_word)
|
||||||
return title_keywords
|
return Counter(title_keywords).most_common(30)
|
||||||
|
|
||||||
|
|
||||||
def print_title_keywords(data):
|
def print_title_keywords(data):
|
||||||
title_keywords = extract_title_keywords(data)
|
title_keywords = extract_title_keywords(data)
|
||||||
count_title_words = Counter(title_keywords).most_common(30)
|
pprint(title_keywords)
|
||||||
pprint(count_title_words)
|
|
||||||
|
|
||||||
|
|
||||||
def histogram(data):
|
def histogram(data):
|
||||||
|
|||||||
Reference in New Issue
Block a user