Adding support to case laws in the loading script.
Browse files- rag-rfb.py +10 -2
rag-rfb.py
CHANGED
|
@@ -36,6 +36,7 @@ Retrieval Augmented Generation (RAG) dataset for Brazilian Federal Revenue Servi
|
|
| 36 |
_URLS = {
|
| 37 |
"2024.questions": "https://huggingface.co/datasets/unicamp-dl/rag-rfb/resolve/main/questions_QA_2024_v1.0.json",
|
| 38 |
"2024.sources": "https://huggingface.co/datasets/unicamp-dl/rag-rfb/resolve/main/referred_legal_documents_QA_2024_v1.0.json",
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
|
|
@@ -60,7 +61,7 @@ def generate_examples_questions(filepath):
|
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
-
def
|
| 64 |
|
| 65 |
with open(filepath, encoding="utf-8") as input_file:
|
| 66 |
references = json.load(input_file)
|
|
@@ -87,7 +88,14 @@ class RAG_RFB(datasets.GeneratorBasedBuilder):
|
|
| 87 |
name="2024.sources",
|
| 88 |
description="Legal documents referred by the 2024 Questions & Answers document.",
|
| 89 |
version=datasets.Version("1.0.0"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
)
|
|
|
|
| 91 |
]
|
| 92 |
)
|
| 93 |
|
|
@@ -151,4 +159,4 @@ class RAG_RFB(datasets.GeneratorBasedBuilder):
|
|
| 151 |
if "questions" in self.config.name:
|
| 152 |
return generate_examples_questions(filepath)
|
| 153 |
else:
|
| 154 |
-
return
|
|
|
|
| 36 |
_URLS = {
|
| 37 |
"2024.questions": "https://huggingface.co/datasets/unicamp-dl/rag-rfb/resolve/main/questions_QA_2024_v1.0.json",
|
| 38 |
"2024.sources": "https://huggingface.co/datasets/unicamp-dl/rag-rfb/resolve/main/referred_legal_documents_QA_2024_v1.0.json",
|
| 39 |
+
"2024.caselaw": "https://huggingface.co/datasets/unicamp-dl/rag-rfb/resolve/main/acordaos_CARF_2023.json"
|
| 40 |
}
|
| 41 |
|
| 42 |
|
|
|
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
+
def generate_examples_sources_and_caselaw(filepath):
|
| 65 |
|
| 66 |
with open(filepath, encoding="utf-8") as input_file:
|
| 67 |
references = json.load(input_file)
|
|
|
|
| 88 |
name="2024.sources",
|
| 89 |
description="Legal documents referred by the 2024 Questions & Answers document.",
|
| 90 |
version=datasets.Version("1.0.0"),
|
| 91 |
+
),
|
| 92 |
+
|
| 93 |
+
datasets.BuilderConfig(
|
| 94 |
+
name="2024.caselaw",
|
| 95 |
+
description="Case Law documents from 2023, directly related to the 2024 Questions & Answers document.",
|
| 96 |
+
version=datasets.Version("1.0.0"),
|
| 97 |
)
|
| 98 |
+
|
| 99 |
]
|
| 100 |
)
|
| 101 |
|
|
|
|
| 159 |
if "questions" in self.config.name:
|
| 160 |
return generate_examples_questions(filepath)
|
| 161 |
else:
|
| 162 |
+
return generate_examples_sources_and_caselaw(filepath)
|