# NER Reformat
NER Reformat is a Python package that transforms Named Entity Recognition (NER) annotations into the BRAT and BIO formats. It also supports Named Entity Linking annotations transformation to BRAT format for some corpora. You can see the list of formats at section [Supported formats](#supported-formats)
## Installation
You can install NER Formatter using pip:
```
pip3 install ner-reformat
```
## Usage
Here's a basic example of how to use NER Formatter:
```
from ner-reformat import ncbi_to_brat
path_to = "your path/NCBI diseases"
path_from = "your path/NCBI diseases"
ncbi_to_brat(path_from=path_from, path_to=path_to)
```
## Supported Corpora
- IOB formatted, including:
- CoNLL
- OntoNotes
- MultiNERD
- WikiNeural
- WNUT
- MIT Movies
- MIT Restaurants
- BRAT formatted, including:
- CADEC
- NCBI
- IEER
- BioCreative
- Groningen Meaning Bank
- GeoVirus
- MalwareTextDB
### Annotation Schemes of BRAT and IOB
[BRAT](https://brat.nlplab.org/) (Brat Rapid Annotation Tool) format is a standoff annotation format used for text annotation tasks. In BRAT format, each entity is represented on a separate line with annotations including an ID, entity type, start and end offsets, and the annotated text. Example:
```
example.txt
The following month, he signed a contract to play for the Newark Bears in the International League.
```
```
example.ann
T1 ORG 58 70 Newark Bears
T2 ORG 78 98 International League
```
IOB (Beginning, Inside, Outside) format, also known as BIO, is a tagging scheme used for token-level annotation in NLP tasks like Named Entity Recognition. The `B-` prefix indicates the beginning of an entity, `I-` prefix indicates a token inside an entity, and `O` tag represents tokens outside any entity.
```
0 The O
1 following O
2 month O
3 , O
4 he O
5 signed O
6 a O
7 contract O
8 to O
9 play O
10 for O
11 the O
12 Newark B-ORG
13 Bears I-ORG
14 in O
15 the O
16 International B-ORG
17 League I-ORG
18 . O
```
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/project178/ner_reformat",
"name": "ner-reformat",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "NLP Named Entity Recognition annotation NER BRAT BIO",
"author": "MB",
"author_email": "mariya.borovikova@universite-paris-saclay.fr",
"download_url": "https://files.pythonhosted.org/packages/0e/78/acbf6287c2f0e7ec9fbecd64e29fe273f88864069d5105fdf597d6424918/ner-reformat-1.0.0.tar.gz",
"platform": null,
"description": "# NER Reformat\n\nNER Reformat is a Python package that transforms Named Entity Recognition (NER) annotations into the BRAT and BIO formats. It also supports Named Entity Linking annotations transformation to BRAT format for some corpora. You can see the list of formats at section [Supported formats](#supported-formats)\n\n\n## Installation\n\nYou can install NER Formatter using pip:\n```\npip3 install ner-reformat\n```\n\n## Usage\n\nHere's a basic example of how to use NER Formatter:\n```\nfrom ner-reformat import ncbi_to_brat\n\npath_to = \"your path/NCBI diseases\"\npath_from = \"your path/NCBI diseases\"\nncbi_to_brat(path_from=path_from, path_to=path_to)\n```\n\n## Supported Corpora\n\n- IOB formatted, including:\n - CoNLL\n - OntoNotes\n - MultiNERD\n - WikiNeural\n - WNUT\n - MIT Movies\n - MIT Restaurants\n- BRAT formatted, including:\n - CADEC\n- NCBI\n- IEER\n- BioCreative\n- Groningen Meaning Bank\n- GeoVirus\n- MalwareTextDB\n\n### Annotation Schemes of BRAT and IOB\n\n[BRAT](https://brat.nlplab.org/) (Brat Rapid Annotation Tool) format is a standoff annotation format used for text annotation tasks. In BRAT format, each entity is represented on a separate line with annotations including an ID, entity type, start and end offsets, and the annotated text. Example:\n```\nexample.txt\n\nThe following month, he signed a contract to play for the Newark Bears in the International League.\n```\n```\nexample.ann\n\nT1 ORG 58 70 Newark Bears\nT2 ORG 78 98 International League\n```\n\nIOB (Beginning, Inside, Outside) format, also known as BIO, is a tagging scheme used for token-level annotation in NLP tasks like Named Entity Recognition. The `B-` prefix indicates the beginning of an entity, `I-` prefix indicates a token inside an entity, and `O` tag represents tokens outside any entity.\n\n```\n0 The O\n1 following O\n2 month O\n3 , O\n4 he O\n5 signed O\n6 a O\n7 contract O\n8 to O\n9 play O\n10 for O\n11 the O\n12 Newark B-ORG\n13 Bears I-ORG\n14 in O\n15 the O\n16 International B-ORG\n17 League I-ORG\n18 . O\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package for converting various Named Entity Recognition (NER) formats to BRAT and BIO formats.",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/project178/ner_reformat"
},
"split_keywords": [
"nlp",
"named",
"entity",
"recognition",
"annotation",
"ner",
"brat",
"bio"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0828e272991fdc4db82e0ef82ef1a3502dfb785838cdb44b0dfa1a4aa69f4d14",
"md5": "0b142a20cb19bbf064b5e8658c65eb72",
"sha256": "d77e6cc15b1a2ffc32ea08bcbb9f1833b22f2435fbf04d5225e57f13e56cbae3"
},
"downloads": -1,
"filename": "ner_reformat-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0b142a20cb19bbf064b5e8658c65eb72",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 12966,
"upload_time": "2025-01-16T21:27:44",
"upload_time_iso_8601": "2025-01-16T21:27:44.860975Z",
"url": "https://files.pythonhosted.org/packages/08/28/e272991fdc4db82e0ef82ef1a3502dfb785838cdb44b0dfa1a4aa69f4d14/ner_reformat-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0e78acbf6287c2f0e7ec9fbecd64e29fe273f88864069d5105fdf597d6424918",
"md5": "d75b03ef56ccb4f7c4dd2aa529c30e10",
"sha256": "ec94172fe162674fcdca8d976a37a0828bb7f85aab927683464019be520ee49d"
},
"downloads": -1,
"filename": "ner-reformat-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "d75b03ef56ccb4f7c4dd2aa529c30e10",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 12889,
"upload_time": "2025-01-16T21:27:46",
"upload_time_iso_8601": "2025-01-16T21:27:46.481385Z",
"url": "https://files.pythonhosted.org/packages/0e/78/acbf6287c2f0e7ec9fbecd64e29fe273f88864069d5105fdf597d6424918/ner-reformat-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-16 21:27:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "project178",
"github_project": "ner_reformat",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ner-reformat"
}