File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ from english_words import get_english_words_set
2
+ from rich import print
3
+
4
+ wordList = get_english_words_set (['web2' ], lower = True )
5
+
6
+ def CheckWords (argWordList : str ) -> list [str ]:
7
+ """Checks if words are correct by looping through provided string and checking if the lowered string is in the Standard English Dictionary"""
8
+
9
+ checked = []
10
+
11
+ for word in argWordList .split ():
12
+ if word .casefold () in wordList :
13
+ checked .append (f"[green]{ word } [/green]" )
14
+ else :
15
+ checked .append (f"[red]{ word } [/red]" )
16
+
17
+ return checked
18
+
19
+ # Main Loop
20
+ while True :
21
+ userInput = input ("Please type in a sentence and press enter to check: " )
22
+
23
+ checkedWorldList = CheckWords (userInput )
24
+
25
+ # Turns List to string
26
+ consoleOutput = " " .join (checkedWorldList )
27
+
28
+ print (consoleOutput )
You can’t perform that action at this time.
0 commit comments