Class 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
    • Constructor Detail

      • MSTParserWrapperImpl

        public MSTParserWrapperImpl()
    • Method Detail

      • loadModel

        public DependencyParser loadModel()
        Load the parser model and to set up some parameters.
        Specified by:
        loadModel in interface MSTParserWrapper
        Parameters:
        modelFilename - String which specifies the path to the model file
        temporaryPath - String which specifies the path to the directory where temporary files will be stored
        projective - Boolean which determines whether the dependency relations are projective
        format - 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:
        predict in interface MSTParserWrapper
        Parameters:
        parser - - DependencyParser which will be parsing the input sentence
        inputSentence - - 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:
        load in interface org.apache.uima.resource.SharedResourceObject
        Throws:
        org.apache.uima.resource.ResourceInitializationException