Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.maltparser.core.feature.FeatureVector predictExtract(org.maltparser.core.feature.FeatureModel featureModel, org.maltparser.parser.history.action.GuideDecision decision) throws org.maltparser.core.exception.MaltChainedException
        public virtual FeatureVector predictExtract(FeatureModel featureModel, GuideDecision decision)
        {
            if (decision is SingleDecision)
            {
                throw new GuideException("A sequantial decision model expect a sequence of decisions, not a single decision. ");
            }
            featureModel.update();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.maltparser.parser.history.action.SingleDecision singleDecision = ((org.maltparser.parser.history.action.MultipleDecision)decision).getSingleDecision(decisionIndex);
            SingleDecision singleDecision = ((MultipleDecision)decision).getSingleDecision(decisionIndex);

            if (instanceModel == null)
            {
                initInstanceModel(featureModel, singleDecision.TableContainer.TableContainerName);
            }

            FeatureVector fv = instanceModel.predictExtract(featureModel.getFeatureVector(branchedDecisionSymbols, singleDecision.TableContainer.TableContainerName), singleDecision);

            if (singleDecision.continueWithNextDecision() && decisionIndex + 1 < decision.numberOfDecisions())
            {
                if (nextDecisionModel == null)
                {
                    initNextDecisionModel(((MultipleDecision)decision).getSingleDecision(decisionIndex + 1), branchedDecisionSymbols);
                }
                nextDecisionModel.predictExtract(featureModel, decision);
            }
            return(fv);
        }
Example #2
0
//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.GuideDecision decision) throws org.maltparser.core.exception.MaltChainedException
        public virtual bool predictFromKBestList(FeatureModel featureModel, GuideDecision decision)
        {
            if (decision is SingleDecision)
            {
                throw new GuideException("A sequantial decision model expect a sequence of decisions, not a single decision. ");
            }

            bool success = false;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.maltparser.parser.history.action.SingleDecision singleDecision = ((org.maltparser.parser.history.action.MultipleDecision)decision).getSingleDecision(decisionIndex);
            SingleDecision singleDecision = ((MultipleDecision)decision).getSingleDecision(decisionIndex);

            // TODO develop different strategies for resolving which kBestlist that should be used
            if (nextDecisionModel != null && singleDecision.continueWithNextDecision())
            {
                success = nextDecisionModel.predictFromKBestList(featureModel, decision);
            }
            if (!success)
            {
                success = singleDecision.updateFromKBestList();
                if (success && singleDecision.continueWithNextDecision() && decisionIndex + 1 < decision.numberOfDecisions())
                {
                    if (nextDecisionModel == null)
                    {
                        initNextDecisionModel(((MultipleDecision)decision).getSingleDecision(decisionIndex + 1), branchedDecisionSymbols);
                    }
                    nextDecisionModel.predict(featureModel, decision);
                }
            }
            return(success);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.maltparser.core.feature.FeatureVector predictExtract(org.maltparser.core.feature.FeatureModel featureModel, org.maltparser.parser.history.action.GuideDecision decision) throws org.maltparser.core.exception.MaltChainedException
        public virtual FeatureVector predictExtract(FeatureModel featureModel, GuideDecision decision)
        {
            if (decision is SingleDecision)
            {
                throw new GuideException("A branched decision model expect more than one decisions. ");
            }
            featureModel.update();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.maltparser.parser.history.action.SingleDecision singleDecision = ((org.maltparser.parser.history.action.MultipleDecision)decision).getSingleDecision(decisionIndex);
            SingleDecision singleDecision = ((MultipleDecision)decision).getSingleDecision(decisionIndex);

            if (instanceModel == null)
            {
                initInstanceModel(featureModel, singleDecision.TableContainer.TableContainerName);
            }
            FeatureVector fv = instanceModel.predictExtract(featureModel.getFeatureVector(branchedDecisionSymbols, singleDecision.TableContainer.TableContainerName), singleDecision);

            if (decisionIndex + 1 < decision.numberOfDecisions())
            {
                if (singleDecision.continueWithNextDecision())
                {
                    DecisionModel child = children[singleDecision.DecisionCode];
                    if (child == null)
                    {
                        child = initChildDecisionModel(((MultipleDecision)decision).getSingleDecision(decisionIndex + 1), branchedDecisionSymbols + (branchedDecisionSymbols.Length == 0?"":"_") + singleDecision.DecisionSymbol);
                        children[singleDecision.DecisionCode] = child;
                    }
                    child.predictExtract(featureModel, decision);
                }
            }

            return(fv);
        }
Example #4
0
//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.GuideDecision decision) throws org.maltparser.core.exception.MaltChainedException
        public virtual bool predictFromKBestList(FeatureModel featureModel, GuideDecision decision)
        {
            if (decision is SingleDecision)
            {
                return(((SingleDecision)decision).updateFromKBestList());
            }
            else
            {
                return(((MultipleDecision)decision).getSingleDecision(decisionIndex).updateFromKBestList());
            }
        }
Example #5
0
//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.GuideDecision decision) throws org.maltparser.core.exception.MaltChainedException
        public virtual bool predictFromKBestList(FeatureModel featureModel, GuideDecision decision)
        {
            if (decisionModel != null)
            {
                return(decisionModel.predictFromKBestList(featureModel, decision));
            }
            else
            {
                throw new GuideException("The decision model cannot be found. ");
            }
        }
Example #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.maltparser.core.feature.FeatureVector predictExtract(org.maltparser.core.feature.FeatureModel featureModel, org.maltparser.parser.history.action.GuideDecision decision) throws org.maltparser.core.exception.MaltChainedException
        public virtual FeatureVector predictExtract(FeatureModel featureModel, GuideDecision decision)
        {
            featureModel.update();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.maltparser.parser.history.action.SingleDecision singleDecision = (decision instanceof org.maltparser.parser.history.action.SingleDecision)?(org.maltparser.parser.history.action.SingleDecision)decision:((org.maltparser.parser.history.action.MultipleDecision)decision).getSingleDecision(decisionIndex);
            SingleDecision singleDecision = (decision is SingleDecision)?(SingleDecision)decision:((MultipleDecision)decision).getSingleDecision(decisionIndex);

            if (instanceModel == null)
            {
                initInstanceModel(featureModel, singleDecision.TableContainer.TableContainerName);
            }
            return(instanceModel.predictExtract(featureModel.getFeatureVector(branchedDecisionSymbols, singleDecision.TableContainer.TableContainerName), singleDecision));
        }
Example #7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void addInstance(org.maltparser.core.feature.FeatureModel featureModel,org.maltparser.parser.history.action.GuideDecision decision) throws org.maltparser.core.exception.MaltChainedException
        public virtual void addInstance(FeatureModel featureModel, GuideDecision decision)
        {
            if (decisionModel == null)
            {
                if (decision is SingleDecision)
                {
                    initDecisionModel((SingleDecision)decision);
                }
                else if (decision is MultipleDecision && decision.numberOfDecisions() > 0)
                {
                    initDecisionModel(((MultipleDecision)decision).getSingleDecision(0));
                }
            }
            decisionModel.addInstance(featureModel, decision);
        }
Example #8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.maltparser.core.feature.FeatureVector predictExtract(org.maltparser.core.feature.FeatureModel featureModel,org.maltparser.parser.history.action.GuideDecision decision) throws org.maltparser.core.exception.MaltChainedException
        public virtual FeatureVector predictExtract(FeatureModel featureModel, GuideDecision decision)
        {
            if (decisionModel == null)
            {
                if (decision is SingleDecision)
                {
                    initDecisionModel((SingleDecision)decision);
                }
                else if (decision is MultipleDecision && decision.numberOfDecisions() > 0)
                {
                    initDecisionModel(((MultipleDecision)decision).getSingleDecision(0));
                }
            }
            return(decisionModel.predictExtract(featureModel, decision));
        }
//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.GuideDecision decision) throws org.maltparser.core.exception.MaltChainedException
        public virtual bool predictFromKBestList(FeatureModel featureModel, GuideDecision decision)
        {
            if (decision is SingleDecision)
            {
                throw new GuideException("A branched decision model expect more than one decisions. ");
            }

            bool success = false;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.maltparser.parser.history.action.SingleDecision singleDecision = ((org.maltparser.parser.history.action.MultipleDecision)decision).getSingleDecision(decisionIndex);
            SingleDecision singleDecision = ((MultipleDecision)decision).getSingleDecision(decisionIndex);

            if (decisionIndex + 1 < decision.numberOfDecisions())
            {
                if (singleDecision.continueWithNextDecision())
                {
                    DecisionModel child = children[singleDecision.DecisionCode];
                    if (child != null)
                    {
                        success = child.predictFromKBestList(featureModel, decision);
                    }
                }
            }
            if (!success)
            {
                success = singleDecision.updateFromKBestList();
                if (decisionIndex + 1 < decision.numberOfDecisions())
                {
                    if (singleDecision.continueWithNextDecision())
                    {
                        DecisionModel child = children[singleDecision.DecisionCode];
                        if (child == null)
                        {
                            child = initChildDecisionModel(((MultipleDecision)decision).getSingleDecision(decisionIndex + 1), branchedDecisionSymbols + (branchedDecisionSymbols.Length == 0?"":"_") + singleDecision.DecisionSymbol);
                            children[singleDecision.DecisionCode] = child;
                        }
                        child.predict(featureModel, decision);
                    }
                }
            }
            return(success);
        }