Skip to main content

treetagger-xml

This is a simple script (process.py) that reads in a .xml-file in the OPUS format, uses TreeTagger to parse/lemmatize each sentence, an appends this information to the word elements in the original .xml-file. The script also facilitates tagging a .txt-file and then converting the tab-separated output from TreeTagger to the OPUS format.

Requirements

TreeTagger

See the TreeTagger website for installation instructions. Note that you'll have to download a paramater file for each language you would want to tag/lemmatize. This script has been tested on version 3.2.1 of TreeTagger.

Python

This script runs in Python 3 and requires two external packages to run: lxml and treetaggerwrapper. The latter requires six to be installed as well. You can install these packages either locally (in a virtualenv) or globally via running:

pip install -r requirements.txt

Running the script

Before running the script, it's best to set an environment variable with the location of TreeTagger. The treetaggerwrapper tries to detect the installation automatically, but this is not fool-proof. You can set the environment variable (under Linux) with:

export TAGDIR=/opt/treetagger/

Alternatively, you can modify process.py and hard-code your installation path in the TreeTagger instantation.

Then, you can run the process.py script. It requires three parameters: your input format (xml or txt), your language of choice for parsing and lemmatizing, and your input file(s). In the examples/ directory you can find some example .xml-files. Run

python process.py xml en examples/en.xml

to process the English example. The resulting file will be named examples/en-out.xml.

Processing plain text

Processing plain text requires you to set the first argument to txt rather than xml. For example:

python process.py txt en examples/en.txt

This script will output a tab-separated file (examples/en.tab) as well as an .xml-file in the OPUS format (examples/en.xml).

Metadata

Release files for treetagger-xml 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for treetagger-xml 0.1.9
File Size Uploaded Provenance Actions
treetagger-xml-0.1.9.tar.gz 7.3 kB Without provenance Details for treetagger-xml-0.1.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for treetagger-xml 0.1.9
File Interpreter ABI Platform Actions
treetagger_xml-0.1.9-py3-none-any.whl Python 3 none any Details for treetagger_xml-0.1.9-py3-none-any.whl

Total release size: 15.7 kB

Release files / treetagger-xml-0.1.9.tar.gz

Download URL treetagger-xml-0.1.9.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bb5b2087019cc39a7b8d01fda42f09913088890f8ae637d5bd917d93ec0e4d32
BLAKE2b-256 checksum
How to use checksums
ba15eeec41718b9717e0dc8d64c597a1101d1560b38aeb85da06b70c59b87ae9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.9.1 setuptools/20.7.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

Release files / treetagger_xml-0.1.9-py3-none-any.whl

Download URL treetagger_xml-0.1.9-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5af1d448f9f09d128dbffee041134ca9f9c7bd7f4b76ef4bdc84f1d577832ff1
BLAKE2b-256 checksum
How to use checksums
7baf97bfece467caa26c771f86f213abd9472f9b51c299e4585ef2ebd5f57553
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.9.1 setuptools/20.7.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

Security for treetagger-xml 0.1.9

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page