YASH ANAND 15BEC0780
YASH ANAND 15BEC0780

Reputation: 23

Index of the matched words of the given two text

I have been working on finding the lower level clinical terms in given document either in the same exact words or in different words but the same meaning. I used cosine similarity matching for the given text with every terms I have to match with and I do get the value of how much it has matched the given text highest cos value gives me the exact value.

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.")

output: [['Arenaviral haemorrhagic fever'], ['Abnormal labor'], ['Abdomen crushing']]

but I also need to get the index of the words which has matched in the text Any algorithm to get the index of words matched in the given text.

Upvotes: 1

Views: 30

Answers (1)

ThunderHorn
ThunderHorn

Reputation: 2035

I hope that helps you mate and this is what you are trying to achieve if not that's what i understood you are trying to do

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))

Upvotes: 1

Related Questions