Commit 86c95811 authored by 赵威's avatar 赵威

merge result

parent 969e4548
...@@ -29,15 +29,18 @@ def make_dict_from_pair(x): ...@@ -29,15 +29,18 @@ def make_dict_from_pair(x):
# [('点击内容卡片', {'假体隆胸': 1.9067764699346477}), ('点击内容卡片', {'植发': 1.9067764699346477, '植发际线': 1})] # [('点击内容卡片', {'假体隆胸': 1.9067764699346477}), ('点击内容卡片', {'植发': 1.9067764699346477, '植发际线': 1})]
def merge_results_by_event(lst): def merge_results_by_event(lst):
res = {} tmp = {}
for i in lst: for i in lst:
event_cn = i[0] event_cn = i[0]
d = i[1] d = i[1]
if d: if d:
if event_cn not in res: if event_cn not in tmp:
res[event_cn] = [d] tmp[event_cn] = [d]
else: else:
res[event_cn].append(d) tmp[event_cn].append(d)
res = {}
for (k, v) in tmp.items():
res[k] = merge_values(v)
return res return res
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment