Skip to main content

A library for accessing the ACL Anthology

Project description

acl-anthology-py

License Build Status Code Coverage Supported Python Versions Development Status Package on PyPI

This package accesses data from the ACL Anthology.

:warning: This package is still work in progress. :warning:

API documentation can already be generated locally (see below for instructions), more documentation (included a web-hosted version) is coming.

How to use

Install via pip:

$ pip install acl-anthology-py

Clone the ACL Anthology repo to obtain the data files (there will be an option to automate this step in a future version):

$ git clone https://github.com/acl-org/acl-anthology

Afterwards, the library can be instantiated as follows:

from acl_anthology import Anthology

# "datadir" needs to point to the "data/" folder of the acl-anthology repo
anthology = Anthology(datadir="acl-anthology/data")

Some usage examples:

paper = anthology.get("C92-1025")

print(str(paper.title))
# Two-Level Morphology with Composition

print([author.name for author in paper.authors])
# [Name(first='Lauri', last='Karttunen'), Name(first='Ronald M.', last='Kaplan'), Name(first='Annie', last='Zaenen')]

from acl_anthology.people import Name
print(anthology.people.get_by_name(Name("Lauri", "Karttunen")))
# [Person(id='lauri-karttunen', names=[Name(first='Lauri', last='Karttunen')],
#         item_ids={('C94', '2', '206'), ('W05', '12', '6'), ('C69', '70', '1'),
#                   ('J83', '2', '5'), ('C86', '1', '16'), ('C92', '1', '25'), ...})]

Developing

This package uses Python 3.10+ with the Poetry packaging system.

Cloning the repository and running make will install all dependencies via Poetry, run all style and type checks, run all tests, and generate the documentation.

Install dependencies and pre-commit hooks

make setup will install all package dependencies in development mode, as well as install the pre-commit hooks that run on every attempted git commit.

If you only want the dependencies, but not the hooks, run make dependencies.

Running checks

make check will run black, ruff, and some other pre-commit hooks, as well as the mypy type checker on all files in the repo.

Running tests

make test will run Python unit tests and integration tests.

Running benchmarks

The benchmarks/ folder collects some benchmarks intended to be run with the richbench tool:

poetry run richbench benchmarks/

Generating and writing documentation

  • make docs (to generate in site/)
  • make docs-serve (to serve locally)

Docstrings are written in Google style as this supports the most features with the mkdocstrings handler (particularly compared to Sphinx/reST).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acl_anthology_py-0.3.0.tar.gz (91.6 kB view hashes)

Uploaded Source

Built Distribution

acl_anthology_py-0.3.0-py3-none-any.whl (111.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page