DPToie-Python
Open Information Extractor for Portuguese based on dependency analysis (SpaCy + Stanza).
This guide shows all ways to run the project via src/dptoie/main.py, with all argument variations, both locally (Poetry) and with Docker / Docker Compose.
- Minimum requirements: Python 3.12+, Poetry, or Docker (optional)
- Models: Stanza downloads models automatically on first run. You can set
STANZA_RESOURCES_DIRto use a local models directory (e.g.,./models/.stanza_resources).
Table of Contents
- Installation (Poetry)
- How to run (local, via Poetry)
- How to run with Docker (without Compose)
- How to run with Docker Compose
- Quick references
- How to cite this project
- Authors
Installation (Poetry)
poetry install
How to run (local, via Poetry)
General form:
poetry run python3 src/dptoie/main.py \
-i <input_path> \
-it <txt|conll> \
-o <output_path> \
-ot <json|csv|txt> \
[-cc] [-sc] [-hs] [-a] [-t] [-debug]
Supported arguments
- -i, --input: path to the input file. Default:
./inputs/teste.txt - -it, --input-type: input file type. Options:
txtorconll. Default:txt- For
txtinput: each line in the file is a sentence; the system generates a temporary.conll. - For
conllinput: the input file is already in CoNLL-U format (one sentence per block, separated by an empty line).
- For
- -o, --output: path to the output file. Default:
./outputs/output.json - -ot, --output-type: output format. Options:
json,csv,txt. Default:json - -cc, --coordinating_conjunctions: enable extractions using coordinating conjunctions
- -sc, --subordinating_conjunctions: enable extractions using subordinating conjunctions
- -hs, --hidden_subjects: enable extractions with hidden subjects (Not implemented)
- -a, --appositive: enable appositive extractions
- -t, --transitive: enable transitivity for appositives (only has effect when
-ais active) - -debug: verbose debug mode
Important:
- Extraction modules are disabled by default. Enable the ones you want using the flags
-cc -sc -a -t.
Practical examples
- TXT input, JSON output (defaults):
poetry run python3 src/dptoie/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.json -ot json
- TXT input, CSV output, enabling coordination and hidden subject (flag example):
poetry run python3 src/dptoie/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.csv -ot csv -cc
- TXT input, human-readable text output:
poetry run python3 src/dptoie/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.txt -ot txt -cc -sc -a -t
- Input already in CoNLL-U, JSON output:
poetry run python3 src/dptoie/main.py -i ./inputs/teste.conll -it conll -o ./outputs/out.json -ot json -cc -sc -a -t
- Only coordinating conjunctions:
poetry run python3 src/dptoie/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/cc.json -ot json -cc
- Debug mode for detailed inspection:
poetry run python3 src/dptoie/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.json -ot json -cc -debug
- Show arguments list:
poetry run python3 src/dptoie/main.py -h
Expected outputs:
- JSON: a list of objects per sentence, with extractions inside
extractionsand possiblesub_extractions. - CSV: columns
id,sentence,arg1,rel,arg2(includes sub-extractions with hierarchical ids like1.1). - TXT: the sentence followed by extractions and sub-extractions formatted as lines.
How to run with Docker (without Compose)
Build the image (from the project root):
docker build -t dptoie_python .
Run a one-off command (mounting the current directory and pointing to files inside the container):
docker run --rm -it \
-e STANZA_RESOURCES_DIR=/dptoie_python/models/.stanza_resources \
-v "$(pwd)":/dptoie_python \
-w /dptoie_python \
dptoie_python \
poetry run python3 src/dptoie/main.py -i /dptoie_python/inputs/teste.conll -it conll -o /dptoie_python/outputs/out.json -ot json -cc -sc -a -t
Note: adjust the -i and -o paths as needed; use -it txt when the input is line-by-line text.
How to run with Docker Compose
The docker-compose.yml file already includes the dptoie_python service. You can edit the command: line for the desired scenario. Example recommended command:
command: poetry run python3 src/dptoie/main.py -i /dptoie_python/inputs/teste.conll -it conll -o /dptoie_python/outputs/out.json -ot json -cc -sc -a -t
Then run:
docker compose up --build
Use run to execute other custom commands:
docker compose run dptoie_python poetry run python3 src/dptoie/main.py -i /dptoie_python/inputs/ceten-200.txt -it txt -o /dptoie_python/outputs/out.csv -ot csv -cc
Tips:
- The volume
.:/dptoie_pythonallows using local files inside the container. STANZA_RESOURCES_DIR(exposed in the compose file) can point tomodels/.stanza_resourcesto avoid repeated downloads.
Quick references
- TXT input: each line is a sentence; the system creates a temporary
.conll. - CoNLL-U input: use
-it conlland ensure sentences are separated by an empty line. - Rule activation: all rules are disabled by default; add the desired flags.
- Relative paths are interpreted from the project root; in Docker, use absolute paths inside the container (e.g.,
/dptoie_python/...).
How to cite
If you find this repo helpful, please consider citing:
@Article{dptoie2025, author={xxx xxx}, title={xxxx}, journal={dddd}, year={xxx}, month={x}, day={cc}, issn={xxx}, doi={xxxxx}, url={asas} }
Authors
- Andre Walker
- Rafael Glauber
- Daniela Barreiro Claro
Metadata
Release files for dptoie 0.1.6
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 |
|---|---|---|---|---|
| dptoie-0.1.6.tar.gz | 16.4 kB | With provenance | Details for dptoie-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dptoie-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for dptoie-0.1.6-py3-none-any.whl |
Total release size: 31.5 kB
Release files / dptoie-0.1.6.tar.gz
| Download URL | dptoie-0.1.6.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
792090e6370da06821abf7c41b6d95520bde3aabccd5d1426ca39fa144439ab6
|
|
BLAKE2b-256 checksum How to use checksums |
8969f315130999eedf05209bdc5538dedbcbb6b016ea5567bd57ef00691b5255
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Oct 21, 2025.
Transparency logRelease files / dptoie-0.1.6-py3-none-any.whl
| Download URL | dptoie-0.1.6-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
550fecf11016d6adc1a5c7d2a92f8c6265f3bde2593f176fb0f32b38c19faff6
|
|
BLAKE2b-256 checksum How to use checksums |
6e2e3817382eda68a6726005494e6aec5cd36fc5361de8d4e668b6c7f3415dd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Oct 21, 2025.
Transparency logSecurity for dptoie 0.1.6
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 dptoie-0.1.6.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 Oct 21, 2025.
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.