Last active
March 26, 2023 11:36
-
-
Save Rajdave69/005a1c5de5f209b4aa563d234e14bb43 to your computer and use it in GitHub Desktop.
This simple python code checks if your/you're is used in its correct form.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This function checks if your/you're is used correctly in a sentence. | |
from gingerit.gingerit import GingerIt | |
parser = GingerIt() | |
def check_your_youre(text) -> str or None: | |
result = parser.parse(text) | |
for correction in result['corrections']: | |
if correction["correct"].lower() == "your" or correction["correct"].lower() == "you're": | |
return correction["correct"].lower() | |
return None | |
# The function will return what is to be fixed. | |
# eg - if you're is used in place of your, it will return "your" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment