Read and an write web anno tsv
Project description
Inception Webanno tsv
Read and write webanno tsv 3.2 files
Install
pip install git+https://github.com/Pangeamt/web_anno_tsv
Read a webanno tsv file
from web_anno_tsv import open_web_anno_tsv
tsv1 = 'test.tsv'
with open_web_anno_tsv(tsv1) as f:
for i, sentence in enumerate(f):
print(f"Sentence {i}:", sentence.text)
for j, annotation in enumerate(sentence.annotations):
print(f'\tAnnotation {j}:')
print('\t\tText:', annotation.text)
print("\t\tLabel:", annotation.label)
print("\t\tOffsets", f"{annotation.start}, {annotation.stop}")
Write a webanno tsv file
from web_anno_tsv import open_web_anno_tsv
tsv1 = 'test.tsv'
tsv2 = 'test_write.tsv'
with open_web_anno_tsv(tsv1) as f1:
with open_web_anno_tsv(tsv2, 'w') as f2:
for sentence in f1:
f2.write(sentence)
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
web_anno_tsv-0.0.1.tar.gz
(5.4 kB
view hashes)
Built Distribution
Close
Hashes for web_anno_tsv-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d553d055489c900a0f2b483a8a31c584dcc177442b1f1f83e2c5f0a982ac580 |
|
MD5 | 80248fc3f6a475680ff9effb9db80f75 |
|
BLAKE2b-256 | cf1f6764f71d2adfafd27621c6c785e315ea3e006a1a65a7bb00ad58256ce6ba |