Skip to main content

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.

Project description

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")

Project details


Download files

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

Files for replacy-article-agreer, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size replacy_article_agreer-0.2.2-py3-none-any.whl (4.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size replacy-article-agreer-0.2.2.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page