It's time we tackled the task of predicting the relationships between entities. We first need to know how to represent them in our documents, and then which components (rb or ml) can solve this task.
Representations
Basic relationships
We could add a rel dictionary attribute to scopes such as :
ent._.rel == {
# if we only know that the two entities are related, but not how (which may be fine in most cases)
ent1 : True,
# if we know the relationship between the two entities
ent2 : "is_located_in",
# should we instead store several tags per related entity?
ent3 : ["lives_with", "is_parent_of"]
}
and have getters to look at this list and find entities of a given label or with a certain type of relationship:
ent._.date == next((other._.date for other in ent._.rel if other.label_ == "date"), None)
Scopes
Another interesting approach is that of scopes and scope relationships. For example, in the following:
[The patient came in on [04/05/10] (date). We prescribed paracetamol because
of headaches.] [On the [following day] (date) the headaches disappeared].
where we predict on which span of text (scope) a given cue/trigger entity convey its meaning. Scopes can overlap each other. For instance, a section title convey its meaning on its section, which itself can contain several entities with smaller scopes.
This is already indirectly done by the eds.negation, eds.hypothesis, eds.history etc qualification components (implementation of the Negex/Context algorithms).
This could take the following form:
Span("following day")._.scope == Span("The following day, the headache was gone.")
Frames
Frames, as described in https://aclanthology.org/2023.bionlp-1.13.pdf#page=2, could be an interesting end result, but I think it would be too restrictive to implement them only.
Dependency and constituency analysis
We could also exploit dependency and constituency parsing relationships to infer relationships between entities, but note that the example above would not be directly resolved since the scope of the first entity spans two sentences, which are not syntactically related.
Components
Machine learning
I'm currently reimplementing a generic version of the https://github.com/percevalw/breast-imaging-frame-extraction method (https://aclanthology.org/2023.bionlp-1.13/)
Rule-based
By mixing sections, subsections (e.g. enumerations and bullets), sentences and Context-like algorithms, we could probably already get good results on highly requested tasks such as detecting relationships between dates and surrounding entities.
It's time we tackled the task of predicting the relationships between entities. We first need to know how to represent them in our documents, and then which components (rb or ml) can solve this task.
Representations
Basic relationships
We could add a
reldictionary attribute to scopes such as :and have getters to look at this list and find entities of a given label or with a certain type of relationship:
Scopes
Another interesting approach is that of scopes and scope relationships. For example, in the following:
where we predict on which span of text (scope) a given cue/trigger entity convey its meaning. Scopes can overlap each other. For instance, a section title convey its meaning on its section, which itself can contain several entities with smaller scopes.
This is already indirectly done by the
eds.negation,eds.hypothesis,eds.historyetc qualification components (implementation of the Negex/Context algorithms).This could take the following form:
Frames
Frames, as described in https://aclanthology.org/2023.bionlp-1.13.pdf#page=2, could be an interesting end result, but I think it would be too restrictive to implement them only.
Dependency and constituency analysis
We could also exploit dependency and constituency parsing relationships to infer relationships between entities, but note that the example above would not be directly resolved since the scope of the first entity spans two sentences, which are not syntactically related.
Components
Machine learning
I'm currently reimplementing a generic version of the https://github.com/percevalw/breast-imaging-frame-extraction method (https://aclanthology.org/2023.bionlp-1.13/)
Rule-based
By mixing sections, subsections (e.g. enumerations and bullets), sentences and Context-like algorithms, we could probably already get good results on highly requested tasks such as detecting relationships between dates and surrounding entities.