We can have a look at the 4 issues that it found:Īnd we get: Match() Text = "Your the best but their are allso good !" Tool = language_tool_python.LanguageTool('en-US') I would suggest the language-tool-python. If you want robustness and wide-coverage, use a statistical parser. If you want very precise control over what is considered grammatical, use a context-free parser with NLTK. So, it really depends on exactly what your goal is. The downside is that sometimes the parser will still return a parse for a sentence with bad grammar because it will use the statistics to make the best guess possible. These are statistical parsers that will be able to understand sentences even if they haven't seen all the words or all the grammatical constructions before. Chapter 8 of the NLTK book covers parsing and should explain what you need to know.Īn alternative would be to write a python interface to a wide-coverage parser (like the Stanford parser or C&C). These grammars may not have the widest coverage (eg, it might not know how to handle a word like StackOverflow), but this approach will allow you to say specifically what is valid or invalid in the grammar. If the sentence parses, then it has valid grammar if not, then it doesn't. You can define a grammar, or use one that is provided, along with a context-free parser. They have support for grammars that you can use to parse your sentence. Noted in comments by Patrick.Ĭheck out NLTK. There is a curated list of grammar checkers on Open Office website. It should be possible to script Microsoft Word and use its grammar checking functionality. GingerĪdditionally, this is a hacky (screen scraping) library for Ginger, arguably one of the most polished free-to-use grammar checking options out there. It is also possible to run the server side privately. 'A sentence with an error in the Hitchhiker’s Guide to the Galaxy' > text = 'A sentence with a error in the Hitchhiker’s Guide tot he Galaxy' > tool = language_check.LanguageTool('en-US') It is possible to run the server application on your own machine, 4 GB RAM is recommended. Print "some suggestions: %s" % (", ".join(error.suggestions),)Įxpected output: grammar error for: Looking **too the** Print "%s error for: %s **%s**" % (error.type, error.precontext, error.string) After the Deadline import ATDĮrrors = ATD.checkDocument("Looking too the water. If a rule does not match, the software does nothing (it cannot detect errors it does not have rules for). If a rule matches, the software calls it an error. The checked text is compared with a large set of rules describing common errors. Some have a Python library to simplify querying.Īs far as I can tell, most of those tools (certainly After the Deadline and LanguageTool) are rule based. There are various Web Services providing automated proofreading and grammar checking.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |