Name | label-mapper JSON |
Version |
0.0.1
JSON |
| download |
home_page | |
Summary | A spaCy extension to map NER labels. |
upload_time | 2023-08-28 13:40:40 |
maintainer | |
docs_url | None |
author | WJB Mattingly |
requires_python | |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
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
```bash
pip install label-mapper
```
# Usage
```python
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
```
Raw data
{
"_id": null,
"home_page": "",
"name": "label-mapper",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "WJB Mattingly",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/9e/8b/c33e5ea4a590fda706dcb35f9c1ac5944434a3594b487b4df8fbb670cba6/label_mapper-0.0.1.tar.gz",
"platform": null,
"description": "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.\r\n\r\n# Installation\r\n\r\n```bash\r\npip install label-mapper\r\n```\r\n\r\n# Usage\r\n\r\n```python\r\nnlp = spacy.load(\"en_core_web_sm\")\r\nlabel_map = {\"GPE\": \"LOC\"}\r\nnlp.add_pipe(\r\n \"label_fixer\",\r\n last=True,\r\n config={\"label_map\": label_map}\r\n )\r\ndoc = nlp(\"We went into Yellowstone Park in Wyoming.\")\r\nfor ent in doc.ents:\r\n print(ent.text, ent.label_)\r\n```\r\n\r\nOutput:\r\n\r\n```\r\nYellowstone Park LOC\r\nWyoming LOC\r\n```\r\n",
"bugtrack_url": null,
"license": "",
"summary": "A spaCy extension to map NER labels.",
"version": "0.0.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9e8bc33e5ea4a590fda706dcb35f9c1ac5944434a3594b487b4df8fbb670cba6",
"md5": "2e5eee2d19f49cce7aed721c5a5d7ff2",
"sha256": "a00904bb4346a0841fcb72d100b93de0d20d4aa2a8efd65cf3513e7fc889f6da"
},
"downloads": -1,
"filename": "label_mapper-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "2e5eee2d19f49cce7aed721c5a5d7ff2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 1669,
"upload_time": "2023-08-28T13:40:40",
"upload_time_iso_8601": "2023-08-28T13:40:40.861000Z",
"url": "https://files.pythonhosted.org/packages/9e/8b/c33e5ea4a590fda706dcb35f9c1ac5944434a3594b487b4df8fbb670cba6/label_mapper-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-28 13:40:40",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "label-mapper"
}