'Represent this set of training examples as json adding the passed meta information.'

def as_json(self, **kwargs):

    syns_as_tuples = sorted([i for i in self.entity_synonyms.items() if (i[0] != i[1])], key=(lambda x: x[1]))
    self.entity_synonyms = []
    for (i, s) in enumerate(syns_as_tuples):
        if ((i == 0) or (s[1] != syns_as_tuples[(i - 1)][1])):
            self.entity_synonyms.append({u'value': s[1], u'synonyms': []})
        self.entity_synonyms[(-1)][u'synonyms'].append(s[0])
    return str(json.dumps({u'rasa_nlu_data': {u'common_examples': [example.as_dict() for example in self.training_examples], u'regex_features': self.regex_features, u'entity_synonyms': self.entity_synonyms}}, **kwargs))
