develop an interface for grammar checkers

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Build ID: 20150224183107 Steps to reproduce: It would be great to have an interface in Firefox that allows add-on developers to plug in a grammar checker. Currently, adding grammar checking to Firefox as an add-on is very difficult: it requires using Javascript and DOM manipulations but the days of simple textareas are long gone, so any integration is very fragile. The user comments on existing grammar checker add-ons show that (https://addons.mozilla.org/en-US/firefox/addon/after-the-deadline-spell-and-g/ and https://addons.mozilla.org/en-US/firefox/addon/grammarly/). The more robust alternative is an integration that doesn't really underline errors in the textarea but opens a pop-up somewhere else, but that's not as user friendly. From the interface point of view, grammar checking is very similar to spell checking. These are the major differences: * A spell checker checks word by word -- a grammar checker needs the complete text * A spell checker returns true/false whether the word is correct and, optionally, a list of corrections -- a grammar checker returns a list of positions with errors and for each error: start position, end position, error message, optional: list of corrections Thus the interface takes the complete text and returns objects with errors it found. It probably also takes the input language of the text as an argument, as taken from the HTML 'lang' attributes. This is optional and the grammar checker will need to deal with this value being absent or even having a wrong value. As checking might be slow, it should be asynchronous and the grammar checker should return each error via some kind of call-back as soon as it finds them. Note that the grammar checker should get the complete text at once, as it might want to check for errors that are not on the sentence or paragraph level. The grammar checker might include spell checking or not, so it should be able to indicate that and traditional spell checking should be turned off if the grammar checker includes it. From the user interface, the results of grammar checking look a lot spell checking: incorrect text gets underlined, but maybe in a different color than the red used for spell checking. Also, not only single words get underlined but longer phrases. With a spell checker you can add words to your dictionary and make the error message disappear. This is a bit more complicated for grammar checking, as the error is not about single words being wrong, but about words in their context. Some kind of "ignore" option will be needed to turn off false alarms. I'll leave this out of this issue for now.