You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
first of all this is my first time using github and also i'm very new to python so be gentle with me..
I have a pykov.Chain where one of the items is None and when i'm trying to use the function chain.move(None) i get the following error: AttributeError: 'OrderedDict' object has no attribute 'choose'
to fix it i did the following changes in the succ function (i only use positive numbers in my project):
from:
def succ(self, key=None):
try:
if key is not None:
return self._succ[key]
else:
return self._succ
except AttributeError:
self._succ = OrderedDict([(state, Vector()) for state in self.states()])
for link, probability in six.iteritems(self):
self._succ[link[0]][link[1]] = probability
if key is not None:
return self._succ[key]
else:
return self._succ
to:
def succ(self, key=-1):
try:
if key is not -1:
return self._succ[key]
else:
return self._succ
except AttributeError:
self._succ = OrderedDict([(state, Vector()) for state in self.states()])
for link, probability in six.iteritems(self):
self._succ[link[0]][link[1]] = probability
if key is not -1:
return self._succ[key]
else:
return self._succ
My solution works for me, but is there a better way?
The text was updated successfully, but these errors were encountered:
Hey,
first of all this is my first time using github and also i'm very new to python so be gentle with me..
I have a pykov.Chain where one of the items is None and when i'm trying to use the function chain.move(None) i get the following error:
AttributeError: 'OrderedDict' object has no attribute 'choose'
to fix it i did the following changes in the succ function (i only use positive numbers in my project):
from:
to:
My solution works for me, but is there a better way?
The text was updated successfully, but these errors were encountered: