org.grobid.core.main.GrobidHomeFinder Java Examples

The following examples show how to use org.grobid.core.main.GrobidHomeFinder. 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: Utilities.java    From entity-fishing with Apache License 2.0 6 votes vote down vote up
public static void initGrobid() {
	ObjectMapper mapper = new ObjectMapper(new YAMLFactory());

	try {
        NerdConfig conf = mapper.readValue(new File("data/config/mention.yaml"), NerdConfig.class);
		String pGrobidHome = conf.getGrobidHome();

		GrobidHomeFinder grobidHomeFinder = new GrobidHomeFinder(Arrays.asList(pGrobidHome));
       	GrobidProperties.getInstance(grobidHomeFinder);
           LibraryLoader.load();
		LOGGER.info(">>>>>>>> GROBID_HOME="+GrobidProperties.get_GROBID_HOME_PATH());
	}
	catch(Exception e) {
		throw new NerdException("Fail to initalise the grobid-ner component.", e);
	}
}
 
Example #2
Source File: GrobidPDFProcessor.java    From science-result-extractor with Apache License 2.0 5 votes vote down vote up
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: CoNNLNERTrainer.java    From grobid-ner with Apache License 2.0 5 votes vote down vote up
/**
 * Command line execution.
 *
 * @param args Command line arguments.
 */
public static void main(String[] args) {
    GrobidHomeFinder grobidHomeFinder = new GrobidHomeFinder(Arrays.asList("../grobid-home"));
    GrobidProperties.getInstance(grobidHomeFinder);

    CoNNLNERTrainer trainer = new CoNNLNERTrainer();

    trainer.trainCoNLL(true);
    //trainer.evalCoNLL("eng.testa");
    trainer.evalCoNLL("eng.testb");
}
 
Example #4
Source File: NEREvaluation.java    From grobid-ner with Apache License 2.0 5 votes vote down vote up
/**
 * Command line execution.
 *
 * @param args Command line arguments.
 */
public static void main(String[] args) {
    final GrobidHomeFinder grobidHomeFinder = new GrobidHomeFinder(Arrays.asList("../../grobid-home", "../grobid-home"));
    GrobidProperties.getInstance(grobidHomeFinder);

    NEREvaluation eval = new NEREvaluation();

    // CoNLL evaluation
    System.out.println(eval.evaluate_reuters());
}
 
Example #5
Source File: SenseTrainer.java    From grobid-ner with Apache License 2.0 5 votes vote down vote up
/**
 * Command line execution.
 *
 * @param args Command line arguments.
 */
public static void main(String[] args) {
    final GrobidHomeFinder grobidHomeFinder = new GrobidHomeFinder(Arrays.asList("../../grobid-home", "../grobid-home"));
    GrobidProperties.getInstance(grobidHomeFinder);

    Trainer trainer = new SenseTrainer();
    AbstractTrainer.runTraining(trainer);
    //AbstractTrainer.runEvaluation(trainer);
}
 
Example #6
Source File: NERTrainer.java    From grobid-ner with Apache License 2.0 5 votes vote down vote up
/**
 * Command line execution.
 *
 * @param args Command line arguments.
 */
public static void main(String[] args) {
    final GrobidHomeFinder grobidHomeFinder = new GrobidHomeFinder(Arrays.asList("../../grobid-home", "../grobid-home"));
    GrobidProperties.getInstance(grobidHomeFinder);
    NERTrainer trainer = new NERTrainer();

    AbstractTrainer.runTraining(trainer);
    System.out.println(AbstractTrainer.runEvaluation(trainer));

    System.exit(0);
}
 
Example #7
Source File: NERMain.java    From grobid-ner with Apache License 2.0 5 votes vote down vote up
/**
 * Init process with the provided grobid-home
 *
 * @param grobidHome
 */
protected static void initProcess(String grobidHome) {
    try {
        final GrobidHomeFinder grobidHomeFinder = new GrobidHomeFinder(Arrays.asList(grobidHome));
        grobidHomeFinder.findGrobidHomeOrFail();
        GrobidProperties.getInstance(grobidHomeFinder);
        LibraryLoader.load();
    } catch (final Exception exp) {
        System.err.println("Grobid initialisation failed: " + exp);
    }
}
 
Example #8
Source File: EngineMockTest.java    From grobid-ner with Apache License 2.0 5 votes vote down vote up
@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();
}