'Update or predict on a single example (batchsize = 1).'

def act(self):

    if self.is_shared:
        raise RuntimeError('Parallel    act    is    not    supported.')
    reply = {'id': self.getID()}
    ex = self._build_ex(self.observation)
    if (ex is None):
        return reply
    batch = batchify([ex], null=self.word_dict[self.word_dict.null_token], cuda=self.opt['cuda'])
    if ('labels' in self.observation):
        self.n_examples += 1
        self.model.update(batch)
    else:
        reply['text'] = self.model.predict(batch)[0]
    return reply
