Preprocessor { public static Set<String> find_potential_abbreviations(File file) { if (!file.canRead()) { throw new IllegalArgumentException(file + " is non-existent or not readable"); } Pattern p = Pattern.compile("\\b([A-Z][a-zA-Z]{1,5})\\."); Pattern blank_line = Pattern.compile("^\\s*$"); Set<String> potentials = new HashSet<String>(); Set<String> black_list = new HashSet<String>(); try { BufferedReader f = new BufferedReader(new FileReader(file)); String line; int last_length = 0; int last_end = 0; Matcher m_blank = null; String last_match = ""; while ((line = f.readLine()) != null) { if ((!last_match.equals("")) && last_end == last_length && (m_blank = blank_line.matcher(line)) != null && m_blank.find()) { black_list.add(last_match); last_match = ""; last_length = 0; } else { Matcher m = p.matcher(line); last_match = ""; last_end = 0; String possible_abbreviation = ""; while (m.find()) { if (last_end != m.start()) { if (!possible_abbreviation.equals("")) { potentials.add(possible_abbreviation); last_match = possible_abbreviation; possible_abbreviation = ""; } if (m.end() >= line.length() || line.charAt(m.end()) != '.') { possible_abbreviation = m.group(); } } else { possible_abbreviation += m.group(); } last_end = m.end(); } if (last_end == 0 && possible_abbreviation.equals("")) { } else if (!possible_abbreviation.equals("")) { potentials.add(possible_abbreviation); last_match = possible_abbreviation; possible_abbreviation = ""; } last_length = line.length(); } } } catch (FileNotFoundException e) { e.printStackTrace(); System.exit(-1); } catch (IOException e) { e.printStackTrace(); System.exit(-1); } potentials.removeAll(black_list); return potentials; }  static void main(String[] args); static String preprocess(String file); static void removeuseless(String filename, String outfilename); static void usecomma(String filename, String outfilename,
			String charactersplit); static Set<String> find_abbreviations(File file); static Set<String> find_potential_abbreviations(File file); static Set<String> find_simple_regex_abbreviations(File file); static void removeBOM(String filename);  }
@Ignore @Test public void testFind_potential_abbreviations() { fail("Not yet implemented"); }