Spaces:
Sleeping
Sleeping
Create ingest/utils.py
Browse files- ingest/utils.py +7 -23
ingest/utils.py
CHANGED
|
@@ -1,25 +1,9 @@
|
|
| 1 |
-
def
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def classify_foia_exemptions(text: str):
|
| 8 |
-
# Explainable, rule-based, non-inferential
|
| 9 |
-
exemptions = []
|
| 10 |
-
lowered = text.lower()
|
| 11 |
-
if "national security" in lowered:
|
| 12 |
-
exemptions.append("b(1)")
|
| 13 |
-
if "internal personnel" in lowered:
|
| 14 |
-
exemptions.append("b(2)")
|
| 15 |
-
if "privacy" in lowered:
|
| 16 |
-
exemptions.append("b(6)")
|
| 17 |
-
return exemptions or ["none"]
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
def format_citation(record: dict) -> str:
|
| 21 |
return (
|
| 22 |
-
f"{
|
| 23 |
-
f"
|
| 24 |
-
f"
|
| 25 |
)
|
|
|
|
| 1 |
+
def format_bluebook_citation(r: dict) -> str:
|
| 2 |
+
"""
|
| 3 |
+
Court-ready, conservative Bluebook-style citation
|
| 4 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
return (
|
| 6 |
+
f"{r.get('source')}, "
|
| 7 |
+
f"{r.get('title')}, "
|
| 8 |
+
f"available at {r.get('url')}."
|
| 9 |
)
|