def get_topk(scores, items, k):
    """
    given a 1d tensor of scores, and a list of corresponding items, returns a dictionary
    {'scores': [s1, s2, s3, ..], 'text': [x1, x2, x3, ...]}, where s1 is the highest score, 
    and x1 is the corresponding item, s2 the second highest, and so on.
    """
    vals, ixs = zip(*[(val.item(), items[ix]) for val, ix in zip(*scores.topk(k))])
    return {'score': vals, 'text': ixs}