예제 #1
0
    def __init__(self, lhs, rhs, cost):
        """
        Construct a new ``ProbabilisticProduction``.

        :param lhs: The left-hand side of the new ``ProbabilisticProduction``.
        :type lhs: Nonterminal
        :param rhs: The right-hand side of the new ``ProbabilisticProduction``.
        :type rhs: sequence(Nonterminal and terminal)
        :param prob: Probability parameters of the new ``ProbabilisticProduction``.
        """
        ImmutableProbabilisticMixIn.__init__(self, logprob=-cost)
        Production.__init__(self, lhs, rhs)
예제 #2
0
파일: cfg.py 프로젝트: DrDub/icsisumm
    def __init__(self, lhs, rhs, **prob):
        """
        Construct a new C{WeightedProduction}.

        @param lhs: The left-hand side of the new C{WeightedProduction}.
        @type lhs: L{Nonterminal}
        @param rhs: The right-hand side of the new C{WeightedProduction}.
        @type rhs: sequence of (C{Nonterminal} and (terminal))
        @param **prob: Probability parameters of the new C{WeightedProduction}.
        """
        ImmutableProbabilisticMixIn.__init__(self, **prob)
        Production.__init__(self, lhs, rhs)
예제 #3
0
    def __init__(self, lhs, rhs, **prob_kwarg):
        """
        Construct a new C{PCFGProduction}.

        @param prob: The probability of the new C{PCFGProduction}.
        @param lhs: The left-hand side of the new C{PCFGProduction}.
        @type lhs: L{Nonterminal}
        @param rhs: The right-hand side of the new C{PCFGProduction}.
        @type rhs: sequence of (C{Nonterminal} and (terminal))
        """
        ImmutableProbabilisticMixIn.__init__(self, **prob_kwarg)
        CFGProduction.__init__(self, lhs, rhs)
예제 #4
0
    def __init__(self, lhs, rhs, **prob_kwarg):
        """
        Construct a new C{PCFGProduction}.

        @param prob: The probability of the new C{PCFGProduction}.
        @param lhs: The left-hand side of the new C{PCFGProduction}.
        @type lhs: L{Nonterminal}
        @param rhs: The right-hand side of the new C{PCFGProduction}.
        @type rhs: sequence of (C{Nonterminal} and (terminal))
        """
        ImmutableProbabilisticMixIn.__init__(self, **prob_kwarg)
        CFGProduction.__init__(self, lhs, rhs)
예제 #5
0
    def __init__(self, lhs, rhs, **prob):
        """
        Construct a new C{WeightedProduction}.

        @param lhs: The left-hand side of the new C{WeightedProduction}.
        @type lhs: L{Nonterminal}
        @param rhs: The right-hand side of the new C{WeightedProduction}.
        @type rhs: sequence of (C{Nonterminal} and (terminal))
        @param **prob: Probability parameters of the new C{WeightedProduction}.
        """
        ImmutableProbabilisticMixIn.__init__(self, **prob)
        Production.__init__(self, lhs, rhs)
예제 #6
0
    def __init__(self, lhs, rhs, prob=None, tag=None):
        """
        Construct a new ``ProbabilisticProduction``.

        :param lhs: The left-hand side of the new ``ProbabilisticProduction``.
        :type lhs: Nonterminal
        :param rhs: The right-hand side of the new ``ProbabilisticProduction``.
        :type rhs: sequence(Nonterminal and terminal)
        :param prob: Probability parameters of the new ``ProbabilisticProduction``.
        :param tags: any tags for the production
        """
        ImmutableProbabilisticMixIn.__init__(self, prob=prob)
        Production.__init__(self, lhs, rhs, tag)