//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected void initWithDefaultTransitions(org.maltparser.parser.history.GuideUserHistory history) throws org.maltparser.core.exception.MaltChainedException protected internal override void initWithDefaultTransitions(GuideUserHistory history) { GuideUserAction currentAction = new ComplexDecisionAction(history); transActionContainer.Action = SHIFT; for (int i = 0; i < arcLabelActionContainers.Length; i++) { arcLabelActionContainers[i].Action = -1; } currentAction.addAction(actionContainers); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected void initWithDefaultTransitions(org.maltparser.parser.history.GuideUserHistory history) throws org.maltparser.core.exception.MaltChainedException protected internal override void initWithDefaultTransitions(GuideUserHistory history) { GuideUserAction currentAction = new ComplexDecisionAction(history); transActionContainer.Action = SHIFT; transActionContainer.Action = REDUCE; transActionContainer.Action = SWITCH; //TODO it seems like a good idea to do this, but I don't know what it actually does transActionContainer.Action = REDUCEBOTH; //TODO same as above for (int i = 0; i < arcLabelActionContainers.Length; i++) { arcLabelActionContainers[i].Action = -1; } currentAction.addAction(actionContainers); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean predictFromKBestList(org.maltparser.core.feature.FeatureModel featureModel, org.maltparser.parser.history.action.ComplexDecisionAction decision) throws org.maltparser.core.exception.MaltChainedException public bool predictFromKBestList(FeatureModel featureModel, ComplexDecisionAction decision) { predict(featureModel, decision, false); if (decision.numberOfDecisions() == 1) { return(decision.getSingleDecision(0).updateFromKBestList()); } else if (decision.numberOfDecisions() > 2) { throw new MaltChainedException("Number of decisions is greater than two, which is unsupported in the light-weight parser (lw.parser)"); } bool success = false; if (decision.getSingleDecision(0).continueWithNextDecision()) { success = decision.getSingleDecision(1).updateFromKBestList(); } return(success); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public LWDeterministicParser(LWSingleMalt lwSingleMalt, org.maltparser.core.symbol.SymbolTableHandler symbolTableHandler) throws org.maltparser.core.exception.MaltChainedException public LWDeterministicParser(LWSingleMalt lwSingleMalt, SymbolTableHandler symbolTableHandler) { manager = lwSingleMalt; registry = new ParserRegistry(); registry.SymbolTableHandler = symbolTableHandler; registry.DataFormatInstance = manager.DataFormatInstance; registry.setAbstractParserFeatureFactory(manager.ParserFactory); registry.Algorithm = this; transitionSystem = manager.ParserFactory.makeTransitionSystem(); transitionSystem.initTableHandlers(lwSingleMalt.DecisionSettings, symbolTableHandler); tableHandlers = transitionSystem.TableHandlers; kBestSize = lwSingleMalt.getkBestSize(); decisionTables = new List <TableContainer>(); actionTables = new List <TableContainer>(); initDecisionSettings(lwSingleMalt.DecisionSettings, lwSingleMalt.Classitem_separator); transitionSystem.initTransitionSystem(this); config = manager.ParserFactory.makeParserConfiguration(); featureModel = manager.FeatureModelManager.getFeatureModel(lwSingleMalt.FeatureModelURL, 0, registry, manager.DataSplitColumn, manager.DataSplitStructure); currentAction = new ComplexDecisionAction(this); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean predict(org.maltparser.core.feature.FeatureModel featureModel, org.maltparser.parser.history.action.ComplexDecisionAction decision, boolean one_prediction) throws org.maltparser.core.exception.MaltChainedException public bool predict(FeatureModel featureModel, ComplexDecisionAction decision, bool one_prediction) { if (decision.numberOfDecisions() > 2) { throw new MaltChainedException("Number of decisions is greater than two, which is unsupported in the light-weight parser (lw.parser)"); } featureModel.update(); bool success = true; for (int i = 0; i < decision.numberOfDecisions(); i++) { LWClassifier classifier = null; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.maltparser.parser.history.action.SingleDecision singleDecision = decision.getSingleDecision(i); SingleDecision singleDecision = decision.getSingleDecision(i); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final StringBuilder classifierString = new StringBuilder(); StringBuilder classifierString = new StringBuilder(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final StringBuilder decisionModelString = new StringBuilder(); StringBuilder decisionModelString = new StringBuilder(); if (singleDecision.RelationToNextDecision == RelationToNextDecision.BRANCHED) { decisionModelString.Append("bdm"); } else if (singleDecision.RelationToNextDecision == RelationToNextDecision.SEQUANTIAL) { decisionModelString.Append("sdm"); } else { decisionModelString.Append("odm"); } decisionModelString.Append(i); string decisionSymbol = ""; if (i == 1 && singleDecision.RelationToNextDecision == RelationToNextDecision.BRANCHED) { decisionSymbol = singleDecision.DecisionSymbol; decisionModelString.Append(decisionSymbol); } decisionModelString.Append('.'); FeatureVector featureVector = featureModel.getFeatureVector(decisionSymbol, singleDecision.TableContainer.TableContainerName); if (featureModel.hasDivideFeatureFunction()) { SingleFeatureValue featureValue = (SingleFeatureValue)featureModel.DivideFeatureFunction.FeatureValue; classifierString.Append(decisionModelString); classifierString.Append(string.Format("{0:D3}", featureValue.IndexCode)); classifierString.Append('.'); classifierString.Append(classifierName); classifier = classifiers[classifierString.ToString()]; if (classifier != null) { FeatureVector dividefeatureVector = featureModel.getFeatureVector("/" + featureVector.SpecSubModel.SubModelName); success = classifier.predict(dividefeatureVector, singleDecision, one_prediction) && success; continue; } classifierString.Length = 0; } classifierString.Append(decisionModelString); classifierString.Append(classifierName); classifier = classifiers[classifierString.ToString()]; if (classifier != null) { success = classifier.predict(featureVector, singleDecision, one_prediction) && success; } else { singleDecision.addDecision(1); } if (!singleDecision.continueWithNextDecision()) { break; } } return(success); }