After the Deadline

Three More Tools for Your Proofreader’s Toolbox

Posted in Proofing Tips by Michelle W. on January 10, 2014

Tools like After the Deadline are a great safety net, but you’ll still want to make sure your writing is clear and grammatically correct. Keep upping your grammar game with help from these three sites:

Daily Writing Tips has posts on everything from common grammar errors to homonyms (their, they’re, there) to rules for writing numbers, and beyond. It’s a great one-stop-shop to find answers to common writing questions, as well as the more obscure.

Grammar Girl dishes the dirt on grammar issues large (avoiding the passive voice) and small (knelt, or kneeled?). Best of all, her posts are quick, fun reads.

Apostrophe Abuse is great for a laugh, and for examples of what not to do. If you’ve ever rolled your eyes at a misplaced apostrophe on a flyer or billboard, this blog’s for you.

OpenOffice.org Grammar Checkers

Posted in Talking to myself by rsmudge on June 14, 2010

OpenOffice.org 3.2.1 was released a few weeks ago. To commemorate this, I’d like to write about the different proofreading tools available for this platform. It’s a common misconception that OpenOffice.org checks grammar out of the box. It doesn’t. OpenOffice.org does, however, have an API that lets developers add a grammar checker via an extension.

There are proofreading tools / grammar checkers for OpenOffice.org. A few that you may want to look at include:

Language Tool

Language Tool is a rule-based grammar checker with an impressive community developing rules for 18 languages. The inner-workings of this system were a heavy inspiration to AtD’s grammar checker implementation. We use Language Tool to check grammar for our French and German offerings of After the Deadline.

Readability Report

I saw Neil Newbold of the University of Surrey, the scientist developer of Readability Report, speak recently. I felt like I was listening to my proofreading brother from another mother. After the Deadline started life as a style checker hosted at PolishMyWriting.com. The AtD style checker uses best practices and suggestions from the Plain English movement to help you clean up your writing. Readability Report does the same thing for OpenOffice.org. It’s a style checker (rooted in Plain English) AND it’s a readability checker.

Some of the readability heuristics are incredible. Neil does some neat NLP work to decide which sentence is your simplest sentence and which sentences are your weirdest sentences. If you want to learn more about how these work, I recommend reading Neil’s paper The Linguistics of Readability: The Next Step for Word Processing that was presented at the  NAACL Computational Linguistics and Writing Workshop in Los Angeles, CA.

Coming Soon: After the Deadline for OpenOffice.org

Since you’re here, I presume you know about After the Deadline. It’s a proofreading software service. After the Deadline uses statistical language models to offer smarter grammar and style recommendations. It also uses the same language models to detect over 1,500 misused words. If you write weather when you mean whether, After the Deadline can help you.

Recently, I started developing an After the Deadline extension for OpenOffice.org. I was so excited when I started this, I couldn’t stop until I had a beta ready for you to try (yes, you can download and install it now). It’s really cool to use After the Deadline in a word processor, like OpenOffice.org Writer.

Because After the Deadline is a software service, this extension requires an internet connection to check your grammar, style, and misused words. If you’re not connected, it will silently do nothing. Rest assured, we’re not keeping your data and this extension communicates with our service over SSL.

The code is available in a public subversion repository and there is a category in the AtD ticket tracker for this OpenOffice.org extension.

Can we use crowd sourcing to improve AtD?

Posted in Talking to myself by rsmudge on May 27, 2010

I’ve written about learning from AtD use in the past. The main ideas I had back then were to bring more data into AtD’s corpus and analyze ignored phrases to find gaps in AtD’s dictionary. I put some time into these ideas but the initial results didn’t look too promising, so I backed off.

Recently, the operator of Online Rechtschreibprüfung 24/7 contacted me. His website offers German spell and grammar checking services (with a beta version using AtD). Neat stuff. Being the nice guy that he is, he is also giving back. His users have the option of marking a spelling mistake as false. He has collected this data and made it available to improve the German After the Deadline dictionary.

This got me to thinking. What could I do to PolishMyWriting.com to help you, help me, improve After the Deadline‘s English checking.

Here are some ideas:

  1. Add a “Not Misspelled?” menu item for spelling errors. This could collect a list of words that are candidates to be added to AtD’s dictionary, similar to what Online Rechtschreibprüfung 24/7 does.
  2. Add a “Not an error?” menu item for grammar and style errors. This could collect the error and the context around it.
  3. Add a “Better suggestion?” menu item for grammar, style, and misused word errors. Here you could input a better suggestion for an error.

These three things are pretty trivial to do. I’d also like to find a way to let users highlight errors that aren’t caught. I don’t have any ideas for magically learning from these suggestions. Right now I’d have to analyze each of them and develop rules to catch these errors.

Maybe an option to highlight some text, click Suggest an Error, and complete a short survey about what type of error the text contains.

What are your thoughts?

Add Grammar and Spell Check to Any WYSIWYG Editor

Posted in HOWTO by rsmudge on January 5, 2010

After the Deadline front-end libraries are available for jQuery and TinyMCE. You’ve asked what it would take to make AtD available in another WYSIWYG environment or even in a web-based word processor. In the past I’d answer that you’d need to study the code to either the jQuery or TinyMCE extensions, visit the mountains, meditate and wait for the answer to come.

Today I’m bringing the mountain to you. Much of the code that makes After the Deadline work in TinyMCE and jQuery is similar. Painfully similar. To the point where a bug in one is a bug in the other. I’ve refactored these extensions and created an After the Deadline Core UI module. This module is browser independent with no external dependencies. It provides functionality to parse the AtD XML into an error data structure, retrieve suggestions and other information given an error phrase and a word of context, and it also abstracts away the logic to traverse a DOM and insert the AtD markup for errors.

To test this module, I gave myself one working day to port After the Deadline to CKEditor. CKEditor is a WYSIWYG editor, similar to TinyMCE. I have never used CKEditor before and this was a challenge. Still, I was able to make it quite far and in this post, I’ll show you how to add AtD to an editor using the Core UI Module.

Here is what an After the Deadline editor plugin must do:

  1. The first step is to setup the AtD Core UI module:
    atd_core = new AtDCore();
  2. The next step is to define several functions that the AtD Core UI module expects. The module will use these functions to manipulate the DOM and find elements in the way that your environment expects. The full list of functions is documented in the AtD Core UI README. Here are a few of these functions from CKEditor:
    atd_core.replaceWith = function(old_node, new_node) {
       return new_node.replace(CKEDITOR.dom.element.get(old_node));
    };
    
    atd_core.create = function(node_html) {
       return CKEDITOR.dom.element.createFromHtml( '<span class="mceItemHidden">' + node_html + '</span>' );
    };
    
  3. Once these functions are defined you can set AtD-specific preferences like the list of strings to ignore and which types of errors to show.
    atd_core.showTypes('Complex Expression, Diacritical Marks, Double Negatives, Redundant Expression');
    atd_core.setIgnoreStrings('CKEditor, was thrown');
    
  4. When a user requests proofreading, it is up to you to extract the contents of the editor and post it to the After the Deadline service. Here is how I extract the editor contents in CKEditor:
    var editor_contents = editor.document.getBody().getHtml();
    
  5. You should receive an XML document from the server with an error message or a data structure containing the AtD data. To check the XML document for an AtD error:
    function ajax_callback(xml_response) {
       if (atd_core.hasErrorMessage(xml_response)) {
          alert(atd_core.getErrorMessage(xml_response));
          return;
       }
    
  6. If there are no errors then you’ll want to parse the XML into a data structure the Shared UI code can use. Use the processXML function to do this. It will return a JavaScript object that you will be using again.
    var results = atd_core.processXML(xml_response);
  7. Now, let’s say you want to highlight errors in your editor. Great! Extract the contents of the editor (should be an array of elements from the root element) and pass these to markMyWords. Using the prototypes you provided earlier, this function will walk through these nodes and highlight the errors. Be thankful that you didn’t have to write the code to do this.
    var nodes = editor.document.getDocumentElement().getChildren().getItem(1)['$'].childNodes;
    atd_core.markMyWords(nodes, results.errors);
    
  8. Earlier, I hope you attached a click or context menu listener to your editor. If you did you can use isMarkedElement on the event target when a click occurs in your editor. If this returns true, this is your clue that a user clicked on a marked error and you should display a menu offering them suggestions.To get the suggestions, call findSuggestion using the marked element. This will return a JavaScript object with the following members that may interest you: suggestions, description, moreinfo
    editor.contextMenu.addListener(function(element) {
       if (atd_core.isMarkedNode(element.$)) {
          var meta = atd_core.findSuggestion(element.$);
          var commands = {};
    
          addItem(editor, meta.description, function() { }, 0, commands, 'AtD_description');
    
          for (var x = 0; x < meta.suggestions.length; x++)
             addItem(editor, meta.suggestions[x], makeCallback(element.$, meta.suggestions[x]), x + 1, commands, 'AtD_suggestions');
    
          addItem(editor, 'Ignore', makeIgnoreCallback(element.$, element.$.innerHTML), 1, commands, 'AtD_ignore');
          addItem(editor, 'Ignore All', makeIgnoreAllCallback(element.$, element.$.innerHTML), 0, commands, 'AtD_ignore');
    
          return commands;
       }
    });
    
  9. For each suggestion, I use makeCallback to generate a function to attach to the menu item. This generated function calls applySuggestion in the Core UI Module. You should use applySuggestion as it’s smart enough to do what the suggestion asks. For example, the (omit) suggestion removes the word in question:
    var makeCallback = function(element, suggestion) {
       return function() {
          atd_core.applySuggestion(element, suggestion);
       };
    };
    
  10. You may want to add functionality to let the user ignore the current error or to ignore all occurrences of it. The “Ignore suggestion” menu item removes the marked node keeping its children. No need to call into the AtD Core UI module:
    var makeIgnoreCallback = function(element, word) {
       return function() {
          CKEDITOR.dom.element.get(element).remove(true);
    };
    

    To ignore all occurrences of an error, you can use the removeWords function in the Core UI Module.

    var makeIgnoreAllCallback = function(element, word) {
       return function() {
          atd_core.removeWords(undefined, word);
       };
    };
    
  11. The last thing you should do is attach a listener to remove the After the Deadline markup when the contents of the editor are grabbed. You can remove the AtD markup using the removeWords function.

And that’s it. Add in the necessary scaffolding for your editor and you have After the Deadline integration. Here are some other things you can do:

  • Make an Ignore Always menu option save the user’s preference in a cookie or on your server. Resurrect this setting later with the setIgnoreStrings function.
  • Keep track of the user’s preference for what types of errors to show. Use showTypes to enable these for the user.

These are the kinds of things we do in WordPress to make AtD a first-class feature for our users. If you’re looking to port After the Deadline to another environment, the AtD Core UI module will save you a lot of time.

Coming up I’ll be releasing versions of the AtD/jQuery and AtD/TinyMCE Extensions using this shared module. The AtD/CKEditor extension is available now.

WordCamp NYC Ignite: After the Deadline

Posted in Talking to myself by rsmudge on December 17, 2009

I see that the After the Deadline demonstration for WordCamp NYC has been posted. This short five-minute demonstration covers the plugin and its features.

Before you watch this video, can you find the error in each of these text snippets?

There is a part of me that believes that if I think about these issues, if I put myself through the emotional ringer, I somehow develop an immunity for my own family. Does writing a book about bullying protect your children from being bullied? No. I realize that this kind of thinking is completely ridiculous.’’

[Op-Ed] … Roberts marshaled a crusader’s zeal in his efforts to role back the civil rights gains of the 1960s and ’70s — everything from voting rights to women’s rights.

The success of Hong Kong residents in halting the internal security legislation in 2004, however, had an indirect affect on allowing the vigil here to grow to the huge size it was this year.

These examples come from the After Deadline blog, When Spell-Check Can’t Help. You can watch the video to learn how After the Deadline can help and what the errors are. You can also try these out at http://www.polishmywriting.com.

You can also view the WCNYC session on how embed After the Deadline into an application.

Follow

Get every new post delivered to your Inbox.

Join 291 other followers