Spaces:
Sleeping
Sleeping
ashe0042 commited on
Commit ·
97459e2
1
Parent(s): e949834
Clause-aware chunker: paragraph ID preservation, header fix, SCHEDULE tagging, APRA artifact filter
Browse files- scripts/inspect_oalc.py +48 -0
- src/__init__.py +0 -0
- src/configs/__init__.py +0 -0
- src/db.py +1 -0
scripts/inspect_oalc.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Throwaway inspection script — DO NOT use in pipeline.
|
| 3 |
+
Streams OALC, finds first Corporations Act 2001 (Cth) primary-legislation record,
|
| 4 |
+
and prints enough of the text to judge how section/heading markers appear.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from datasets import load_dataset
|
| 8 |
+
|
| 9 |
+
ds = load_dataset(
|
| 10 |
+
"isaacus/open-australian-legal-corpus",
|
| 11 |
+
split="corpus",
|
| 12 |
+
streaming=True,
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
target = None
|
| 16 |
+
for i, record in enumerate(ds):
|
| 17 |
+
if i % 5000 == 0:
|
| 18 |
+
print(f" scanned {i} records...")
|
| 19 |
+
|
| 20 |
+
if (
|
| 21 |
+
record.get("jurisdiction") == "commonwealth"
|
| 22 |
+
and record.get("type") == "primary_legislation"
|
| 23 |
+
and "Corporations Act 2001" in (record.get("citation") or "")
|
| 24 |
+
):
|
| 25 |
+
target = record
|
| 26 |
+
print(f"\nFound at record #{i}\n")
|
| 27 |
+
break
|
| 28 |
+
|
| 29 |
+
if target is None:
|
| 30 |
+
print("No matching record found.")
|
| 31 |
+
else:
|
| 32 |
+
text = target.pop("text")
|
| 33 |
+
|
| 34 |
+
print("=== FIELDS (excl. text) ===")
|
| 35 |
+
for k, v in target.items():
|
| 36 |
+
print(f" {k}: {v!r}")
|
| 37 |
+
|
| 38 |
+
print(f"\n=== TEXT LENGTH ===")
|
| 39 |
+
print(f" len(text) = {len(text)}")
|
| 40 |
+
|
| 41 |
+
print(f"\n=== text[:3000] ===")
|
| 42 |
+
print(text[:3000])
|
| 43 |
+
|
| 44 |
+
print(f"\n=== text[50000:53000] ===")
|
| 45 |
+
if len(text) >= 50000:
|
| 46 |
+
print(text[50000:53000])
|
| 47 |
+
else:
|
| 48 |
+
print(f" (text is only {len(text)} chars — no slice at 50000)")
|
src/__init__.py
ADDED
|
File without changes
|
src/configs/__init__.py
ADDED
|
File without changes
|
src/db.py
CHANGED
|
@@ -34,3 +34,4 @@ if __name__ == "__main__":
|
|
| 34 |
|
| 35 |
print(f"Postgres: {pg_version}")
|
| 36 |
print(f"pgvector enabled: {pgvector_row is not None}")
|
|
|
|
|
|
| 34 |
|
| 35 |
print(f"Postgres: {pg_version}")
|
| 36 |
print(f"pgvector enabled: {pgvector_row is not None}")
|
| 37 |
+
|