Can now detect when it says "justice X dissents."
Browse files
Tagger.py
CHANGED
|
@@ -78,6 +78,7 @@ def get_other_justice_sentences(paras_text, ind_maj):
|
|
| 78 |
data['Recused'].append((s,i, counter))
|
| 79 |
return data
|
| 80 |
|
|
|
|
| 81 |
def split(paras_text, maj, other_data):
|
| 82 |
opinions = []
|
| 83 |
opinions.append(('Majority', maj[0], maj[1], maj[2]))
|
|
@@ -96,9 +97,11 @@ def split(paras_text, maj, other_data):
|
|
| 96 |
if i == len(opinions) - 1:
|
| 97 |
end_ind = len(paras_text)
|
| 98 |
else:
|
| 99 |
-
end_ind = int(opinions[i + 1][
|
| 100 |
-
2]) # Next one is where current left off? Or ideally, would also work with all the BS "Supreme Court of US" stuff?
|
| 101 |
start_ind = int(opinion[2])
|
|
|
|
|
|
|
|
|
|
| 102 |
o = {'Type': opinion[0], 'Author Sent': opinion[1], 'Start Para Ind': start_ind, 'End Para Ind': end_ind}
|
| 103 |
o['Text'] = "<PARA>".join(paras_text[start_ind:end_ind])
|
| 104 |
opinions_data.append(o)
|
|
@@ -136,6 +139,4 @@ def process_file(folderpath, draw=False):
|
|
| 136 |
for c in other_data['Concurrences']:
|
| 137 |
draw_line_above_sent(folderpath, c[0], c[1], color=(0,100,0))
|
| 138 |
for d in other_data['Dissents']:
|
| 139 |
-
draw_line_above_sent(folderpath, d[0], d[1], color=(0,0,100))
|
| 140 |
-
|
| 141 |
-
|
|
|
|
| 78 |
data['Recused'].append((s,i, counter))
|
| 79 |
return data
|
| 80 |
|
| 81 |
+
|
| 82 |
def split(paras_text, maj, other_data):
|
| 83 |
opinions = []
|
| 84 |
opinions.append(('Majority', maj[0], maj[1], maj[2]))
|
|
|
|
| 97 |
if i == len(opinions) - 1:
|
| 98 |
end_ind = len(paras_text)
|
| 99 |
else:
|
| 100 |
+
end_ind = int(opinions[i + 1][2]) # Next one is where current left off? Or ideally, would also work with all the BS "Supreme Court of US" stuff?
|
|
|
|
| 101 |
start_ind = int(opinion[2])
|
| 102 |
+
|
| 103 |
+
if end_ind == start_ind:
|
| 104 |
+
end_ind += 1
|
| 105 |
o = {'Type': opinion[0], 'Author Sent': opinion[1], 'Start Para Ind': start_ind, 'End Para Ind': end_ind}
|
| 106 |
o['Text'] = "<PARA>".join(paras_text[start_ind:end_ind])
|
| 107 |
opinions_data.append(o)
|
|
|
|
| 139 |
for c in other_data['Concurrences']:
|
| 140 |
draw_line_above_sent(folderpath, c[0], c[1], color=(0,100,0))
|
| 141 |
for d in other_data['Dissents']:
|
| 142 |
+
draw_line_above_sent(folderpath, d[0], d[1], color=(0,0,100))
|
|
|
|
|
|