MCPcopy Create free account
hub / github.com/DataArcTech/ToG / clean_relations_bm25_sent

Function clean_relations_bm25_sent

ToG/utils.py:92–103  ·  view source on GitHub ↗
(topn_relations, topn_scores, entity_id, head_relations)

Source from the content-addressed store, hash-verified

90
91
92def clean_relations_bm25_sent(topn_relations, topn_scores, entity_id, head_relations):
93 relations = []
94 if if_all_zero(topn_scores):
95 topn_scores = [float(1/len(topn_scores))] * len(topn_scores)
96 i=0
97 for relation in topn_relations:
98 if relation in head_relations:
99 relations.append({"entity": entity_id, "relation": relation, "score": topn_scores[i], "head": True})
100 else:
101 relations.append({"entity": entity_id, "relation": relation, "score": topn_scores[i], "head": False})
102 i+=1
103 return True, relations
104
105
106def run_llm(prompt, temperature, max_tokens, opeani_api_keys, engine="gpt-3.5-turbo"):

Callers

nothing calls this directly

Calls 1

if_all_zeroFunction · 0.70

Tested by

no test coverage detected