Convert born-digital Indonesian regulatory PDFs (OJK POJK/SEOJK, RI PP/UU) to clean corpus text
Project description
regulasi-id-corpus-prep
Alat CLI untuk mengonversi PDF regulasi Indonesia yang born-digital (POJK, SEOJK dari JDIH OJK) menjadi file .txt bersih yang siap digunakan sebagai input corpus untuk aplikasi NLP hukum, termasuk LexHarmoni.
Syarat: PDF Born-Digital, Bukan Hasil Scan
Alat ini hanya bekerja pada PDF yang memiliki text layer (born-digital). PDF hasil scan (foto/gambar) tidak didukung dan akan ditolak dengan pesan jelas.
Tidak yakin PDF Anda termasuk jenis mana? Lihat docs/DECISION_TREE.md.
Quickstart
Instalasi
pip install regulasi-id-corpus-prep
Atau install dari GitHub (untuk versi terbaru sebelum release):
pip install git+https://github.com/ziffan/regulasi-id-corpus-prep.git
Atau clone dan install dalam mode editable untuk development:
git clone https://github.com/ziffan/regulasi-id-corpus-prep.git
cd regulasi-id-corpus-prep
pip install -e .
Jalankan Pipeline Penuh (untuk pengguna non-teknis)
regulasi-id-corpus-prep run dokumen-saya.pdf --profile ojk-pojk
Atau untuk seluruh folder:
regulasi-id-corpus-prep run ./folder-pdf/ --profile ojk-pojk --output-dir ./output/
Untuk dokumen SEOJK:
regulasi-id-corpus-prep run ./folder-pdf/ --profile ojk-seojk --output-dir ./output/
Perintah Individual
# Langkah 1: Ekstrak teks dari PDF
regulasi-id-corpus-prep extract dokumen.pdf
# Langkah 2: Normalisasi teks
regulasi-id-corpus-prep normalize dokumen.raw.txt --profile ojk-pojk
# Langkah 3: Validasi otomatis
regulasi-id-corpus-prep validate dokumen.txt --profile ojk-pojk
# Lihat profile yang tersedia
regulasi-id-corpus-prep list-profiles
Output yang Dihasilkan
Untuk setiap <nama>.pdf, alat ini menghasilkan:
| File | Isi |
|---|---|
<nama>.raw.txt |
Teks mentah hasil ekstraksi PDF |
<nama>.raw.meta.json |
Metadata ekstraksi (jumlah halaman, timestamp, dll.) |
<nama>.txt |
Teks bersih siap corpus |
<nama>.meta.json |
Audit trail transformasi (rule apa yang diterapkan, berapa match) |
Profile
Profile adalah file YAML yang mendefinisikan aturan pembersihan untuk jenis dokumen tertentu. Profile bawaan yang tersedia:
| Profile | Dokumen | Sumber |
|---|---|---|
ojk-pojk |
POJK (Peraturan OJK) | JDIH OJK |
ojk-seojk |
SEOJK (Surat Edaran OJK) | JDIH OJK |
ri-pp |
PP (Peraturan Pemerintah RI) | peraturan.go.id |
ri-uu |
UU (Undang-Undang RI) | peraturan.go.id |
Untuk membuat profile baru (PBI, Permenkeu, dll.), lihat docs/PROFILE_GUIDE.md dan gunakan regulasi_id_corpus_prep/profiles/_template.yaml sebagai titik awal.
Catatan: Section LAMPIRAN Dikecualikan
Profile ri-pp (dan profile RI lainnya) secara otomatis menghapus section LAMPIRAN beserta seluruh isinya dari output corpus. Ini adalah keputusan yang disengaja:
- LAMPIRAN umumnya berisi tabel, formulir, atau gambar yang tidak membawa makna hukum normatif dalam format teks biasa.
- Untuk kasus di mana isi LAMPIRAN relevan, gunakan file
.raw.txt(output tahap ekstraksi) sebagai sumber teks lengkap tanpa normalisasi.
Validasi Manual
Validasi otomatis (validate subcommand) mengecek hal-hal teknis. Untuk memastikan substansi dokumen benar, ikuti checklist di docs/VALIDATION_GUIDE.md — tidak memerlukan kemampuan pemrograman.
Keterbatasan (v0.2.0)
- PDF born-digital saja. PDF scan (foto regulasi) tidak dapat diproses.
- Bahasa Indonesia. Dokumen berbahasa lain tidak diuji.
- Profile terbatas. Tersedia: POJK, SEOJK, PP, UU. Profile PBI, Permenkeu, dll. belum tersedia.
- Tidak mengunduh PDF. Pengguna perlu mengunduh PDF secara manual dari sumber resmi.
- Tidak ada pemahaman semantik. Output adalah teks biasa; hierarki Pasal tidak diurai.
Lisensi
Apache 2.0. Lihat LICENSE.
Alat ini menggunakan PyMuPDF (AGPL-3.0) sebagai dependensi ekstraksi PDF. Lihat NOTICE untuk detail.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file regulasi_id_corpus_prep-0.2.0.tar.gz.
File metadata
- Download URL: regulasi_id_corpus_prep-0.2.0.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4185f875baf0e332a6d21fbdcf5ae9786874669aae70b53807f0fd247a4a2770
|
|
| MD5 |
bb90dd9322928cde5e87cd4a4275c482
|
|
| BLAKE2b-256 |
6b96624ec7d14ead42204e77af862a41a364894f237b52e2111fc865cd3e353f
|
File details
Details for the file regulasi_id_corpus_prep-0.2.0-py3-none-any.whl.
File metadata
- Download URL: regulasi_id_corpus_prep-0.2.0-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e61325976dd9045eacb131f93e04781282a996be0a042da909502f54d8da089b
|
|
| MD5 |
5a677548c42c46808630576414bf62ed
|
|
| BLAKE2b-256 |
22782e668d3d989942ffb339dbecf1bea81000c56bc16c99a9bfe201f931df14
|