softcite / software-mentions

Softcite software mention recognizer, finding mentions and citations to software from within the academic literature
Apache License 2.0
68 stars 11 forks source link

Update trainer to support the updated evaluation framework #6

Closed lfoppiano closed 5 years ago

lfoppiano commented 5 years ago

This should fix the compatibility with the updated evaluation framework in grobid (PR, not yet in master: https://github.com/kermitt2/grobid/pull/280).

I tried to test it but the evaluation phase was requiring a file that is not in the repository, so I didn't really tested it.

I've added just a toString() because the new EvaluationUtils are returning an object. I think applying now should not break anything.

kermitt2 commented 5 years ago

Super thanks !

kermitt2 commented 5 years ago

After some tests, it appears that there are 3 System.out.println() missing to display the evaluation report string.

One in the main of SoftwareTrainer.java:

public static void main(String[] args) {
        try {
            String pGrobidHome = SoftwareProperties.get("grobid.home");

            GrobidHomeFinder grobidHomeFinder = new GrobidHomeFinder(Arrays.asList(pGrobidHome));
            GrobidProperties.getInstance(grobidHomeFinder);

            System.out.println(">>>>>>>> GROBID_HOME="+GrobidProperties.get_GROBID_HOME_PATH());
        } catch (final Exception exp) {
            System.err.println("GROBID software initialisation failed: " + exp);
            exp.printStackTrace();
        }
        Trainer trainer = new SoftwareTrainer();
        System.out.println(AbstractTrainer.runEvaluation(trainer));
        System.exit(0);
    }

And two in the main of SoftwareTrainerRunner.java:

switch (mode) {
            case TRAIN:
                AbstractTrainer.runTraining(trainer);
                break;
            case EVAL:
                System.out.println(AbstractTrainer.runEvaluation(trainer));
                break;
            case SPLIT:
                System.out.println(AbstractTrainer.runSplitTrainingEvaluation(trainer, split));
                break;
            default:
                throw new IllegalStateException("Invalid RunType: " + mode.name());
        }
        System.exit(0);
lfoppiano commented 5 years ago

Ooopss... I missed them..

They should be there now

kermitt2 commented 5 years ago

yes! ready to be pushed after the merge on grobid thanks!