You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Loading model
Be sure to instantiate all services (LogicLanguageService) before reading saved model file. Below code copied from geoquery example. Remember not to close ontology.
LogicLanguageServices.setInstance(new LogicLanguageServices.Builder(
new TypeRepository(typesFile), new FlexibleTypeComparator())
.addConstantsToOntology(simpleOntology)
.addConstantsToOntology(predOntology)
.setUseOntology(true).setNumeralTypeName("i")
.build());
Initialize log if needed.
Build a parser. This parser may not be same as the parser used during training. Look at GeoSimpleExp for example.
Now you are ready to read the model.
savedModelFile = new File(filename);
model = Model.<Sentence, LogicalExpression>readModel(savedModelFile);
Predict
Here's an example:
public static IGraphParserOutput<LogicalExpression> predict(String sentence) {
Sentence dataItem = new Sentence(sentence);
return parser.parse(dataItem, new DataItemModel<Sentence, LogicalExpression>(model, dataItem), true);
}
Adding to documentation.
The text was updated successfully, but these errors were encountered: