How to use negspacy - 1 common examples

To help you get started, we’ve selected a few negspacy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jenojp / negspacy / negspacy / negation.py View on Github external
def __init__(
        self,
        nlp,
        language="en",
        ent_types=list(),
        psuedo_negations=list(),
        preceding_negations=list(),
        following_negations=list(),
        termination=list(),
        chunk_prefix=list(),
    ):
        if not language in LANGUAGES:
            raise KeyError(
                f"{language} not found in languages termset. "
                "Ensure this is a supported language or specify "
                "your own termsets when initializing Negex."
            )
        termsets = LANGUAGES[language]
        if not Span.has_extension("negex"):
            Span.set_extension("negex", default=False, force=True)

        if not psuedo_negations:
            if not "psuedo_negations" in termsets:
                raise KeyError("psuedo_negations not specified for this language.")
            psuedo_negations = termsets["psuedo_negations"]

        if not preceding_negations:
            if not "preceding_negations" in termsets:

negspacy

A spaCy pipeline object for negation.

MIT
Latest version published 2 years ago

Package Health Score

51 / 100
Full package analysis

Popular negspacy functions

Similar packages