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 java.lang.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 java.lang.StringCOMPONENT_IDstatic java.lang.StringPARAM_FORMATstatic java.lang.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.java.lang.Stringpredict(DependencyParser parser, java.lang.String inputSentence)Let the parser parse the input sentence and then return the parsed sentence.
-
-
-
Field Detail
-
PARAM_MODEL_FILE
public static final java.lang.String PARAM_MODEL_FILE
- See Also:
- Constant Field Values
-
PARAM_FORMAT
public static final java.lang.String PARAM_FORMAT
- See Also:
- Constant Field Values
-
COMPONENT_ID
public static final java.lang.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:
java.lang.Exception
-
predict
public java.lang.String predict(DependencyParser parser, java.lang.String inputSentence) throws java.io.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:
java.io.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
-
-