def encode_action(self, actions, system=True):
        """
        Encode the dialogue actions

        :param actions: The list of actions to encode
        :param system: If the actions were taken by a 'system' or a 'user'
                       agent
        :return:
        """

        # TODO: Action encoding in a principled way
        if not actions:
            print('WARNING: Parse DSTC2 action encoding called with empty'
                  ' actions list (returning 0).')
            return 0

        # TODO: Handle multiple actions
        action = actions[0]

        if self.dstc2_acts and action.intent in self.dstc2_acts:
            return self.dstc2_acts.index(action.intent)

        if action.intent == 'request':
            if system:
                return len(self.dstc2_acts) + \
                       self.system_requestable_slots.index(
                           action.params[0].slot)
            else:
                return len(self.dstc2_acts) + \
                       self.requestable_slots.index(action.params[0].slot)

        if action.intent == 'inform':
            if system:
                return len(self.dstc2_acts) + \
                       len(self.system_requestable_slots) + \
                       self.requestable_slots.index(action.params[0].slot)
            else:
                return len(self.dstc2_acts) + \
                       len(self.requestable_slots) + \
                       self.requestable_slots.index(action.params[0].slot)

        # Default fall-back action
        print('Parse DSTC2 ({0}) action encoder warning: Selecting default '
              'action (unable to encode: {1})!'
              .format(self.agent_role, action))
        return 0

        Encode the dialogue actions

        :param actions: The list of actions to encode
        :param system: If the actions were taken by a 'system' or a 'user'
                       agent
        :return:
        
plato/utilities/parser/parse_dstc2.py