Clone wiki

after_the_deadline / Home

Python wrapper for After the Deadline API

Installation and Requirements

The default branch should work with Python 2.5 and its standard libraries.

The Python3 branch should work with Python 3.1 and its standard libraries.

Idea

The idea behind this code is to provide wrapper methods and classes for accessing After the Deadline API and returning python objects for easy usage. You can know more about After the Deadline on their homepage.

Currently supported methods are:

  • checkDocument which returns a list of Error objects with the following properties:
    • string the wrong part
    • description error description
    • precontext what comes just before the wrong part
    • type of the error...
    • url url to obtain page with pretty error explanation
    • suggestions list of strings with the suggested alternatives
  • stats which returns a list of Metric objects with the following properties:
    • type
    • key
    • value

Usage

Example interactions with the python shell

Checking document for errors

import ATD
ATD.setDefaultKey("your API key")
errors = ATD.checkDocument("Looking too the water. Fixing your writing typoss.")
for error in errors:
	print "%s error for: %s **%s**" % (error.type, error.precontext, error.string)
	print "some suggestions: %s" % (", ".join(error.suggestions),)

Expected output:

grammar error for: Looking **too the**
some suggestions: to the
spelling error for: writing **typoss**
some suggestions: typos

Obtaining stats

import ATD
ATD.setDefaultKey("your API key")
metrics = ATD.stats("Looking too the water. Fixing your writing typoss.")
print [str(m) for m in metrics]

Expected output:

['spell(misused words:1)', 'spell(raw:1)', 'stats(sentences:2)', 'stats(words:8)']

Feedback (bug reports, suggestions, etc...)

Submit an issue or contact me on gmail at miguel.ventura.

Updated