此段代码
是将输入的list triples,每一个列表项都是一个列表
每个列表项中,列表index为0的groupby到一起,存储到dict中
def getHeadTogether(triples):
head_together = {}
print('get head together...')
triples_ = groupby(sorted(triples), key=lambda x: x[0])
for i, j in triples_:
head_together[i] = list(j)
return head_together