From d7a88c9c66da9e4dd36f77088a193d7eb5846dca Mon Sep 17 00:00:00 2001 From: Diana Constantina Hoefels <38501557+DianaHoefels@users.noreply.github.com> Date: Sat, 20 Apr 2024 11:43:42 +0200 Subject: [PATCH] Add files via upload --- scripts/count_misspelled_words.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 scripts/count_misspelled_words.py diff --git a/scripts/count_misspelled_words.py b/scripts/count_misspelled_words.py new file mode 100644 index 0000000..52000e1 --- /dev/null +++ b/scripts/count_misspelled_words.py @@ -0,0 +1,22 @@ +import sys + +def count_misspelled_words(filename): + misspelled_count = 0 + with open(filename, 'r') as file: + for line in file: + if not line.startswith('#') and line.strip(): + parts = line.split('\t') + if len(parts) > 9: + misc_column = parts[9] + if 'CorrectForm=' in misc_column: + misspelled_count += 1 + return misspelled_count + +if __name__ == '__main__': + if len(sys.argv) != 2: + print("Usage: python count_misspelled_words.py ") + sys.exit(1) + + filename = sys.argv[1] + misspelled_words_count = count_misspelled_words(filename) + print("Total number of misspelled words:", misspelled_words_count)