Skip to main content

A Python module for checking APA style in writing.

This module provides an abstraction class, mostly composed of regular expressions. This project does not aim to cover the entire APA style guide, but it does attempt to cover several common errors with style.

To make errors easier to visually locate, 5 characters of context are sometimes given, depending on the detected error.

Installation

Clone this repository and run:

make install

or install from Pypi:

pip3 install pyapa

Information

Pypi: https://pypi.python.org/pypi/pyapa/

Github: https://github.com/keeferrourke/pyapa

Contact: https://krourke.org/contact

License: ISC License

pyapa.ApaCheck object class

This class documents regular expressions to 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 the following members:

  • ApaMatch.feedback a unicode string intended to hold a brief explanation of an associated error

  • ApaMatch.see a URL string intended to hold an external reference to an APA Style guide

  • ApaMatch.end the position of the character in a text which marks the end of the target character span

  • ApaMatch.start the position of the character in a text which marks the beginning of the target character span

  • ApaMatch.target the matching string that contains an error

  • ApaMatch.suggestions a list of suggested replacement strings; at this time, the list is only ever one element long

There are also two helper functions to make printing these objects easy:

  • ApaMatch.print() prints the object to stdout

  • ApaMatch.sprint() builds a string containing information about the object

Example usage

From the interpreter:

>>> from pyapa import pyapa
>>> a = pyapa.ApaCheck()
>>> text = u'Papaya are delicious fruit, it was concluded (Author, et al. 2017).'
>>> a.match(text)
[<pyapa.pyapa.ApaMatch object at 0x000000000000>]
>>> len(a.Matches)
1
>>> a.Matches[0].print()
Match from 46 to 65 for:
Target: Author, et al. 2017
Feedback: Do not put a comma before 'et al.'
Suggestion: Author et al. 2017

Calling the module itself:

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

Metadata

Release files for pyapa 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyapa 0.2.1
File Size Uploaded
pyapa-0.2.1.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyapa 0.2.1
File Interpreter ABI Platform
pyapa-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 16.8 kB

Release files / pyapa-0.2.1.tar.gz

Download URL pyapa-0.2.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
46f9d82953bb38eb185d65f9aac7276edbe00f45e6604efe68ee5a095e45fbec
BLAKE2b-256 checksum
How to use checksums
435e848d340ddfc638495bfe51cbbe22d6c721986f7f1b2ad9d65086002f62d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pyapa-0.2.1-py2.py3-none-any.whl

Download URL pyapa-0.2.1-py2.py3-none-any.whl
Size 9.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7aed3b63932a83abb060041ae06185d83365dbf1b0d7d6b894ad327926fe89e3
BLAKE2b-256 checksum
How to use checksums
7c919a1ca685979f446e3e3e44e016c3172fc564741ab60c819fedf95736fa9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page