private void parserTrain ( ) throws IOException { // load training parameters file final String paramFile = this . parsedArguments . getString ( "params" ) ; final String taggerParamsFile = this . parsedArguments . getString ( "taggerParams" ) ; final String chunkerParamsFile = this . parsedArguments . getString ( "chunkerParams" ) ; final TrainingParameters params = IOUtils . loadTrainingParameters ( paramFile ) ; final TrainingParameters chunkerParams = IOUtils . loadTrainingParameters ( chunkerParamsFile ) ; ParserModel trainedModel ; String outModel ; if ( params . getSettings ( ) . get ( "OutputModel" ) == null || params . getSettings ( ) . get ( "OutputModel" ) . length ( ) == 0 ) { outModel = Files . getNameWithoutExtension ( paramFile ) + ".bin" ; params . put ( "OutputModel" , outModel ) ; } else { outModel = Flags . getModel ( params ) ; } if ( taggerParamsFile . endsWith ( ".bin" ) ) { final InputStream posModel = new FileInputStream ( taggerParamsFile ) ; final ShiftReduceParserTrainer parserTrainer = new ShiftReduceParserTrainer ( params , chunkerParams ) ; trainedModel = parserTrainer . train ( params , posModel , chunkerParams ) ; } else { final TrainingParameters taggerParams = IOUtils . loadTrainingParameters ( taggerParamsFile ) ; final ShiftReduceParserTrainer parserTrainer = new ShiftReduceParserTrainer ( params , taggerParams , chunkerParams ) ; trainedModel = parserTrainer . train ( params , taggerParams , chunkerParams ) ; } CmdLineUtil . writeModel ( "ixa-pipe-ml" , new File ( outModel ) , trainedModel ) ; }
Main access to the ShiftReduceParser train functionalities .