CHAT, FoLiA, PaQu metadata, plaintext and TEI to Alpino XML or PaQu metadata format
Converts CHAT, FoLiA, PaQu metadata, plaintext and TEI XML files to Alpino XML files. Each sentence in the input file is parsed separately.
Usage
Command Line
pip install corpus2alpino
corpus2alpino -s localhost:7001 folia.xml -o alpino.xml
Or from project root:
python -m corpus2alpino -s localhost:7001 folia.xml -o alpino.xml
Library
from corpus2alpino.converter import Converter
from corpus2alpino.annotators.alpino import AlpinoAnnotator
from corpus2alpino.collectors.filesystem import FilesystemCollector
from corpus2alpino.targets.memory import MemoryTarget
from corpus2alpino.writers.lassy import LassyWriter
alpino = AlpinoAnnotator("localhost", 7001)
converter = Converter(FilesystemCollector(["folia.xml"]),
# Not needed when using the PaQuWriter
annotators=[alpino],
# This can also be ConsoleTarget, FilesystemTarget
target=MemoryTarget(),
# Set to merge treebanks, also possible to use PaQuWriter
writer=LassyWriter(True))
# get the Alpino XML output, combined into one treebank XML file
parses = converter.convert()
print(''.join(parses)) # <treebank><alpino_ds ... /></treebank>
Enrichment
It is possible to add custom properties to (existing) Lassy/Alpino files. This is done using a csv-file containing the node attributes and values to look for and the custom properties to assign.
For example:
python -m corpus2alpino tests/example_lassy.xml -e tests/enrichment.csv -of lassy
See corpus2alpino.annotators.enrich_lassy for more information.
Development
Unit Test
python -m unittest
Upload to PyPi
See: https://packaging.python.org/tutorials/packaging-projects/#generating-distribution-archives
Make sure setuptools and wheel are installed. Then from the virtualenv:
pip install build
python -m build
twine upload dist/*
Requirements
- Alpino parser running as a server:
Alpino batch_command=alpino_server -notk server_port=7001 - Python 3.10 or higher
- libfolia-dev
- libxml2-dev
Installation Instructions for Ubuntu
sudo apt install libfolia-dev libxml2-dev
pip install -r requirements.txt
Metadata
Release files for corpus2alpino 0.3.14
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 |
|---|---|---|---|---|
| corpus2alpino-0.3.14.tar.gz | 23.2 kB | With provenance | Details for corpus2alpino-0.3.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| corpus2alpino-0.3.14-py3-none-any.whl | Python 3 | none | any | Details for corpus2alpino-0.3.14-py3-none-any.whl |
Total release size: 55.1 kB
Release files / corpus2alpino-0.3.14.tar.gz
| Download URL | corpus2alpino-0.3.14.tar.gz |
|---|---|
| Size | 23.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
962430a4e756470863baffcc1f5461924120f99d06bcf5c724a29dba8e33bef6
|
|
BLAKE2b-256 checksum How to use checksums |
cbf7a1ac8c2046559ac9383762c03a1b021dd0578d31482dc16b9abe92496d6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 30, 2026.
Transparency logRelease files / corpus2alpino-0.3.14-py3-none-any.whl
| Download URL | corpus2alpino-0.3.14-py3-none-any.whl |
|---|---|
| Size | 31.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0762a00537a74839d856467dd68ccf9d83f2cfc07f04fd2dcac6ef5f7e9733f0
|
|
BLAKE2b-256 checksum How to use checksums |
1be25968cfd1e26340144654a66429d83a3436802eeeca76a90d81d61febe62d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 30, 2026.
Transparency logSecurity for corpus2alpino 0.3.14
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 corpus2alpino-0.3.14.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 Apr 30, 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.