Convert between BioNLP formats
Project description
# bconv: Python library for converting between BioNLP formats
bconv offers format conversion and manipulation of documents with text and annotations. It supports various popular formats used in natural-language processing for biomedical texts.
## Supported formats
The following formats are currently supported:
I: input format; O: output format; T: can represent text; A: can represent annotations (entities).
## Installation
bconv is hosted on [PyPI](https://pypi.org/project/bconv/), so you can use pip to install it: `sh $ pip install bconv ` By default, pip attempts a system-level installation, which might require admin privileges. Alternatively, use pip’s –user flag for an installation owned by the current user.
## Usage
Load an annotated collection in BioC XML format: `pycon >>> import bconv >>> coll = bconv.load('bioc_xml', 'path/to/example.xml') >>> coll <Collection with 37 subelements at 0x7f1966e4b3c8> ` A Collection is a sequence of Document objects: `pycon >>> coll[0] <Document with 12 subelements at 0x7f1966e2f6d8> ` Documents contain Sections, which contain Sentences: `pycon >>> sent = coll[0][3][5] >>> sent.text 'A Live cell imaging reveals that expression of GFP‐KSHV‐TK, but not GFP induces contraction of HeLa cells.' ` Find the first annotation for this sentence: `pycon >>> e = next(sent.iter_entities()) >>> e.start, e.end, e.text (571, 578, 'KSHV‐TK') >>> e.info {'type': 'gene/protein', 'ui': 'Uniprot:F5HB62'} ` Write the whole collection to a new file in CoNLL format: `pycon >>> with open('path/to/example.conll', 'w', encoding='utf8') as f: ... bconv.dump('conll', coll, f, tagset='IOBES', include_offsets=True) `
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bconv-0.2.tar.gz.
File metadata
- Download URL: bconv-0.2.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4698ccc2f4bab13a951c3e1ad88dfa5ca21d84dcc2bf0168b4c8ab2cdaf5543
|
|
| MD5 |
edd62ea9e5f2ae1c815a1bc295f91413
|
|
| BLAKE2b-256 |
6207d8ada5990e0fa8fd814335d2f411e68ee4003ebc3a3cbdcfafdc0ef56067
|
File details
Details for the file bconv-0.2-py3-none-any.whl.
File metadata
- Download URL: bconv-0.2-py3-none-any.whl
- Upload date:
- Size: 35.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8adee88201971ab18185ebff80d4f8fa34e8ea29792e98769837f1b87b690b5
|
|
| MD5 |
c305fce4a29685d443ad993ec6ec00ae
|
|
| BLAKE2b-256 |
2ca400a094eb05fda79e02eaf9040af404872436c28de4e3dce2f237c0c043bf
|