Check if a word is correct
To check if a word is correct, you need to use the is_correct
method of the Proofreader
class. This method takes a word as an argument and returns a boolean value indicating whether the word is spelled correctly or not.
For example, suppose you have created an instance of the Proofreader
class called pr
:
Then, you can check if a word is correct by calling the is_correct
method on pr
and passing the word as an argument:
The is_correct
method compares the word with the words in the wordlist file. If the word is found in the wordlist file, it returns True. Otherwise, it returns False.
You can also check multiple words at once by using a loop or a list comprehension:
The is_correct
method is case-insensitive, which means that it does not matter if the word is in uppercase, lowercase, or mixed case. The method will convert the word to lowercase before comparing it with the words in the wordlist file. For example:
All of these words are considered correct, because they are the same as “hello” in lowercase.
Last updated