Skip to main content

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


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 details)

Uploaded Source

Built Distribution

web_anno_tsv-0.0.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: web_anno_tsv-0.0.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.8

File hashes

Hashes for web_anno_tsv-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7295f93f67c09098ebe230de3bcfe809d1bfb7ed452d220df6db53355b8ba1d7
MD5 48183bbee36980732874131d14883a47
BLAKE2b-256 030df6b3a611baf34cfca6e70d75087ae8c023e28078181c60ad0c2065a72c1c

See more details on using hashes here.

File details

Details for the file web_anno_tsv-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: web_anno_tsv-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.8

File hashes

Hashes for web_anno_tsv-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d553d055489c900a0f2b483a8a31c584dcc177442b1f1f83e2c5f0a982ac580
MD5 80248fc3f6a475680ff9effb9db80f75
BLAKE2b-256 cf1f6764f71d2adfafd27621c6c785e315ea3e006a1a65a7bb00ad58256ce6ba

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page