feat: Initial commit

This commit is contained in:
2024-03-22 17:01:42 +01:00
parent 954985f39a
commit c343ff6e93
106 changed files with 143428 additions and 1 deletions

42
spellcheck.py Normal file
View File

@@ -0,0 +1,42 @@
from os import WNOHANG
def clean(word: str):
a = len(word)
while True:
word = word.strip("()[]{}!?.,<>:;-_`")
if a == len(word):
break
a = len(word)
return word
def file_to_set(filename: str, clear: bool):
dfio = open(filename, "r", encoding="cp1252")
words = set()
for line in dfio:
for word in line.strip().split():
if clear:
word = clean(word)
if word == "":
continue
words.add(word.lower())
dfio.close()
return words
def main():
dictionary = file_to_set("words.txt", False)
document = file_to_set("ge.txt", True)
misspelling = dictionary.difference(document)
for word in sorted(misspelling):
print(word)
main()