def generate_itemSimOnTypeSet():
    prefs = {}
    result = {}
    try:
        with open(os.getcwd() + '//ml-100k' + '/u.item') as item:
            for line in item:
                typeVector = line.split('|')[5:24]
                itemId = line.split('|')[0]
                prefs[itemId] = typeVector
                result.setdefault(itemId, {})
    except __HOLE__ as err:
        print('File error: ' + str(err))
    #print similarity.sim_itemType(prefs['1677'],prefs['1678'],19)
    for key1, value1 in prefs.items():
        for key2, value2 in prefs.items():
            if key1 != key2:
                s = similarity.sim_itemType(value1, value2, 19)
                print
                key1, key2, s
                result[key1][key2] = s
    dumpPickle(result, '/itemSimOnType.pkl')
dataset/ETHPy150Open clasnake/recommender/tool.py/generate_itemSimOnTypeSet