MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / match

Method match

bmtools/knowledge/knowledge_extraction.py:57–75  ·  view source on GitHub ↗
(self, detailed_metrics)

Source from the content-addressed store, hash-verified

55 return self.corpus, self.preprocessed_corpus, self.matched_attr, self.stop_words
56
57 def match(self, detailed_metrics):
58
59 metrics_str = []
60 for metrics in detailed_metrics.keys():
61 metrics = metrics.replace("_"," ")
62 word_tokens = word_tokenize(metrics)
63 metrics_str.extend([self.wnl.lemmatize(w,pos='n') for w in word_tokens if not w in self.stop_words])
64 metrics_str = list(set(metrics_str))
65
66 best_index = self.keyword_matching_func(self.topk, metrics_str, self.preprocessed_corpus)
67 best_docs = [self.corpus[b] for b in best_index]
68 best_names = [self.matched_attr[b] for b in best_index]
69 docs_str = ""
70 print("Best docs: ", best_docs)
71 for i, docs in enumerate(best_docs):
72 docs_str = docs_str + "{}: ".format(best_names[i]) + docs + "\n\n"
73 print("docs_str: ", docs_str)
74
75 return docs_str
76
77
78if __name__ == "__main__":

Callers 3

cpu_diagnosis_agentFunction · 0.80
memory_diagnosis_agentFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected