Busani
commited on
Commit
•
10630a1
1
Parent(s):
2d5f16d
Updated loading script to render new format
Browse files
cosuju.py
CHANGED
@@ -30,8 +30,8 @@ Court Summaries and Judgements (CoSuJu) Dataset
|
|
30 |
# Redundant but may useful in future.
|
31 |
_URL = "https://frtnx.github.io/cosuju-extractor/dataset/"
|
32 |
_URLS = {
|
33 |
-
'train': _URL + 'train-v1.1.json',
|
34 |
-
|
35 |
}
|
36 |
|
37 |
|
@@ -113,6 +113,25 @@ class Cosuju(datasets.GeneratorBasedBuilder):
|
|
113 |
row['summary_document']['file_content'] == '':
|
114 |
continue
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
id_ = row['id']
|
117 |
result = {
|
118 |
'id': row['id'],
|
|
|
30 |
# Redundant but may useful in future.
|
31 |
_URL = "https://frtnx.github.io/cosuju-extractor/dataset/"
|
32 |
_URLS = {
|
33 |
+
# 'train': _URL + 'train-v1.1.json',
|
34 |
+
'train': _URL + 'train-v1.0.json'
|
35 |
}
|
36 |
|
37 |
|
|
|
113 |
row['summary_document']['file_content'] == '':
|
114 |
continue
|
115 |
|
116 |
+
if 'judgement_document' not in list(row):
|
117 |
+
continue
|
118 |
+
|
119 |
+
if not row['judgement_document']:
|
120 |
+
continue
|
121 |
+
|
122 |
+
judgement_text = row['judgement_document']['file_content']
|
123 |
+
|
124 |
+
if not judgement_text:
|
125 |
+
continue
|
126 |
+
|
127 |
+
judgement_paragraphs = re.split('\\n\\n\[\d+\]', judgement_text)
|
128 |
+
clean_paragraphs = [paragraph.replace('\n', ' ').strip() for paragraph in judgement_paragraphs]
|
129 |
+
squeaky_clean_paragraphs = [re.sub(' +', ' ', paragraph) for paragraph in clean_paragraphs]
|
130 |
+
ultimate_paragraphs = [paragraph.replace('\x0c2', '').replace(' ', ' ') for paragraph in squeaky_clean_paragraphs]
|
131 |
+
|
132 |
+
row['judgement_paragraphs'] = ultimate_paragraphs
|
133 |
+
row['max_length_judgement_paras'] = max([len(paragraph.split(' ')) for paragraph in ultimate_paragraphs])
|
134 |
+
|
135 |
id_ = row['id']
|
136 |
result = {
|
137 |
'id': row['id'],
|