Skip to main content

BIO and BEISO evaluation library

Project description

bioeval

License: MIT

CoNLL-2000 style evaluation of data using BIO and BEISO representation for mutli-token entities (i.e. chunks).

Change Log

  • bioeval now supports pandas DataFame objects through bioeval.evaluate_df.

Example:

import pandas as pd
from bioeval import evaluate_df

# form and POS tags are not necessary
df = pd.DataFrame(
    [
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'B-foo','guesstag': 'B-foo'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'I-foo','guesstag': 'I-foo'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'O','guesstag': 'O'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'B-bar','guesstag': 'B-bar'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'B-foo','guesstag': 'B-foo'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'O','guesstag': 'O'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'B-foo','guesstag': 'B-foo'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'I-foo','guesstag': 'I-foo'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'B-bar','guesstag': 'B-bar'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'I-bar','guesstag': 'I-bar'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'O','guesstag': 'O'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'B-foo','guesstag': 'B-foo'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'B-bar','guesstag': 'I-foo'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'B-foo','guesstag': 'B-foo'},
        {'form': 'foo', 'pos': 'bar', 'chunktag': 'I-foo','guesstag': 'B-foo'}
    ]
)

f1, pr, re = evaluate_df(df, 'chunktag', 'guesstag')

print(f1)
>>> 62.5

Input format

chunk = {
    ((1, 'Gold', 'N', 'B-NP'),),
    ((2, 'is', 'V', 'B-MV'),),
    ((3, 'green', 'J', 'B-AP'),),
    ((4, '.', '.', 'B-NP'),),
    (
        (5, 'The', 'D', 'B-NP'),
        (6, 'red', 'J', 'I-NP'),
        (7, 'square', 'N', 'I-NP')
    ),
    ((8, 'is', 'V', 'B-MV'),),
    (
        (9, 'very', 'A', 'B-AP'),
        (10, 'boring', 'J', 'I-AP')
    ),
    ((8, '.', '.', 'O'),)
}

Install

In the root folder execute:

pip install -r requirements.txt .

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

bioeval-1.1.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bioeval-1.1.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file bioeval-1.1.1.tar.gz.

File metadata

  • Download URL: bioeval-1.1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.1

File hashes

Hashes for bioeval-1.1.1.tar.gz
Algorithm Hash digest
SHA256 488f14416046093af447e13522ca7ece7f1290208ec613426a2fd3b1108b0efe
MD5 611e7680c3f707ff00ea7ee9c0de2f37
BLAKE2b-256 7b84df1b598db1059df4687ec94aaa9fed8d5101b607d729d6297c2400280e42

See more details on using hashes here.

File details

Details for the file bioeval-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: bioeval-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.1

File hashes

Hashes for bioeval-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f548cb54ff1211ea8ba3137ee27f5a5e3bda6fd61907bb862a1dff5d5b5acd23
MD5 7abfbfeea3c14ab0effbb7a51221a1a4
BLAKE2b-256 499bd57866d877664c32c7d3fa5bf6dabec8cf149af530bc5aba2cb747125584

See more details on using hashes here.

Supported by

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