FastMatcher { public List<OffsetPosition> matchCharacter(String text) { return matchCharacter(text, false); } FastMatcher();  FastMatcher(File file);  FastMatcher(File file, org.grobid.core.analyzers.Analyzer analyzer);  FastMatcher(File file, org.grobid.core.analyzers.Analyzer analyzer, boolean caseSensitive);  FastMatcher(InputStream is);  FastMatcher(InputStream is, org.grobid.core.analyzers.Analyzer analyzer);  FastMatcher(InputStream is, org.grobid.core.analyzers.Analyzer analyzer, boolean caseSensitive); int loadTerms(File file); int loadTerms(File file, boolean caseSensitive); int loadTerms(File file, org.grobid.core.analyzers.Analyzer analyzer, boolean caseSensitive); int loadTerms(InputStream is, org.grobid.core.analyzers.Analyzer analyzer, boolean caseSensitive); int loadTerm(String term, org.grobid.core.analyzers.Analyzer analyzer); int loadTerm(String term, org.grobid.core.analyzers.Analyzer analyzer, boolean ignoreDelimiters); int loadTerm(String term, org.grobid.core.analyzers.Analyzer analyzer, boolean ignoreDelimiters, boolean caseSensitive); List<OffsetPosition> matchToken(String text); List<OffsetPosition> matchToken(String text, boolean caseSensitive); List<OffsetPosition> matchLayoutToken(List<LayoutToken> tokens); List<OffsetPosition> matchLayoutToken(List<LayoutToken> tokens, boolean ignoreDelimiters, boolean caseSensitive); List<OffsetPosition> matchCharacter(String text); List<OffsetPosition> matchCharacter(String text, boolean caseSensitive); List<OffsetPosition> matchCharacterLayoutToken(List<LayoutToken> tokens); List<OffsetPosition> matchCharacterLayoutToken(List<LayoutToken> tokens, boolean caseSensitive); List<OffsetPosition> matcherPairs(List<Pair<String, String>> tokens); List<OffsetPosition> matcherPairs(List<Pair<String, String>> tokens, boolean caseSensitive);  }
@Test public void testMatchString_location() throws Exception { target = new FastMatcher(this.getClass().getResourceAsStream("location.txt")); final String input = "I'm walking in The Bronx"; final List<OffsetPosition> positions = target.matchCharacter(input); assertThat(positions, hasSize(2)); assertThat(positions.get(0).start, is(15)); assertThat(positions.get(0).end, is(24)); assertThat(positions.get(1).start, is(19)); assertThat(positions.get(1).end, is(24)); }
@Ignore @Test public void testMatchStringWithTag_location() throws Exception { target = new FastMatcher(this.getClass().getResourceAsStream("location.txt")); final String input = "I'm walking <p> in The Bronx"; final List<OffsetPosition> positions = target.matchCharacter(input); assertThat(positions, hasSize(2)); assertThat(positions.get(0).start, is(19)); assertThat(positions.get(0).end, is(28)); assertThat(positions.get(1).start, is(23)); assertThat(positions.get(1).end, is(28)); }
@Ignore @Test public void testMatchStringOnlyTag_location_noMatch() throws Exception { target = new FastMatcher(this.getClass().getResourceAsStream("location.txt")); final String input = "<p>"; final List<OffsetPosition> positions = target.matchCharacter(input); assertThat(positions, hasSize(0)); }
@Ignore @Test public void testMatchStringAndTag_location_noMatch() throws Exception { target = new FastMatcher(this.getClass().getResourceAsStream("location.txt")); final String input = "This is <p>"; final List<OffsetPosition> positions = target.matchCharacter(input); assertThat(positions, hasSize(0)); }