I am implementing the general `N-Grams` using `SymPy`

the equation is:
p(w1, w2, .... wn) = ∏ p(wi | wi-k, .... wi-1)

the input words is tuple tuple([w1, w2, w3, ... wn])

I tried to use `sympy.concrete.product.Product` with custom function that 
calculates the probability as first argument

```
class Estimator(Function):
    @classmethod
    def eval(cls, token, history):
        return "whatever"

class _Segment(Function):
    @classmethod
    def eval(cls, statement, i, k):
        return (statement[i], statement[i - k:i - 1])

Product(Estimator(_Segment(statement, i, self._k)), (i, 1, len(statement)))
```

and I am getting error  `indices must be integers, not Symbol`
k=1m

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to