Class MSTParserWrapperImpl
- java.lang.Object
-
- de.julielab.jcore.ae.mstparser.main.MSTParserWrapperImpl
-
- All Implemented Interfaces:
MSTParserWrapper,org.apache.uima.resource.SharedResourceObject
public class MSTParserWrapperImpl extends Object implements MSTParserWrapper, org.apache.uima.resource.SharedResourceObject
This is the wrapper for the MST parser.- Author:
- Lichtenwald
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOMPONENT_IDstatic StringPARAM_FORMATstatic StringPARAM_MODEL_FILE
-
Constructor Summary
Constructors Constructor Description MSTParserWrapperImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidload(org.apache.uima.resource.DataResource resource)DependencyParserloadModel()Load the parser model and to set up some parameters.Stringpredict(DependencyParser parser, String inputSentence)Let the parser parse the input sentence and then return the parsed sentence.
-
-
-
Field Detail
-
PARAM_MODEL_FILE
public static final String PARAM_MODEL_FILE
- See Also:
- Constant Field Values
-
PARAM_FORMAT
public static final String PARAM_FORMAT
- See Also:
- Constant Field Values
-
COMPONENT_ID
public static final String COMPONENT_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
loadModel
public DependencyParser loadModel()
Load the parser model and to set up some parameters.- Specified by:
loadModelin interfaceMSTParserWrapper- Parameters:
modelFilename- String which specifies the path to the model filetemporaryPath- String which specifies the path to the directory where temporary files will be storedprojective- Boolean which determines whether the dependency relations are projectiveformat- String which specifies the format of test sentences (allowed values: MST, CONLL)- Returns:
- parser DependencyParser which was properly set up using the configuration input parameters
- Throws:
Exception
-
predict
public String predict(DependencyParser parser, String inputSentence) throws IOException
Let the parser parse the input sentence and then return the parsed sentence.- Specified by:
predictin interfaceMSTParserWrapper- Parameters:
parser- - DependencyParser which will be parsing the input sentenceinputSentence- - String which specifies the sentence to be parsed by the parser- Returns:
- parsedSentence String which specifies the result of the parsing
- Throws:
IOException
-
load
public void load(org.apache.uima.resource.DataResource resource) throws org.apache.uima.resource.ResourceInitializationException- Specified by:
loadin interfaceorg.apache.uima.resource.SharedResourceObject- Throws:
org.apache.uima.resource.ResourceInitializationException
-
-