org.grobid.core.utilities.Pair Java Examples

The following examples show how to use org.grobid.core.utilities.Pair. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnnotatedDataGenerationTest.java    From entity-fishing with Apache License 2.0 6 votes vote down vote up
public void testExtractionPdfData_1() throws Exception {
    File input = new File(this.getClass().getResource("OB-oep-1830.pdf").getPath());

    final Pair<String, List<String>> output = target.extractPDFContent(input);

    assertThat(output.a, is("fr"));

    assertThat(output.b, hasSize(3));

    output.b.stream().forEach(s -> {
        //System.out.println(s);
        assertThat(s, not(startsWith("\n")));
    });

    assertThat(output.b.get(0).split("\n").length, is(35));
    assertThat(output.b.get(0).split("\n")[0], startsWith("Sur quoi reposent nos"));
    assertThat(output.b.get(0).split("\n")[1], is(""));
    assertThat(output.b.get(0).split("\n")[4], startsWith("Comme nous l'avons "));
}
 
Example #2
Source File: AnnotatedDataGenerationTest.java    From entity-fishing with Apache License 2.0 5 votes vote down vote up
public void testExtractionPdfData_2() throws Exception {
    File input = new File(this.getClass().getResource("OB-oep-1827.pdf").getPath());

    final Pair<String, List<String>> output = target.extractPDFContent(input);

    assertThat(output.a, is("fr"));

    assertThat(output.b, hasSize(1));
    //output.b.stream().forEach(System.out::println);
    output.b.stream().forEach(s -> assertThat(s, not(startsWith("\n"))));

    assertThat(output.b.get(0).split("\n").length, is(3));
    assertThat(output.b.get(0).split("\n")[0], startsWith("À PROPOS DE LA"));
    assertThat(output.b.get(0).split("\n")[1], is(""));
}
 
Example #3
Source File: DocumentContext.java    From entity-fishing with Apache License 2.0 4 votes vote down vote up
public void setEntityCount(Map<String, Pair<NerdEntity, Integer>> counts) {
	this.entityCount = counts;
}
 
Example #4
Source File: DocumentContext.java    From entity-fishing with Apache License 2.0 4 votes vote down vote up
public Map<String, Pair<NerdEntity, Integer>> getEntityCount() {
	return this.entityCount;
}
 
Example #5
Source File: DocumentContext.java    From entity-fishing with Apache License 2.0 4 votes vote down vote up
public Pair<NerdEntity, Integer> getEntityCount(String surface) {
	if (this.entityCount != null)
		return this.entityCount.get(surface);
	else 
		return null;
}
 
Example #6
Source File: AnnotatedDataGenerationTest.java    From entity-fishing with Apache License 2.0 3 votes vote down vote up
public void testExtractionPdfData_3() throws Exception {
        File input = new File(this.getClass().getResource("OB-obp-1523.pdf").getPath());

        final Pair<String, List<String>> output = target.extractPDFContent(input);

        assertThat(output.a, is("en"));

//        assertThat(output.b, hasSize(7));

        output.b.stream().forEach(s -> assertThat(s, not(startsWith("\n"))));
    }