@Test void testEndPositionWithWhiteWordsContainsPeriodInternally() { Pattern pattern = Pattern.compile("\\."); String str = "At 10 a.m. we had a lunch."; List<String> whiteList = generateUmList("a.m."); EndOfSentenceDetector detector = new EndOfSentenceDetector(pattern, whiteList); assertEquals(25, detector.getSentenceEndPosition(str, 0)); }
public int getSentenceEndPosition(String str, int startPosition) { Set<Integer> nonEndOfSentencePositions = extractNonEndOfSentencePositions(str); int result = str.length(); try { result = getEndPosition(str, startPosition, nonEndOfSentencePositions); } catch (StackOverflowError e){ LOG.error("Catch StackOverflowError parsing :" + str + " from position: " + startPosition); } return result; }
EndOfSentenceDetector { public int getSentenceEndPosition(String str, int startPosition) { Set<Integer> nonEndOfSentencePositions = extractNonEndOfSentencePositions(str); int result = str.length(); try { result = getEndPosition(str, startPosition, nonEndOfSentencePositions); } catch (StackOverflowError e){ LOG.error("Catch StackOverflowError parsing :" + str + " from position: " + startPosition); } return result; } }
EndOfSentenceDetector { public int getSentenceEndPosition(String str, int startPosition) { Set<Integer> nonEndOfSentencePositions = extractNonEndOfSentencePositions(str); int result = str.length(); try { result = getEndPosition(str, startPosition, nonEndOfSentencePositions); } catch (StackOverflowError e){ LOG.error("Catch StackOverflowError parsing :" + str + " from position: " + startPosition); } return result; } EndOfSentenceDetector(Pattern pattern);  EndOfSentenceDetector(Pattern pattern,
                                 List<String> whiteList); }
EndOfSentenceDetector { public int getSentenceEndPosition(String str, int startPosition) { Set<Integer> nonEndOfSentencePositions = extractNonEndOfSentencePositions(str); int result = str.length(); try { result = getEndPosition(str, startPosition, nonEndOfSentencePositions); } catch (StackOverflowError e){ LOG.error("Catch StackOverflowError parsing :" + str + " from position: " + startPosition); } return result; } EndOfSentenceDetector(Pattern pattern);  EndOfSentenceDetector(Pattern pattern,
                                 List<String> whiteList); int getSentenceEndPosition(String str, int startPosition); }
EndOfSentenceDetector { public int getSentenceEndPosition(String str, int startPosition) { Set<Integer> nonEndOfSentencePositions = extractNonEndOfSentencePositions(str); int result = str.length(); try { result = getEndPosition(str, startPosition, nonEndOfSentencePositions); } catch (StackOverflowError e){ LOG.error("Catch StackOverflowError parsing :" + str + " from position: " + startPosition); } return result; } EndOfSentenceDetector(Pattern pattern);  EndOfSentenceDetector(Pattern pattern,
                                 List<String> whiteList); int getSentenceEndPosition(String str, int startPosition);  }