Skip to main content

Label Mapper is a spaCy factory that can receive a mapping dictionary that changes the labels for entities. It should come at the end of the pipeline or after the NER or EntityRuler.

Installation

pip install label-mapper

Usage

nlp = spacy.load("en_core_web_sm")
label_map = {"GPE": "LOC"}
nlp.add_pipe(
            "label_fixer",
            last=True,
            config={"label_map": label_map}
            )
doc = nlp("We went into Yellowstone Park in Wyoming.")
for ent in doc.ents:
    print(ent.text, ent.label_)

Output:

Yellowstone Park LOC
Wyoming LOC

Download files

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

Source Distribution

label_mapper-0.0.1.tar.gz (1.7 kB view details)

Uploaded Source

File details

Details for the file label_mapper-0.0.1.tar.gz.

File metadata

  • Download URL: label_mapper-0.0.1.tar.gz
  • Upload date:
  • Size: 1.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.5

File hashes

Hashes for label_mapper-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a00904bb4346a0841fcb72d100b93de0d20d4aa2a8efd65cf3513e7fc889f6da
MD5 2e5eee2d19f49cce7aed721c5a5d7ff2
BLAKE2b-256 9e8bc33e5ea4a590fda706dcb35f9c1ac5944434a3594b487b4df8fbb670cba6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page