eCoNLL: Extended CoNLL Utilities for Shallow Parsing
Shallow Parsing
Sequence Labeling and Classification
Classification is the problem of identifying to which of a set of categories (subpopulations) a new observation belongs, on the basis of a training set of data containing observations (or instances) whose category membership is known.
Sequence Labeling is a type of pattern recognition task that involves the algorithmic assignment of a categorical label to each member of a sequence of observed values. It is a subclass of structured (output) learning, since we are predicting a sequence object rather than a discrete or real value predicted in classification problems.
Sequence Labeling and Shallow Parsing
Shallow Parsing is a kind of Sequence Labeling. The main difference from Sequence Labeling task, such as Part-of-Speech Tagging, where there is an output label (tag) per token; Shallow Parsing additionally performs chunking -- segmentation of input sequence into constituents. Chunking is required to identify categories (or types) of multi-word expressions.
In other words, we want to be able to capture information that expressions like "New York" that consist of 2 tokens,
constitute a single unit.
What this means in practice is that Shallow Parsing performs jointly (or not) 2 tasks:
- Segmentation of input into constituents (spans)
- Classification (Categorization, Labeling) of these constituents into predefined set of labels (types)
CoNLL Corpus Format
Corpus in CoNLL format consists of series of sentences, separated by blank lines. Each sentence is encoded using a table (or "grid") of values, where each line corresponds to a single word, and each column corresponds to an annotation type (such as various token-level features & labels).
The set of columns used by CoNLL-style files can vary from corpus to corpus.
Since a line in a data can correspond to any token (word or not), it is referred to by a more general term token.
Similarly, since a data can be composed of units more or less than a sentence,
a new line separated unit is referred to as block.
Encoding Segmentation Information
IOB Scheme
The notation scheme is used to label multi-word spans in token-per-line format, e.g. that New York is a LOCATION concept that has 2 tokens.
As such a token-level tag consists of an affix that encodes segmentation information
and label that encodes type information.
Consequently, the corpus tagset consists of all possible affix and label combinations.
A segment encoded with affixes and assigned a label is referred to as chunk.
-
Both, prefix and suffix notations are commons:
- prefix: B-LOC
- suffix: LOC-B
-
Meaning of Affixes
- I for Inside of span
- O for Outside of span (no prefix or suffix, just
O) - B for Beginning of span
Alternative Schemes
- No affix (useful when there are no multi-word concepts)
IO: deficient withoutBIOB: see aboveIOBE:Efor End of span (LinBILOUfor Last)IOBES:Sfor Singleton (UinBILOUfor Unit)
Evaluation
There are several methods to evaluate performance of shallow parsing models.
They can be evaluated at token-level and at chunk-level.
Token-Level Evaluation
The unit of evaluation in this case is a tag of a token,
and what is evaluated is how accurately a model assigns tags to tokens.
Consequently, the token (or tag) accuracy measures the amount of correctly predicted tags.
Since a tag consists of an affix-label pair,
it is additionally possible to separately compute affix and label performances.
Chunk-Level Evaluation
The unit of evaluation in this case is a chunk, and the evaluation is "joint";
in the sense that it jointly evaluates segmentation and labeling.
That is, a true unit is the one that has correct label and span.
Similar to token-level evaluation, it is possible to evaluate segmentation independently of labeling.
This is achieved ignoring the chunk label, e.g. by converting all of them to a single label.
Why eCoNLL?
Token-level evaluation is readily available from a number of packages,
and can be easily computed using scikit-learn's classification_report, for instance.
Chunk-level evaluation was originally provided by
conlleval perl script within CoNLL Shared Tasks.
However, the one limitation of conlleval is that it does not support IOBES or BILOU schemes.
The conlleval script was ported to python numerous times, and these ports have various functionalities.
One notable port is seqeval,
which is also included in Hugging Face's evaluate package.
Installation
To install econll run:
pip install econll
econll requires Python 3.10+ and has no dependencies. It is fully typed (py.typed).
Usage
It is possible to run econll from command-line, as well as to import the methods.
Command-Line Usage
The econll command is installed with the package; python -m econll is equivalent.
usage: econll [-h] -d DATA [-r REFS] [--separator SEPARATOR]
[--boundary BOUNDARY] [--docstart DOCSTART]
[--kind {prefix,suffix}] [--glue GLUE] [--otag OTAG]
[-f {conll,parse,mdown}] [-o OUTS]
[{eval,conv,stat}]
eCoNLL: Extended CoNLL Utilities
positional arguments:
{eval,conv,stat} task to perform
options:
-h, --help show this help message and exit
I/O Arguments:
-d DATA, --data DATA path to data/hypothesis file
-r REFS, --refs REFS path to references file
Data Format Arguments:
--separator SEPARATOR
field separator string
--boundary BOUNDARY block separator string
--docstart DOCSTART doc start string
Tag Format Arguments:
--kind {prefix,suffix}
tag order
--glue GLUE tag separator
--otag OTAG outside tag
Data Conversion Arguments:
-f {conll,parse,mdown}, --form {conll,parse,mdown}
output format (kind)
-o OUTS, --outs OUTS path to output file
The data file is a CoNLL file: the first column is the token, and the last column is the tag
(or the hypothesis, if references are in the column before it or in a separate file).
Lines that start with --docstart (default: -DOCSTART-) are skipped;
for space-separated files, such as CoNLL-2003, use --separator " ".
Evaluation
Token-level and chunk-level evaluation (eval is the default command):
econll -d DATA
econll eval -d DATA
econll eval -d DATA -r REFS
If -r is not provided, the references are read from the pre-ultimate column of DATA.
Statistics
Label distribution at the token and chunk levels:
econll stat -d DATA
Conversion
Convert between CoNLL (conll), JSON/JSONL (parse), and in-line Markdown (mdown) formats:
econll conv -d DATA -f FORMAT -o PATH
The format of DATA is determined by the file extension:
.jsonl is parse, .mdown is mdown, anything else is read as CoNLL.
For CoNLL input, the tag is taken from the last column.
The output path (-o) is required.
conll: [("a", "B-food"), ("b", "I-food"), ("c", "O")]
parse: {"text": "a b c", "spans": [{"label": "food", "bos": 0, "eos": 3, "value": "a b"}]}
mdown: [a b](food) c
In mdown, a span can have a value (synonym): [a b](food:A.B) c.
Tag format parameters (--kind, --glue, --otag) apply to CoNLL data.
Python Usage
from econll import load, chunk, chunkeval, convert
from econll.reader import get_refs, get_hyps
data = load("data.tsv") # list of blocks of token tuples
refs, hyps = get_refs(data), get_hyps(data) # blocks of reference & hypothesis tags
chunk(hyps[0]) # e.g. [("food", 0, 2)]: (label, begin, end)
print(chunkeval(refs, hyps)) # chunk-level evaluation report
convert("[a b](food) c", kind="conll") # [("a", "B-food"), ("b", "I-food"), ("c", "O")]
Tag format is configurable by kind ("prefix" or "suffix"), glue and otag keyword arguments
of the functions that parse tags (e.g. chunk(tags, kind="suffix", glue="_")).
Public functions are listed in econll.__all__.
Development
pip install -e . --group dev # or: uv sync
pytest
mypy
Changes are listed in CHANGELOG.md.
Versioning
This project adheres to Semantic Versioning.
Metadata
Release files for econll 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| econll-0.4.0.tar.gz | 52.0 kB | With provenance | Details for econll-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| econll-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for econll-0.4.0-py3-none-any.whl |
Total release size: 94.0 kB
Release files / econll-0.4.0.tar.gz
| Download URL | econll-0.4.0.tar.gz |
|---|---|
| Size | 52.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d7e9b08b0f356b365d9f1ea10292a750e3fb583b24504c55784907a9651da46
|
|
BLAKE2b-256 checksum How to use checksums |
cb6da6841a934b9ff15dc960af6ca7ff313fa3edf102e49695789d616a4c83c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logRelease files / econll-0.4.0-py3-none-any.whl
| Download URL | econll-0.4.0-py3-none-any.whl |
|---|---|
| Size | 42.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4406958d9355c5002f76ece5b83fb25ab4909668a0add9c89d6b223e474bd441
|
|
BLAKE2b-256 checksum How to use checksums |
41f5c8f735fdc39a4c3c584912fe0580a849fe20bb68d0e58cea7b40aac7d35b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logSecurity for econll 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for econll-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.