def transform_entity_synonyms(synonyms, known_synonyms=None):
    """Transforms the entity synonyms into a text->value dictionary"""
    entity_synonyms = known_synonyms if known_synonyms else {}
    for s in synonyms:
        if 'value' in s and 'synonyms' in s:
            for synonym in s['synonyms']:
                entity_synonyms[synonym] = s['value']
    return entity_synonyms
