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

Function deep_reduce

bmtools/tools/meta_analysis/api.py:201–212  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

199 fw.close()
200
201def deep_reduce(item):
202 tag = 0
203 item_emb = get_embedding(item.lower())
204 sims = []
205 for stan in stan_emb:
206 sims.append(dot(stan, np.array(item_emb))/(norm(stan)*norm(np.array(item_emb))+1e-5))
207 sims = np.array(sims)
208 sr = np.argmax(sims)
209 if sims[sr]>0.85:
210 item = standard[sr]
211 tag = 1
212 return item, tag
213
214def convert(table0):
215 dic = {}

Callers 1

convertFunction · 0.85

Calls 1

get_embeddingFunction · 0.85

Tested by

no test coverage detected