def load_catalog_file()

in utils/express_utils.py [0:0]


def load_catalog_file(file_path):
    """
    This method loads the content of a catalog file into a dict object.
    :param file_path: (str) the path to a catalog file, for eg. PATH/TO/topping.txt
    :return: (dict) a dict object which keys are the entity values (left column in tries file) and values are the
                    corresponding entity (right column in catalog file).
                    e.g. { 'personal sized' : 'PERSONAL_SIZE',
                           'extra large size' : 'EXTRA_LARGE',
                           'small': 'SMALL',
                              .
                              .
                            }
    """
    mapping = {}
    for line in open(file_path, 'r').readlines():
        line = line.strip()
        if len(line) > 0:
            entity_value, entity_name = line.split('\t')
            mapping[entity_value] = entity_name
    return mapping