|
@@ -1390,6 +1390,7 @@ async def getSingleDeXilie_(model, client, zhuanye, debh, mc):
|
|
|
count = 0
|
|
count = 0
|
|
|
actual_zhuanye = []
|
|
actual_zhuanye = []
|
|
|
mcs = []
|
|
mcs = []
|
|
|
|
|
+ parents = []
|
|
|
if "附注" in debh:
|
|
if "附注" in debh:
|
|
|
position = debh.find("附注")
|
|
position = debh.find("附注")
|
|
|
debh = debh[:position]
|
|
debh = debh[:position]
|
|
@@ -1405,6 +1406,7 @@ async def getSingleDeXilie_(model, client, zhuanye, debh, mc):
|
|
|
##print(post)
|
|
##print(post)
|
|
|
actual_zhuanye.append(post['zhuanye'])
|
|
actual_zhuanye.append(post['zhuanye'])
|
|
|
mcs.append(post['GCLMC'])
|
|
mcs.append(post['GCLMC'])
|
|
|
|
|
+ parents.append(post['parent'])
|
|
|
count = count + 1
|
|
count = count + 1
|
|
|
if count == 0:
|
|
if count == 0:
|
|
|
return None, None, None, None, None, None, None, zhuanye
|
|
return None, None, None, None, None, None, None, zhuanye
|
|
@@ -1430,7 +1432,7 @@ async def getSingleDeXilie_(model, client, zhuanye, debh, mc):
|
|
|
else:
|
|
else:
|
|
|
hit = False
|
|
hit = False
|
|
|
for i in range(0, count):
|
|
for i in range(0, count):
|
|
|
- if mcs[i] == mc:
|
|
|
|
|
|
|
+ if mcs[i] in mc:
|
|
|
hit = True
|
|
hit = True
|
|
|
actual_zhuanye[0] = actual_zhuanye[i]
|
|
actual_zhuanye[0] = actual_zhuanye[i]
|
|
|
if hit:
|
|
if hit:
|
|
@@ -1453,7 +1455,10 @@ async def getSingleDeXilie_(model, client, zhuanye, debh, mc):
|
|
|
A1, A2, A3, A4, A5, A6, A7 = service.getSingleDeXilie_xsaz(debh)
|
|
A1, A2, A3, A4, A5, A6, A7 = service.getSingleDeXilie_xsaz(debh)
|
|
|
return A1, A2, A3, A4, A5, A6, A7, 60
|
|
return A1, A2, A3, A4, A5, A6, A7, 60
|
|
|
else:
|
|
else:
|
|
|
|
|
+ for i in range(len(parents)):
|
|
|
|
|
+ mcs[i] = parents[i] + ' ' + mcs[i]
|
|
|
mcs.append(mc)
|
|
mcs.append(mc)
|
|
|
|
|
+ #print(mcs)
|
|
|
embeddings = model.encode(mcs)
|
|
embeddings = model.encode(mcs)
|
|
|
similarities = model.similarity( embeddings[-1], embeddings)
|
|
similarities = model.similarity( embeddings[-1], embeddings)
|
|
|
##array([1.0000002, 0.7662151, 1.0000002], dtype=float32)
|
|
##array([1.0000002, 0.7662151, 1.0000002], dtype=float32)
|
|
@@ -1490,6 +1495,7 @@ async def getSingleDeXilie(model, client, zhuanye, debh, mc):
|
|
|
count = 0
|
|
count = 0
|
|
|
actual_zhuanye = []
|
|
actual_zhuanye = []
|
|
|
mcs = []
|
|
mcs = []
|
|
|
|
|
+ parents = []
|
|
|
if "附注" in debh:
|
|
if "附注" in debh:
|
|
|
position = debh.find("附注")
|
|
position = debh.find("附注")
|
|
|
debh = debh[:position]
|
|
debh = debh[:position]
|
|
@@ -1505,6 +1511,7 @@ async def getSingleDeXilie(model, client, zhuanye, debh, mc):
|
|
|
##print(post)
|
|
##print(post)
|
|
|
actual_zhuanye.append(post['zhuanye'])
|
|
actual_zhuanye.append(post['zhuanye'])
|
|
|
mcs.append(post['GCLMC'])
|
|
mcs.append(post['GCLMC'])
|
|
|
|
|
+ parents.append(post['parent'])
|
|
|
count = count + 1
|
|
count = count + 1
|
|
|
if count == 0:
|
|
if count == 0:
|
|
|
return None, None, None, None, None, None, None, zhuanye
|
|
return None, None, None, None, None, None, None, zhuanye
|
|
@@ -1530,7 +1537,7 @@ async def getSingleDeXilie(model, client, zhuanye, debh, mc):
|
|
|
else:
|
|
else:
|
|
|
hit = False
|
|
hit = False
|
|
|
for i in range(0, count):
|
|
for i in range(0, count):
|
|
|
- if mcs[i] == mc:
|
|
|
|
|
|
|
+ if mcs[i] in mc:
|
|
|
hit = True
|
|
hit = True
|
|
|
actual_zhuanye[0] = actual_zhuanye[i]
|
|
actual_zhuanye[0] = actual_zhuanye[i]
|
|
|
if hit:
|
|
if hit:
|
|
@@ -1553,6 +1560,8 @@ async def getSingleDeXilie(model, client, zhuanye, debh, mc):
|
|
|
A1, A2, A3, A4, A5, A6, A7 = service.getSingleDeXilie_xsaz(debh)
|
|
A1, A2, A3, A4, A5, A6, A7 = service.getSingleDeXilie_xsaz(debh)
|
|
|
return A1, A2, A3, A4, A5, A6, A7, 60
|
|
return A1, A2, A3, A4, A5, A6, A7, 60
|
|
|
else:
|
|
else:
|
|
|
|
|
+ for i in range(len(parents)):
|
|
|
|
|
+ mcs[i] = parents[i] + " " + mcs[i]
|
|
|
mcs.append(mc)
|
|
mcs.append(mc)
|
|
|
embeddings = model.encode(mcs)
|
|
embeddings = model.encode(mcs)
|
|
|
similarities = model.similarity( embeddings[-1], embeddings)
|
|
similarities = model.similarity( embeddings[-1], embeddings)
|