enhanced-subject-verb-object-extraction
enhanced-subject-verb-object-extraction copied to clipboard
Relative Pronouns
Below is the sentence 50 year old Male with history of alcohol abuse and hypertension who presents with emesis with blood clots.
How to identify the subject verb object in this case?
Best Regards, Vishal
Vishal - as you can see - the algorithm first finds all the verbs that aren't auxiliary. In your case, there is only one verb: "presents". The problem with that sentence is that there are a lot of conjunctives "with" which my algorithm doesn't deal with yet. Your example sentence is also passive - it is actually a really nice example. I will work on this when I have some time.
Thanks. I am also giving it a shot. In case I get there will post here.
For the example sentence, if you add pobj
to OBJECT
, I find {('who', 'presents', 'emesis with blood clots')}
. Resolution of the term 'who' seems outside the scope of this algorithm. This might work for @vishalvpv. It's a workaround.
Of course, it means that for sentences such as "he told me i would die alone with nothing but my career someday", you get {('he', 'told', 'me'), ('i', 'die', 'nothing')}
. I want the extra svo
. Handling of pobj
seems up for grabs, at least to me. I need to test it all more thoroughly.
What this means for or (is_pas and tok.dep_ == "pobj")
in _get_all_objs()
and elsewhere is something I need to investigate but there seems to be no harm in keeping it. The passive case is tricky.
I also added "acomp"
to OBJECT
. This allows an svo
to be returned for "I am happy" and the like.
This is an excellent piece of code that I've refactored for my own use (made it class, etc.). I hope to create a PR in the near future.
pronoun references can easily be resolved with a Lappin/Leass algorithm - thats like 80% accurate. I could add one of those if you guys want.
Would be great if you can add. Spacy based coreference. https://github.com/huggingface/neuralcoref
Not sure if it works for relative pronouns.
I'm using neuralcoref
but outside of this code. It seems to me that these types of resolutions are a separate problem. I'm trying to tackle the passive cases first. My neuralcoref
install broke, so I can't try it however I believe it will this sort of pronoun resolution (who, which, etc.).
I attended a talk on CapitalOne's chatbot Eno. One of the problems they face during a chat is related to this. A user might ask for their account balances (they recorded over 2200 different ways this can be asked). In the same chat the user later asks, "what is the interest rate on 'those'" and there seems to be no good way to resolve "those" to "account". Different problem altogether.
neuralcoref has an online demo. https://huggingface.co/coref/
But yes you are correct. It is not meant for relative pronouns.
you are correct @christophsk, this wouldn't be the right place for pronoun resolution as it is a separate concern...