import gzip
import json


def build_itemid2name(metadata_file):
    """
    Loads item titles and creates a dictionary

    :param metadata_file: path to amazon product metadata file
    :return: dict of iid: item_title
    """
    with gzip.open(str(metadata_file), 'r') as f:
        return {meta["asin"]: meta.get("title", "None")[:100] for meta in map(json.loads, f)}