Skip to main content

preprocess-corpora

This repository contains Python scripts to preprocess and sentence-align parallel (or monolingual) corpora. The repository heavily relies upon Uplug and (in lesser respect) TreeTagger to work.

Installation

First, make sure to have installed Uplug and TreeTagger.

Then, install the requirements via:

$ pip install -r requirements.txt

Finally, create the executables preprocess and align via:

$ pip install --editable .

Usage

Preprocessing

The preprocess script allows to preprocess raw text and then to tokenize and tag the text in the XML format used in OPUS.

Run preprocess to process all unformatted .txt-files in a folder.

Usage:

process [OPTIONS] FOLDER_IN FOLDER_OUT [de|en|es|fr|it|nl|ru|ca|sv|pt]

Options:

  • --from_word to use .docx-files as input, rather than .txt-files.
  • --tokenize to tokenize the files (requires installation of Uplug (and language support in Uplug)).
  • --tag to tag the files (requires installation of TreeTagger (and language support in TreeTagger))

Alignment

Run align to sentence-align .xml-files in a working directory. Requires installation of Uplug.

Usage:

align [OPTIONS] WORKING_DIR [[de|en|es|fr|it|nl|ru|ca|sv|pt]]...

Supported languages

Full support

  • German (de)
  • English (en)
  • Spanish (es) (+ variants Rioplatense (ar) and Mexican (mx) Spanish)
  • French (fr)
  • Italian (it)
  • Dutch (nl)
  • Russian (ru)
  • Portuguese (pt)

Limited support

  • Breton (br) [not supported in Uplug/TreeTagger]
  • Catalan (ca) [not supported in Uplug/TreeTagger]
  • Swedish (sv) [not supported in Uplug/TreeTagger]

Tests

Run the tests via

python -m unittest discover

In preprocess_corpora/tests/data/alice, you can find the example corpus used in the tests. This corpus was compiled from Lewis Carroll's Alice in Wonderland and its translations into German, French, and Italian. The source files are available through Project Gutenberg.

Metadata

Release files for preprocess-corpora 0.1.1

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

Source distribution (sdist)

Source distribution for preprocess-corpora 0.1.1
File Size Uploaded Provenance Actions
preprocess-corpora-0.1.1.tar.gz 780.8 kB Without provenance Details for preprocess-corpora-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for preprocess-corpora 0.1.1
File Interpreter ABI Platform Actions
preprocess_corpora-0.1.1-py3-none-any.whl Python 3 none any Details for preprocess_corpora-0.1.1-py3-none-any.whl

Total release size: 791.8 kB

Release files / preprocess-corpora-0.1.1.tar.gz

Download URL preprocess-corpora-0.1.1.tar.gz
Size 780.8 kB
Tags Source
SHA-256 checksum
How to use checksums
892097440dd1bdaf2bce78c28fe6930809e4703aceb5d495d52645ab62a7bd01
BLAKE2b-256 checksum
How to use checksums
14d564a0669a0c1445ca809ec646f981f2377075ed9bd53fbc92e77f398d6caa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.5.2

Release files / preprocess_corpora-0.1.1-py3-none-any.whl

Download URL preprocess_corpora-0.1.1-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a1a368bd0cc55ed93fff91a2b8445d4aa9201dea81aaa559e1cbd8ab5f643c4
BLAKE2b-256 checksum
How to use checksums
2a436c996ab6f90df412155b5a99e8a932f10a16091233b6396d0dc9337e3921
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.5.2

Security for preprocess-corpora 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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