Skip to content

Commit 9b92938

Browse files
committed
refactor: move arquivos para buildar lib
1 parent d2a1ae6 commit 9b92938

File tree

9 files changed

+30
-29
lines changed

9 files changed

+30
-29
lines changed

.github/workflows/extrai_fatos.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
echo "[JSON] input=$filename flags=[$flags]"
3838
# remove stale json output if any
3939
rm -f ./outputs/output.json
40-
docker run --rm -v "$(pwd)":/dptoie_python dptoie_python poetry run python3 src/main.py -i "$input_path" $input_args $flags || echo "json-run-failed for $filename $flags"
40+
docker run --rm -v "$(pwd)":/dptoie_python dptoie_python poetry run python3 src/dptoie_python/main.py -i "$input_path" $input_args $flags || echo "json-run-failed for $filename $flags"
4141
4242
# compute cleaned suffix for filename (empty => base name only)
4343
if [[ -z "$flags" ]]; then
@@ -58,7 +58,7 @@ jobs:
5858
echo "[CSV] input=$filename flags=[$flags]"
5959
# remove stale csv output if any
6060
rm -f ./outputs/output.csv
61-
docker run --rm -v "$(pwd)":/dptoie_python dptoie_python poetry run python3 src/main.py -i "$input_path" $input_args $flags -o ./outputs/output.csv -ot csv || echo "csv-run-failed for $filename $flags"
61+
docker run --rm -v "$(pwd)":/dptoie_python dptoie_python poetry run python3 src/dptoie_python/main.py -i "$input_path" $input_args $flags -o ./outputs/output.csv -ot csv || echo "csv-run-failed for $filename $flags"
6262
6363
if [[ -z "$flags" ]]; then
6464
out_csv="./outputs/${name}.csv"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ out.txt
66
!/outputs/.gitkeep
77
/models/*
88
!/models/.gitkeep
9+
/dist/

README-ptbr.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
Extrator de Informação Aberta para língua portuguesa baseado em análise de dependências (SpaCy + Stanza).
55

6-
Este guia mostra todas as formas de rodar o projeto pelo `src/main.py`, com todas as variações de argumentos, tanto localmente (Poetry) quanto com Docker/Docker Compose.
6+
Este guia mostra todas as formas de rodar o projeto pelo `src/dptoie_python/main.py`, com todas as variações de argumentos, tanto localmente (Poetry) quanto com Docker/Docker Compose.
77

88
- Requisitos mínimos: Python 3.12+, Poetry, ou Docker (opcional)
99
- Modelos: o Stanza faz o download automático na primeira execução. Você pode definir `STANZA_RESOURCES_DIR` para usar um diretório local de modelos (ex.: `./models/.stanza_resources`).
@@ -30,7 +30,7 @@ poetry install
3030
Forma geral:
3131

3232
```bash
33-
poetry run python3 src/main.py \
33+
poetry run python3 src/dptoie_python/main.py \
3434
-i <caminho_entrada> \
3535
-it <txt|conll> \
3636
-o <caminho_saida> \
@@ -60,37 +60,37 @@ Importante:
6060

6161
1) TXT de entrada, JSON de saída (padrões):
6262
```bash
63-
poetry run python3 src/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.json -ot json
63+
poetry run python3 src/dptoie_python/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.json -ot json
6464
```
6565

6666
2) TXT de entrada, CSV de saída, ativando coordenação e sujeito oculto:
6767
```bash
68-
poetry run python3 src/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.csv -ot csv -cc
68+
poetry run python3 src/dptoie_python/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.csv -ot csv -cc
6969
```
7070

7171
3) TXT de entrada, saída em texto legível:
7272
```bash
73-
poetry run python3 src/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.txt -ot txt -cc -sc -a -t
73+
poetry run python3 src/dptoie_python/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.txt -ot txt -cc -sc -a -t
7474
```
7575

7676
4) Entrada já em CoNLL-U, JSON de saída:
7777
```bash
78-
poetry run python3 src/main.py -i ./inputs/teste.conll -it conll -o ./outputs/out.json -ot json -cc -sc -a -t
78+
poetry run python3 src/dptoie_python/main.py -i ./inputs/teste.conll -it conll -o ./outputs/out.json -ot json -cc -sc -a -t
7979
```
8080

8181
5) Somente conjunções coordenativas:
8282
```bash
83-
poetry run python3 src/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/cc.json -ot json -cc
83+
poetry run python3 src/dptoie_python/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/cc.json -ot json -cc
8484
```
8585

8686
6) Modo debug para inspeção detalhada:
8787
```bash
88-
poetry run python3 src/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.json -ot json -cc -debug
88+
poetry run python3 src/dptoie_python/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.json -ot json -cc -debug
8989
```
9090

9191
7) Ver lista de argumentos:
9292
```bash
93-
poetry run python3 src/main.py -h
93+
poetry run python3 src/dptoie_python/main.py -h
9494
```
9595

9696
Saídas esperadas:
@@ -112,7 +112,7 @@ docker run --rm -it \
112112
-v "$(pwd)":/dptoie_python \
113113
-w /dptoie_python \
114114
dptoie_python \
115-
poetry run python3 src/main.py -i /dptoie_python/inputs/teste.conll -it conll -o /dptoie_python/outputs/out.json -ot json -cc -sc -a -t
115+
poetry run python3 src/dptoie_python/main.py -i /dptoie_python/inputs/teste.conll -it conll -o /dptoie_python/outputs/out.json -ot json -cc -sc -a -t
116116
```
117117

118118
Observação: ajuste os caminhos de `-i` e `-o` conforme necessário; use `-it txt` quando a entrada for texto linha-a-linha.
@@ -122,7 +122,7 @@ Observação: ajuste os caminhos de `-i` e `-o` conforme necessário; use `-it t
122122
O arquivo `docker-compose.yml` já inclui o serviço `dptoie_python`. Você pode editar a linha `command:` para o cenário desejado. Exemplo de comando recomendado:
123123

124124
```yaml
125-
command: poetry run python3 src/main.py -i /dptoie_python/inputs/teste.conll -it conll -o /dptoie_python/outputs/out.json -ot json -cc -sc -a -t
125+
command: poetry run python3 src/dptoie_python/main.py -i /dptoie_python/inputs/teste.conll -it conll -o /dptoie_python/outputs/out.json -ot json -cc -sc -a -t
126126
```
127127

128128
Então rode:
@@ -132,7 +132,7 @@ docker compose up --build
132132

133133
Use o comando `run` para executar outros comandos personalizados:
134134
```bash
135-
docker compose run dptoie_python poetry run python3 src/main.py -i /dptoie_python/inputs/ceten-200.txt -it txt -o /dptoie_python/outputs/out.csv -ot csv -cc
135+
docker compose run dptoie_python poetry run python3 src/dptoie_python/main.py -i /dptoie_python/inputs/ceten-200.txt -it txt -o /dptoie_python/outputs/out.csv -ot csv -cc
136136
```
137137

138138

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Open Information Extractor for Portuguese based on dependency analysis (SpaCy + Stanza).
44

5-
This guide shows all ways to run the project via `src/main.py`, with all argument variations, both locally (Poetry) and with Docker / Docker Compose.
5+
This guide shows all ways to run the project via `src/dptoie_python/main.py`, with all argument variations, both locally (Poetry) and with Docker / Docker Compose.
66

77
- Minimum requirements: Python 3.12+, Poetry, or Docker (optional)
88
- Models: Stanza downloads models automatically on first run. You can set `STANZA_RESOURCES_DIR` to use a local models directory (e.g., `./models/.stanza_resources`).
@@ -29,7 +29,7 @@ poetry install
2929
General form:
3030

3131
```bash
32-
poetry run python3 src/main.py \
32+
poetry run python3 src/dptoie_python/main.py \
3333
-i <input_path> \
3434
-it <txt|conll> \
3535
-o <output_path> \
@@ -59,37 +59,37 @@ Important:
5959

6060
1) TXT input, JSON output (defaults):
6161
```bash
62-
poetry run python3 src/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.json -ot json
62+
poetry run python3 src/dptoie_python/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.json -ot json
6363
```
6464

6565
2) TXT input, CSV output, enabling coordination and hidden subject (flag example):
6666
```bash
67-
poetry run python3 src/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.csv -ot csv -cc
67+
poetry run python3 src/dptoie_python/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.csv -ot csv -cc
6868
```
6969

7070
3) TXT input, human-readable text output:
7171
```bash
72-
poetry run python3 src/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.txt -ot txt -cc -sc -a -t
72+
poetry run python3 src/dptoie_python/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.txt -ot txt -cc -sc -a -t
7373
```
7474

7575
4) Input already in CoNLL-U, JSON output:
7676
```bash
77-
poetry run python3 src/main.py -i ./inputs/teste.conll -it conll -o ./outputs/out.json -ot json -cc -sc -a -t
77+
poetry run python3 src/dptoie_python/main.py -i ./inputs/teste.conll -it conll -o ./outputs/out.json -ot json -cc -sc -a -t
7878
```
7979

8080
5) Only coordinating conjunctions:
8181
```bash
82-
poetry run python3 src/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/cc.json -ot json -cc
82+
poetry run python3 src/dptoie_python/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/cc.json -ot json -cc
8383
```
8484

8585
6) Debug mode for detailed inspection:
8686
```bash
87-
poetry run python3 src/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.json -ot json -cc -debug
87+
poetry run python3 src/dptoie_python/main.py -i ./inputs/ceten-200.txt -it txt -o ./outputs/out.json -ot json -cc -debug
8888
```
8989

9090
7) Show arguments list:
9191
```bash
92-
poetry run python3 src/main.py -h
92+
poetry run python3 src/dptoie_python/main.py -h
9393
```
9494

9595
Expected outputs:
@@ -111,7 +111,7 @@ docker run --rm -it \
111111
-v "$(pwd)":/dptoie_python \
112112
-w /dptoie_python \
113113
dptoie_python \
114-
poetry run python3 src/main.py -i /dptoie_python/inputs/teste.conll -it conll -o /dptoie_python/outputs/out.json -ot json -cc -sc -a -t
114+
poetry run python3 src/dptoie_python/main.py -i /dptoie_python/inputs/teste.conll -it conll -o /dptoie_python/outputs/out.json -ot json -cc -sc -a -t
115115
```
116116

117117
Note: adjust the `-i` and `-o` paths as needed; use `-it txt` when the input is line-by-line text.
@@ -121,7 +121,7 @@ Note: adjust the `-i` and `-o` paths as needed; use `-it txt` when the input is
121121
The `docker-compose.yml` file already includes the `dptoie_python` service. You can edit the `command:` line for the desired scenario. Example recommended command:
122122

123123
```yaml
124-
command: poetry run python3 src/main.py -i /dptoie_python/inputs/teste.conll -it conll -o /dptoie_python/outputs/out.json -ot json -cc -sc -a -t
124+
command: poetry run python3 src/dptoie_python/main.py -i /dptoie_python/inputs/teste.conll -it conll -o /dptoie_python/outputs/out.json -ot json -cc -sc -a -t
125125
```
126126
127127
Then run:
@@ -131,7 +131,7 @@ docker compose up --build
131131

132132
Use `run` to execute other custom commands:
133133
```bash
134-
docker compose run dptoie_python poetry run python3 src/main.py -i /dptoie_python/inputs/ceten-200.txt -it txt -o /dptoie_python/outputs/out.csv -ot csv -cc
134+
docker compose run dptoie_python poetry run python3 src/dptoie_python/main.py -i /dptoie_python/inputs/ceten-200.txt -it txt -o /dptoie_python/outputs/out.csv -ot csv -cc
135135
```
136136

137137
Tips:

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ services:
66
container_name: dptoie_python
77
volumes:
88
- .:/dptoie_python
9-
command: poetry run python3 src/main.py -i /dptoie_python/inputs/teste.conll -it conll -o /dptoie_python/outputs/output.json -ot json -cc -sc -hs -a -t
9+
command: poetry run python3 src/dptoie_python/main.py -i /dptoie_python/inputs/teste.conll -it conll -o /dptoie_python/outputs/output.json -ot json -cc -sc -hs -a -t
1010
environment:
1111
- STANZA_RESOURCES_DIR=/dptoie_python/models/.stanza_resources

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
description = "DPToie-Python is an Open Information Extractor for Portuguese language that employs Dependence Parser and Part of Speech Tagger models with Stanford CoreNLP."
55
authors = ["André Walker <[email protected]>", "Rafael Glauber <[email protected]>", "Daniela Barreiro Claro <[email protected]>"]
66
readme = "README.md"
7-
package-mode = false
7+
package-mode = true
88

99
[tool.poetry.dependencies]
1010
python = ">=3.12,<3.14"
File renamed without changes.
File renamed without changes.

src/main.py renamed to src/dptoie_python/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from spacy import Language
1515
from typing import Any, Generator
1616
from spacy_conll.parser import ConllParser
17-
from src.extraction import Extractor, ExtractorConfig, Extraction
17+
from src.dptoie_python.extraction import Extractor, ExtractorConfig, Extraction
1818

1919

2020
def generate_conll_file_from_sentences_file(input_file: str) -> str:

0 commit comments

Comments
 (0)