Pyapa — Not to be confused with a papaya

Pyapa interpreter usage

What is this?

This is a module for Python3 that checks for and suggests corrections for common errors in the APA style for scientific writing. It provides a class of objects with methods for matching text using robust regular expressions. Its design was inspired by the excellent language_check module.

This project was made out of a need for having an APA style checker for the IFS, when it became apparent that there was no existing console based tool. In no way does this project aim to cover the entire APA style guide, nor every possible error that would be considered in violation of the style guide, but it does cover some of the most common mistakes.

pyapa.ApaCheck object class

This class documents a series of regular expressions that match style errors.

The pyapa.ApaCheck.match() method generates an array of ApaMatch objects and stores them in the ApaCheck.Matches list for easy access.

pyapa.ApaMatch object class

This class contains some helper print functions, ApaMatch.print() and ApaMatch.sprint() to self-print to the console or a string respectively.

ApaMatch.target contains a string that matches the context of the error within the text that was analysed.

ApaMatch.feedback contains a string that describes the error.

ApaMatch.suggestion contains a string that should correct the error.

Installation

Pyapa is available through Python pip, grab a copy by running the following:

pip3 install pyapa

Usage

The source distribution includes a sample program which you can use for reference. This module aims to be as simple as possible to use. Also take a look at the README for sample usage from the interpretter.

You may also run this module as a console program to check plain text files. Usage follows:

python3 -m pyapa -i input.txt
python3 -m pyapa -h
Usage:
pyapa [-h] [--version] [-o OUTPUT_FILE] -i INPUT_FILE

Issues

Think you know APA Style better than me? You probably do. If you notice that this module matches a pattern that it shouldn't then please open an issue on Github.

Limitations

Any particular section of text will only ever be targeted once. That is, error matching does not overlap. To ensure that a document is error free, multiple passes through the checker are required, as errors from each previous pass are corrected.

Credits

The rules for pattern matching are based on the Javascript app apacheck by Jonathan Aquino, though no actual project code is shared.

License

This Python module is released under the ISC License. See LICENSE for details.

Links