示例#1
0
    def __init__(self, environment=None, **model_parameters):

        self.chunktype = chunks.chunktype
        self.chunkstring = chunks.chunkstring

        self.visbuffers = {}

        start_goal = goals.Goal()
        self.goals = {"g": start_goal}

        self.__buffers = {"g": start_goal}

        start_retrieval = declarative.DecMemBuffer()
        self.retrievals = {"retrieval": start_retrieval}
        
        self.__buffers["retrieval"] = start_retrieval
        
        start_dm = declarative.DecMem()
        self.decmems = {"decmem": start_dm}

        self.productions = productions.Productions()
        self.__similarities = {}

        self.model_parameters = self.MODEL_PARAMETERS.copy()

        try:
            if not set(model_parameters.keys()).issubset(set(self.MODEL_PARAMETERS.keys())):
                raise(utilities.ACTRError("Incorrect model parameter(s) %s. The only possible model parameters are: '%s'" % (set(model_parameters.keys()).difference(set(self.MODEL_PARAMETERS.keys())), set(self.MODEL_PARAMETERS.keys()))))
            self.model_parameters.update(model_parameters)
        except TypeError:
            pass

        self.__env = environment
示例#2
0
    def set_goal(self, name, delay=0):
        """
        Set goal buffer. delay specifies the delay of setting a chunk in the buffer.

        name specifies the name by which the goal buffer is referred to in production rules.
        """
        g = goals.Goal(delay=delay)
        self.__buffers[name] = g
        self.goals[name] = g
        return g
示例#3
0
    def set_goal(self, name, delay=0):
        """
        Set goal buffer. delay specifies the delay of setting a chunk in the buffer.

        name: the name by which the goal buffer is referred to in production rules.
        """
        if not isinstance(name, str):
            raise(ValueError("Goal buffer can be only set with a string, the name of the goal buffer."))
        g = goals.Goal(delay=delay)
        self.__buffers[name] = g
        self.goals[name] = g
        return g