def top_sentences (kernel, path):
key_sent = {}<EOL>i = <NUM_LIT:0><EOL>if isinstance(path, str):<EOL><INDENT>path = json_iter(path)<EOL><DEDENT>for meta in path:<EOL><INDENT>graf = meta["<STR_LIT>"]<EOL>tagged_sent = [WordNode._make(x) for x in graf]<EOL>text = "<STR_LIT:U+0020>".join([w.raw for w in tagged_sent])<EOL>m_sent = mh_digest([str(w.word_id) for w in tagged_sent])<EOL>dist = sum([m_sent.jaccard(m) * rl.rank for rl, m in kernel])<EOL>key_sent[text] = (dist, i)<EOL>i += <NUM_LIT:1><EOL><DEDENT>for text, (dist, i) in sorted(key_sent.items(), key=lambda x: x[<NUM_LIT:1>][<NUM_LIT:0>], reverse=True):<EOL><INDENT>yield SummarySent(dist=dist, idx=i, text=text)<EOL><DEDENT>
determine distance for each sentence