1 Star 0 Fork 0

wowai/Tianchi_recommender_System_of_taobao_clothes

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
matchhistory.py 1.74 KB
一键复制 编辑 原始数据 按行查看 历史
Haodongliu 提交于 2018-02-07 18:40 . Add files via upload
class matchhistory():
match_list =[]
def separate(self,list1):
new_list = []
for each in list1:
if ',' not in each:
new_list.append(each)
else:
itemids = each.split(',')
for id in itemids:
new_list.append(id)
return new_list
def match_item(self, simi_list):
fashion_matchsets = open('dim_fashion_matchsets.txt', 'r')
fashion_match = fashion_matchsets.readlines()
for each in fashion_match:
fashion_match_line = each.rstrip('\n').split(' ')
items_list = fashion_match_line[1].split(';')
for similirity in simi_list:
for item_id in items_list:
if ',' in item_id:
ids = item_id.split(',')
# print ids
if similirity in ids:
items_list.remove(item_id)
for match in self.separate(items_list):
if match not in self.match_list:
self.match_list.append(match)
else:
if similirity == item_id:
items_list.remove(item_id)
for match in self.separate(items_list):
if match not in self.match_list:
self.match_list.append(match)
print 'final matching result:\n'
for each in self.match_list:
print each
if __name__ == '__main__':
a = matchhistory()
line = ['1062118', '2787884', '3109993']
'''similar gather with item waiting testing'''
a.match_item(line)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wowai/Tianchi_recommender_System_of_taobao_clothes.git
git@gitee.com:wowai/Tianchi_recommender_System_of_taobao_clothes.git
wowai
Tianchi_recommender_System_of_taobao_clothes
Tianchi_recommender_System_of_taobao_clothes
master

搜索帮助