Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

A replaCy component to manage indirect article agreement, that is, to deal with making "a" and "an" be correct so you don't have to think about them in your matches.

License

Notifications You must be signed in to change notification settings

writer/replacy_article_agreer

Repository files navigation

replaCy Article Agreer

A replaCy component to manage indirect article agreement, that is, to deal with making "a" and "an" be correct so you don't have to think about them in your matches.

Warning

This replaCy component touches suggestions (span._.suggestions) generated by replaCy, and assumes that they are text. This means you MUST attach add this component to the pipeline after the joiner. Otherwise, this component tries to raise ReplacyPipelineOrderError to tell you this.

Install

poetry add replacy_article_agreer

or

pip install replacy_article_agreer

Usage

import en_core_web_sm
from replacy import ReplaceMatcher
from replacy.db import load_json
from replacy_article_agreer import ArticleAgreer
from spacy.util import filter_spans


nlp = en_core_web_sm.load()
replaCy = ReplaceMatcher(nlp, load_json('path to match dict(s)'))

aa = ArticleAgreer()

# filtering spans first isn't strictly necessary, but recommended
replaCy.add_pipe(filter_spans, name="filter_spans", before="joiner")
replaCy.add_pipe(aa, name="article_agreer", after="joiner")

Developing

The CI/CD in this project is great. GitHub Actions run linting and tests on any PR. If you merge into master, release-drafter drafts a new release based on PR commits and tags (e.g. if the PR is tagged feature and minor it will create a minor version bump with the changes labeled as Features).

I can't figure out the automatic versioning bit... leaving it in a broken state for now :/

About

A replaCy component to manage indirect article agreement, that is, to deal with making "a" and "an" be correct so you don't have to think about them in your matches.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages