我一直在努力以给定的文档中相同的确切词或不同的词但具有相同含义的方式查找较低级别的临床术语。我对给定的文本使用余弦相似度匹配,并且必须匹配每个术语,但我确实获得了与给定文本匹配的值的最大值cos值会为我提供确切的值。
sent_list = process.SBD("The patient has been given paracetamol for fever in interval of every two hour. There has been sever headache and abnorm of the labor. Continuation of these medicine might lead to abdomen has been crushing.")
输出:
[['Arenaviral haemorrhagic fever'], ['Abnormal labor'], ['Abdomen crushing']]
但是我还需要获取文本中匹配的单词的索引 任何获取给定文本中匹配单词索引的算法。
答案 0 :(得分:1)
我希望能帮助您交配,这是您要努力实现的目标 这就是我所了解的,您正在尝试做的
a = 'this is a test of getting the words indexes'
b = [['this is a'],[ 'the words']]
for i in b:
#using the lower() so there is no a case mismatch
if ''.join(i).lower() in a.lower():
print(b.index(i))