Skip to content

Commit

Permalink
Fix missing fill up configuration when running a command #130
Browse files Browse the repository at this point in the history
  • Loading branch information
lfoppiano committed Dec 7, 2021
1 parent cd52f07 commit c68dac1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public GrobidEngineInitialiser(GrobidQuantitiesConfiguration configuration) {
GrobidHomeFinder grobidHomeFinder = new GrobidHomeFinder(ImmutableList.of(configuration.getGrobidHome()));
GrobidProperties.getInstance(grobidHomeFinder);
configuration.getModels().stream().forEach(GrobidProperties::addModel);

LibraryLoader.load();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.sourceforge.argparse4j.inf.Namespace;
import net.sourceforge.argparse4j.inf.Subparser;
import org.grobid.core.exceptions.GrobidException;
import org.grobid.core.utilities.GrobidProperties;
import org.grobid.service.configuration.GrobidQuantitiesConfiguration;
import org.grobid.trainer.*;
import org.slf4j.Logger;
Expand Down Expand Up @@ -91,6 +92,7 @@ protected void run(Bootstrap bootstrap, Namespace namespace, GrobidQuantitiesCon
String configurationGrobidHome = configuration.getGrobidHome();
File grobidHomeOverride = namespace.get(GROBID_HOME_DIRECTORY);
initGrobidHome(configurationGrobidHome, grobidHomeOverride);
configuration.getModels().stream().forEach(GrobidProperties::addModel);

String modelName = namespace.get(MODEL_NAME);
String action = namespace.get(ACTION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.slf4j.LoggerFactory;

import java.io.File;
import java.util.Arrays;
import java.util.Collections;

public class TrainingGenerationCommand extends ConfiguredCommand<GrobidQuantitiesConfiguration> {
Expand Down Expand Up @@ -68,10 +69,11 @@ public void configure(Subparser subparser) {
}

@Override
protected void run(Bootstrap bootstrap, Namespace namespace, GrobidQuantitiesConfiguration configuration) throws Exception {
protected void run(Bootstrap bootstrap, Namespace namespace, GrobidQuantitiesConfiguration configuration) throws Exception {
File grobidHomeOverride = namespace.get(GROBID_HOME_DIRECTORY);

initGrobidHome(configuration.getGrobidHome(), grobidHomeOverride);
configuration.getModels().stream().forEach(GrobidProperties::addModel);

File inputDirectory = namespace.get(INPUT_DIRECTORY);
File outputDirectory = namespace.get(OUTPUT_DIRECTORY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ protected void run(Bootstrap bootstrap, Namespace namespace, GrobidQuantitiesCon
File grobidHomeOverride = namespace.get(GROBID_HOME_DIRECTORY);
String grobidHome = configuration.getGrobidHome();
initGrobidHome(grobidHome, grobidHomeOverride);
configuration.getModels().stream().forEach(GrobidProperties::addModel);

File inputDirectory = namespace.get(INPUT_DIRECTORY);
File outputDirectory = namespace.get(OUTPUT_DIRECTORY);
Expand Down

0 comments on commit c68dac1

Please sign in to comment.