'Ensures that the loaded training data is valid, e.g. has a minimum of certain training examples.'

def validate(self):

    logger.debug(u'Validating    training    data...')
    examples = self.sorted_intent_examples()
    different_intents = []
    for (intent, group) in groupby(examples, (lambda e: e.get(u'intent'))):
        size = len(list(group))
        different_intents.append(intent)
        if (size < self.MIN_EXAMPLES_PER_INTENT):
            template = u"Intent    '{}'    has    only    {}    training    examples!    minimum    is    {},    training    may    fail."
            warnings.warn(template.format(intent, size, self.MIN_EXAMPLES_PER_INTENT))
    different_entities = []
    for (entity, group) in groupby(self.sorted_entity_examples(), (lambda e: e[u'entity'])):
        size = len(list(group))
        different_entities.append(entity)
        if (size < self.MIN_EXAMPLES_PER_ENTITY):
            template = u"Entity    '{}'    has    only    {}    training    examples!    minimum    is    {},    training    may    fail."
            warnings.warn(template.format(entity, size, self.MIN_EXAMPLES_PER_ENTITY))
    logger.info(((((u'Training    data    stats:    \n' + u' DCTB -    intent    examples:    {}    ({}    distinct    intents)\n'.format(self.num_intent_examples, len(different_intents))) + u' DCTB -    found    intents:    {}\n'.format(list_to_str(different_intents))) + u' DCTB -    entity    examples:    {}    ({}    distinct    entities)\n'.format(self.num_entity_examples, len(different_entities))) + u' DCTB -    found    entities:    {}\n'.format(list_to_str(different_entities))))
