|
@@ -2,6 +2,8 @@ package graph.extractor.graph.builder;
|
2
|
2
|
|
3
|
3
|
|
4
|
4
|
|
|
5
|
+import org.apache.commons.lang3.StringUtils;
|
|
6
|
+
|
5
|
7
|
import dao.entity.DOProcess;
|
6
|
8
|
import dao.entity.Entity;
|
7
|
9
|
import dao.entity.Judge;
|
|
@@ -16,6 +18,9 @@ public class STJBuilder extends BuilderFactory{
|
16
|
18
|
private String normalizeJudgeName(String judgeName)
|
17
|
19
|
{
|
18
|
20
|
|
|
21
|
+ judgeName = StringUtils.stripAccents(judgeName);
|
|
22
|
+
|
|
23
|
+
|
19
|
24
|
if(judgeName.contains("(") && !judgeName.startsWith("(") )
|
20
|
25
|
{
|
21
|
26
|
|
|
@@ -44,7 +49,8 @@ public class STJBuilder extends BuilderFactory{
|
44
|
49
|
|
45
|
50
|
private String normalizeEntityName(String entityName)
|
46
|
51
|
{
|
47
|
|
- String originalEntityName = entityName.trim();
|
|
52
|
+
|
|
53
|
+ entityName = StringUtils.stripAccents(entityName);
|
48
|
54
|
|
49
|
55
|
if(entityName.contains("(PRESO)"))
|
50
|
56
|
{
|
|
@@ -62,6 +68,25 @@ public class STJBuilder extends BuilderFactory{
|
62
|
68
|
{
|
63
|
69
|
entityName = entityName.split("\\(")[0].trim();
|
64
|
70
|
}
|
|
71
|
+ if(entityName.contains("ASSIST"))
|
|
72
|
+ {
|
|
73
|
+
|
|
74
|
+ entityName = entityName.split("ASSIST")[0].trim();
|
|
75
|
+ entityName = entityName.substring(0, entityName.length() -1);
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+ }
|
|
80
|
+ if(entityName.contains("CONVOCADA"))
|
|
81
|
+ {
|
|
82
|
+
|
|
83
|
+ entityName = entityName.split("CONVOCADA")[0].trim();
|
|
84
|
+ entityName = entityName.substring(0, entityName.length() -1);
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+ }
|
|
89
|
+
|
65
|
90
|
|
66
|
91
|
|
67
|
92
|
if(entityName.length() > 0)
|
|
@@ -75,9 +100,14 @@ public class STJBuilder extends BuilderFactory{
|
75
|
100
|
private Lawyer normalizeLawyerName(Lawyer lawyer)
|
76
|
101
|
{
|
77
|
102
|
|
78
|
|
- //String originalEntityName = entityName.trim();
|
|
103
|
+
|
|
104
|
+
|
79
|
105
|
String nameNormalized = lawyer.getName().replaceAll("\\r|\\n", " ").trim();
|
80
|
|
-
|
|
106
|
+ nameNormalized = StringUtils.stripAccents(nameNormalized);
|
|
107
|
+
|
|
108
|
+ nameNormalized = nameNormalized.replaceAll("\"", "").trim();
|
|
109
|
+ nameNormalized = nameNormalized.replaceAll("/", "").trim();
|
|
110
|
+
|
81
|
111
|
|
82
|
112
|
try{
|
83
|
113
|
|
|
@@ -92,6 +122,13 @@ public class STJBuilder extends BuilderFactory{
|
92
|
122
|
}
|
93
|
123
|
nameNormalized = nameNormalized.split("-")[0].trim();
|
94
|
124
|
}
|
|
125
|
+ if(nameNormalized.contains("ASSIST"))
|
|
126
|
+ {
|
|
127
|
+
|
|
128
|
+ nameNormalized = nameNormalized.split("ASSIST")[0].trim();
|
|
129
|
+ nameNormalized = nameNormalized.substring(0, nameNormalized.length() -1);
|
|
130
|
+
|
|
131
|
+ }
|
95
|
132
|
|
96
|
133
|
if(nameNormalized.contains("E OUTRO"))
|
97
|
134
|
{
|
|
@@ -103,6 +140,36 @@ public class STJBuilder extends BuilderFactory{
|
103
|
140
|
nameNormalized = TYPES.NAMEDEFAULT;
|
104
|
141
|
}
|
105
|
142
|
|
|
143
|
+ if(nameNormalized.contains("EM CAUSA") )
|
|
144
|
+ {
|
|
145
|
+ nameNormalized = nameNormalized.split("EM CAUSA")[0].trim();
|
|
146
|
+ nameNormalized = nameNormalized.substring(0, nameNormalized.length() -1).trim();
|
|
147
|
+
|
|
148
|
+ }
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+ if(nameNormalized.endsWith(" E"))
|
|
152
|
+ {
|
|
153
|
+ nameNormalized = nameNormalized.split(" E")[0].trim();
|
|
154
|
+ }
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+ if(this.getLowerCasePCT(nameNormalized) > 70)
|
|
158
|
+ {
|
|
159
|
+ nameNormalized = TYPES.NAMEDEFAULT;
|
|
160
|
+ }
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+ if(nameNormalized.equals(""))
|
|
164
|
+ {
|
|
165
|
+ lawyer.setName(lawyer.getName());
|
|
166
|
+ }
|
|
167
|
+ else
|
|
168
|
+ {
|
|
169
|
+ lawyer.setName(nameNormalized);
|
|
170
|
+ }
|
|
171
|
+
|
|
172
|
+
|
106
|
173
|
|
107
|
174
|
}
|
108
|
175
|
catch(Exception e)
|
|
@@ -112,37 +179,6 @@ public class STJBuilder extends BuilderFactory{
|
112
|
179
|
}
|
113
|
180
|
|
114
|
181
|
|
115
|
|
-
|
116
|
|
-
|
117
|
|
-
|
118
|
|
-
|
119
|
|
- if(nameNormalized.contains("EM CAUSA") )
|
120
|
|
- {
|
121
|
|
- nameNormalized = nameNormalized.split("EM CAUSA")[0].trim();
|
122
|
|
- nameNormalized = nameNormalized.substring(0, nameNormalized.length() -1).trim();
|
123
|
|
-
|
124
|
|
- }
|
125
|
|
-
|
126
|
|
- if(nameNormalized.equals("E OUTRO(S)"))
|
127
|
|
- {
|
128
|
|
- nameNormalized = TYPES.NAMEDEFAULT;
|
129
|
|
- }
|
130
|
|
-
|
131
|
|
-
|
132
|
|
- if(nameNormalized.endsWith(" E"))
|
133
|
|
- {
|
134
|
|
- nameNormalized = nameNormalized.split(" E")[0].trim();
|
135
|
|
- }
|
136
|
|
-
|
137
|
|
- if(nameNormalized.equals(""))
|
138
|
|
- {
|
139
|
|
- lawyer.setName(lawyer.getName());
|
140
|
|
- }
|
141
|
|
- else
|
142
|
|
- {
|
143
|
|
- lawyer.setName(nameNormalized);
|
144
|
|
- }
|
145
|
|
-
|
146
|
182
|
return lawyer;
|
147
|
183
|
|
148
|
184
|
|
|
@@ -179,8 +215,12 @@ public class STJBuilder extends BuilderFactory{
|
179
|
215
|
if(type.contains("ADVOGAD") || type.contains("PROCURADOR") )
|
180
|
216
|
{
|
181
|
217
|
|
182
|
|
-
|
183
|
|
- entity = this.normalizeLawyerName(new Lawyer(canditate.split(":")[1].trim()) );
|
|
218
|
+ Lawyer lawyer = this.normalizeLawyerName(new Lawyer(canditate.split(":")[1].trim()));
|
|
219
|
+ entity.setName( lawyer.getName());
|
|
220
|
+ if(lawyer.getOABNumber()!= null && lawyer.getOABNumber().equals(""))
|
|
221
|
+ {
|
|
222
|
+ entity.setOABNumber(lawyer.getOABNumber());
|
|
223
|
+ }
|
184
|
224
|
entity.setType(TYPES.LAWYER);
|
185
|
225
|
if(type.contains("ADVOGADOS") )
|
186
|
226
|
nextLawyer = true;
|
|
@@ -196,7 +236,8 @@ public class STJBuilder extends BuilderFactory{
|
196
|
236
|
{
|
197
|
237
|
nextLawyer = false;
|
198
|
238
|
entity.setType(TYPES.LAWYER);
|
199
|
|
- entity.setName(canditate);
|
|
239
|
+ Lawyer lawyer = this.normalizeLawyerName(new Lawyer(canditate));
|
|
240
|
+ entity.setName(lawyer.getName());
|
200
|
241
|
|
201
|
242
|
}
|
202
|
243
|
else{
|
|
@@ -228,19 +269,6 @@ public class STJBuilder extends BuilderFactory{
|
228
|
269
|
|
229
|
270
|
DOProcess proc = new DOProcess();
|
230
|
271
|
|
231
|
|
-// try{
|
232
|
|
-// File file = new File("/home/ailton/Monografia/log");
|
233
|
|
-// FileWriter fileWriter = new FileWriter(file, true);
|
234
|
|
-// PrintWriter out = new PrintWriter(fileWriter);
|
235
|
|
-// out.println(process);
|
236
|
|
-// out.println();
|
237
|
|
-// out.close();
|
238
|
|
-//
|
239
|
|
-// }catch(Exception e)
|
240
|
|
-// {
|
241
|
|
-// e.printStackTrace();
|
242
|
|
-// }
|
243
|
|
-
|
244
|
272
|
|
245
|
273
|
proc.setOrign("DJ_STJ");
|
246
|
274
|
|
|
@@ -273,6 +301,10 @@ public class STJBuilder extends BuilderFactory{
|
273
|
301
|
|
274
|
302
|
String processType = firstLine.toLowerCase().split("nº")[0].toLowerCase();
|
275
|
303
|
firstLine = firstLine.substring(processType.length());
|
|
304
|
+ processType = StringUtils.stripAccents(processType);
|
|
305
|
+ processType = processType.replaceAll("[^A-Za-z0-9 ]", "");
|
|
306
|
+
|
|
307
|
+
|
276
|
308
|
ProcessTypes procType = new ProcessTypes(processType);
|
277
|
309
|
proc.setProcessType(procType);
|
278
|
310
|
|