From cc292c846f87892a3c942681b07ec1913b6729b9 Mon Sep 17 00:00:00 2001 From: Mark Eaton Date: Tue, 17 Dec 2024 20:57:21 -0500 Subject: [PATCH] fix problem with .lower(); add total journals count --- parse.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parse.py b/parse.py index a4009a6..e64cd1e 100644 --- a/parse.py +++ b/parse.py @@ -28,6 +28,7 @@ def extract_journal_titles(data): journal_titles.append(row[3]) count_journal_titles = Counter(journal_titles).most_common(20) pprint(count_journal_titles) + print("Total journals: " + str(len(set(journal_titles)))) def extract_title_keywords(data): @@ -37,10 +38,10 @@ def extract_title_keywords(data): raw_words = row[2].split(' ') row_words = [] for word in raw_words: - re_word = re.sub(r'[^a-zA-Z\-]', '', word) + re_word = re.sub(r'[^a-zA-Z\-]', '', word.lower()) if re_word not in stop_words: - re_words.append(re_word.lower()) - row_words.append(re_word.lower()) + re_words.append(re_word) + row_words.append(re_word) title_keywords = [(word, row_words) for word in re_words] return title_keywords @@ -80,7 +81,6 @@ def dash_viz(data): for edge1, edge2 in edges: if edge1 and edge2: output_data.append({'data': {'source': edge1, 'target': edge2}}) - pprint(output_data) with open('viz_data.json', 'w') as file: json.dump(output_data, file)