org.grobid.core.engines.Engine Java Examples

The following examples show how to use org.grobid.core.engines.Engine. 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: NerdRestProcessString.java    From entity-fishing with Apache License 2.0 6 votes vote down vote up
public static String processReference(String citationText, int consolidation) {
    LibraryLoader.load();
    Engine engine = GrobidFactory.getInstance().getEngine();

    final BiblioItem processedCitation = engine.getParsers().getCitationParser().processing(citationText, consolidation);

    String wikidataID = NerdEngine.getInstance().solveCitation(processedCitation);

    // Transforming in json
    StringBuilder sb = new StringBuilder();
    sb.append("\"").append("title").append(":").append("\"").append(processedCitation.getTitle()).append("\"");
    sb.append(",");
    sb.append("\"").append("doi").append(":").append("\"").append(processedCitation.getDOI()).append("\"");
    sb.append(",");
    sb.append("\"").append("wikidataID").append(":").append("\"").append(wikidataID).append("\"");
    sb.append(",");
    sb.append("\"").append("authors").append(":").append("\"").append(processedCitation.getAuthors()).append("\"");
    return sb.toString();
}