Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
DianaHoefels authored Apr 20, 2024
1 parent 060513f commit d7a88c9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scripts/count_misspelled_words.py
Original file line number Diff line number Diff line change
@@ -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 <filename>")
sys.exit(1)

filename = sys.argv[1]
misspelled_words_count = count_misspelled_words(filename)
print("Total number of misspelled words:", misspelled_words_count)

0 comments on commit d7a88c9

Please sign in to comment.