def extract_normalized_entity_name()

in libraries/botbuilder-ai/botbuilder/ai/luis/luis_util.py [0:0]


    def extract_normalized_entity_name(entity: EntityModel) -> str:
        # Type::Role -> Role
        type = entity.type.split(":")[-1]
        if type.startswith("builtin.datetimeV2."):
            type = "datetime"

        if type.startswith("builtin.currency"):
            type = "money"

        if type.startswith("builtin."):
            type = type[8:]

        role = (
            entity.additional_properties["role"]
            if entity.additional_properties is not None
            and "role" in entity.additional_properties
            else ""
        )
        if role and not role.isspace():
            type = role

        return type.replace(".", "_").replace(" ", "_")