@@ -267,40 +267,42 @@ public static String[] separatePathologyHeaderFooter(String input) throws Except
267267 sb .append ("\n " );
268268 iLine ++;
269269 }
270- // make header
271- text [0 ] = TextUtil .removeDuplicatedSpace (sb .toString ().trim ());
270+
271+ // make header
272+ text [0 ] = TextUtil .removeDuplicatedSpace (sb .toString ().trim ());
272273
273- // content starts from here until meet Pathologist (beginning of a sentence)
274- sb = new StringBuilder ();
275- if (iLine < allLines - 1 ) {
276- iLine ++;
277- // text += lines[iLine].trim() + "\n";
278- sb .append (lines [iLine ].trim ());
279- sb .append ("\n " );
280- }
281- else {
282- iLine = -1 ;
283- }
284- iLine ++;
274+ // // content starts from here until meet Pathologist (beginning of a sentence)
275+ // sb = new StringBuilder();
276+ // if(iLine < allLines - 1) {
277+ // iLine++;
278+ // // text += lines[iLine].trim() + "\n";
279+ // sb.append(lines[iLine].trim());
280+ // sb.append("\n");
281+ // }
282+ // else {
283+ // iLine = -1;
284+ // }
285+ // iLine++;
285286
286- Pattern p = Pattern .compile ("^\\ s*Pathologist" );
287- Matcher m = p .matcher (lines [iLine ]);
288- while (iLine < allLines && !m .find ()) {
289- if (!lines [iLine ].trim ().equals ("" )) {
290- // text += lines[iLine].trim() + "\n";
291- sb .append (lines [iLine ].trim ());
292- sb .append ("\n " );
293- }
294- iLine ++;
295- m = p .matcher (lines [iLine ]);
296- }
297- // skip until meet GROSS DESCRIPTION
298- p = Pattern .compile ("^GROSS DESCRIPTION" );
299- m = p .matcher (lines [iLine ]);
300- while (iLine < allLines && !m .find ()) {
301- iLine ++;
302- m = p .matcher (lines [iLine ]);
303- }
287+ // Pattern p = Pattern.compile("^\\s*Pathologist");
288+ // Matcher m = p.matcher(lines[iLine]);
289+ // while(iLine < allLines && !m.find()) {
290+ // if(!lines[iLine].trim().equals("")) {
291+ // // text += lines[iLine].trim() + "\n";
292+ // sb.append(lines[iLine].trim());
293+ // sb.append("\n");
294+ // }
295+ // iLine++;
296+ // m = p.matcher(lines[iLine]);
297+ // }
298+ // // skip until meet GROSS DESCRIPTION
299+ // p = Pattern.compile("^GROSS DESCRIPTION");
300+ // m = p.matcher(lines[iLine]);
301+ // while(iLine < allLines && !m.find()) {
302+ // iLine++;
303+ // m = p.matcher(lines[iLine]);
304+ // }
305+
304306 // keep contain until meet E_O_R
305307 while (iLine < allLines && lines [iLine ].indexOf ("E_O_R" ) == -1 ) {
306308 if (!lines [iLine ].trim ().equals ("" )) {
@@ -310,22 +312,23 @@ public static String[] separatePathologyHeaderFooter(String input) throws Except
310312 }
311313 iLine ++;
312314 }
313- // make content
315+
316+ // make content
314317 // remove stop word
315- // and **ID-NUM
316- text [1 ] = TextUtil .removeDuplicatedSpace (sb .toString ().trim ());
318+ // and **ID-NUM
319+ text [1 ] = TextUtil .removeDuplicatedSpace (sb .toString ().trim ());
317320 text [1 ] = text [1 ].replaceAll ("\\ *\\ *ID\\ -NUM" , "" );
318321 text [1 ] = text [1 ].replaceAll ("\\ *\\ *INITIALS" , "" );
319322 text [1 ] = text [1 ].replaceAll ("_{3,}" , "" );
320323
321- // footer starts from here to the end
322- sb = new StringBuilder ();
323- while (iLine < allLines ) {
324- sb .append (lines [iLine ++].trim ());
325- sb .append ("\n " );
326- }
327- // make the footer
328- text [2 ] = TextUtil .removeDuplicatedSpace (sb .toString ().trim ());
324+ // footer starts from here to the end
325+ sb = new StringBuilder ();
326+ while (iLine < allLines ) {
327+ sb .append (lines [iLine ++].trim ());
328+ sb .append ("\n " );
329+ }
330+ // make the footer
331+ text [2 ] = TextUtil .removeDuplicatedSpace (sb .toString ().trim ());
329332
330333 return text ;
331334 }
0 commit comments