Skip to content

Instantly share code, notes, and snippets.

@Rajdave69
Last active March 26, 2023 11:36
Show Gist options
  • Save Rajdave69/005a1c5de5f209b4aa563d234e14bb43 to your computer and use it in GitHub Desktop.
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 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