@staticmethod
def _tag_id_index_mapping_for(tag_name: Text, training_data: TrainingData) -> Optional[Dict[(Text, int)]]:
    'Create mapping from tag name to id.'
    if (tag_name == ENTITY_ATTRIBUTE_ROLE):
        distinct_tags = training_data.entity_roles
    elif (tag_name == ENTITY_ATTRIBUTE_GROUP):
        distinct_tags = training_data.entity_groups
    else:
        distinct_tags = training_data.entities
    distinct_tags = ((distinct_tags - {NO_ENTITY_TAG}) - {None})
    if (not distinct_tags):
        return None
    tag_id_dict = {tag_id: idx for (idx, tag_id) in enumerate(sorted(distinct_tags), 1)}
    tag_id_dict[NO_ENTITY_TAG] = 0
    return tag_id_dict
Create mapping from tag name to id.
@staticmethod
def _tag_id_index_mapping_for(tag_name: Text, training_data: TrainingData) -> Optional[Dict[(Text, int)]]:
    
    if (tag_name == ENTITY_ATTRIBUTE_ROLE):
        distinct_tags = training_data.entity_roles
    elif (tag_name == ENTITY_ATTRIBUTE_GROUP):
        distinct_tags = training_data.entity_groups
    else:
        distinct_tags = training_data.entities
    distinct_tags = ((distinct_tags - {NO_ENTITY_TAG}) - {None})
    if (not distinct_tags):
        return None
    tag_id_dict = {tag_id: idx for (idx, tag_id) in enumerate(sorted(distinct_tags), 1)}
    tag_id_dict[NO_ENTITY_TAG] = 0
    return tag_id_dict