Beingamanforever

grammatical error correction

Apr 8th, 2024
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. pip install language-tool-python
  2.  
  3. import language_tool_python
  4.  
  5. mytext = """ # would be our text block
  6. I is testng grammar tool using python. It does not costt anythng.
  7. """
  8.  
  9. def grammarCorrector(text):
  10.     tool = language_tool_python.LanguageTool('en-US')
  11.     result = tool.correct(text)
  12.     return result
  13.  
  14. output_data = grammarCorrector(mytext) # corrected result is stored here
  15. print(output_data)
Advertisement
Add Comment
Please, Sign In to add comment