org.grobid.core.factory.GrobidFactory Java Examples
The following examples show how to use
org.grobid.core.factory.GrobidFactory.
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 |
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(); }
Example #2
Source File: GrobidPDFProcessor.java From science-result-extractor with Apache License 2.0 | 5 votes |
private GrobidPDFProcessor() throws IOException, Exception { prop = new Properties(); prop.load(new FileReader("config.properties")); grobidHome = prop.getProperty("pGrobidHome"); grobidProperties = prop.getProperty("pGrobidProperties"); GrobidHomeFinder grobidHomeFinder = new GrobidHomeFinder(Arrays.asList(grobidHome)); GrobidProperties.getInstance(grobidHomeFinder); // System.out.println(">>>>>>>> GROBID_HOME="+GrobidProperties.get_GROBID_HOME_PATH()); engine = GrobidFactory.getInstance().createEngine(); parsers = new EngineParsers(); gson = new Gson(); cloner = new Cloner(); }
Example #3
Source File: EngineMockTest.java From grobid-ner with Apache License 2.0 | 5 votes |
@BeforeClass public static void initInitialContext() throws Exception { final GrobidHomeFinder grobidHomeFinder = new GrobidHomeFinder(Arrays.asList("../../grobid-home", "../grobid-home")); grobidHomeFinder.findGrobidHomeOrFail(); GrobidProperties.getInstance(grobidHomeFinder); engine = GrobidFactory.getInstance().createEngine(); }
Example #4
Source File: NEREvaluation.java From grobid-ner with Apache License 2.0 | 4 votes |
/** * Evaluation based on the CoNLL-2003 shared task NER gold corpus, English set. * see http://www.cnts.ua.ac.be/conll2003/ner/. */ public String evaluate_reuters() { long start = System.currentTimeMillis(); StringBuilder report = new StringBuilder(); try { GrobidFactory.getInstance(); NERParsers parsers = new NERParsers(); File evalDataF = GrobidProperties.getInstance().getEvalCorpusPath( new File(new File("resources").getAbsolutePath()), model); File tmpEvalPath = getTempEvaluationDataPath(); report.append("Eval. path: " + tmpEvalPath.getPath() + "\n"); // There are three set that we can exploit testa, testb and the training sets. // However the training set should be used to reimforce the learning. File evalA = new File(conllPath + "/eng.testa"); File evalB = new File(conllPath + "/eng.testb"); File evalTrain = new File(conllPath + "/eng.train"); if (!evalTrain.exists()) { throw new GrobidException( "Cannot start evaluation, because corpus resource path for CoNLL file " + " is not correctly set : " + evalDataF.getPath() + "/eng.train"); } report.append(evaluate_reutersSet(parsers, evalTrain, tmpEvalPath)); if (!evalA.exists()) { throw new GrobidException( "Cannot start evaluation, because corpus resource path for CoNLL file " + " is not correctly set : " + evalDataF.getPath() + "/eng.testa"); } report.append(evaluate_reutersSet(parsers, evalA, tmpEvalPath)); if (!evalB.exists()) { throw new GrobidException( "Cannot start evaluation, because corpus resource path for CoNLL file " + " is not correctly set : " + evalDataF.getPath() + "/eng.testb"); } report.append(evaluate_reutersSet(parsers, evalB, tmpEvalPath)); } catch (Exception e) { throw new GrobidException("An exception occured while running Grobid Reuters evaluation.", e); } long end = System.currentTimeMillis(); report.append("processed in " + (end - start) / 1000 + " s."); return report.toString(); }