I am working with data from pharmaceutical labels. The text is always structured using the verb phrase 'indicated for'.
For example:
sentence = "Meloxicam tablet is indicated for relief of the signs and symptoms of osteoarthritis and rheumatoid arthritis"
I have already used SpaCy to filter down to only sentences that contain the phrase 'indicated for'.
I now need a function that will take in the sentence, and return the phrase that is the object of 'indicated for'. So for this example, the function, which I have called extract()
, would operate like this:
extract(sentence)
>> 'relief of the signs and symptoms of osteoarthritis and rheumatoid arthritis'
Is there functionality to do this using spacy?
EDIT: Simply splitting after 'indicated for' won't work for complicated examples.
Here's some examples:
'''buprenorphine and naloxone sublingual tablets are indicated for the maintenance treatment of opioid dependence and should be used as part of a complete treatment plan to include counseling and psychosocial support buprenorphine and naloxone sublingual tablets contain buprenorphine a partial opioid agonist and naloxone an opioid antagonist and is indicated for the maintenance treatment of opioid dependence'''
'''ofloxacin ophthalmic solution is indicated for the treatment of infections caused by susceptible strains of the following bacteria in the conditions listed below conjunctivitis gram positive bacteria gram negative bacteria staphylococcus aureus staphylococcus epidermidis streptococcus pneumoniae enterobacter cloacae haemophilus influenzae proteus mirabilis pseudomonas aeruginosa corneal ulcers gram positive bacteria gram negative bacteria staphylococcus aureus staphylococcus epidermidis streptococcus pneumoniae pseudomonas aeruginosa serratia marcescens'''
where I just want the bold parts.