Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

entity is not in entities list,but in relationship list? #28

Open
LLL1st opened this issue Dec 5, 2024 · 1 comment
Open

entity is not in entities list,but in relationship list? #28

LLL1st opened this issue Dec 5, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@LLL1st
Copy link

LLL1st commented Dec 5, 2024

Look at this code
`
elif startEntity_in_input_entities is None and endEntity_in_input_entities is None:
print(f"[INFO][INVENTED ENTITIES] Aie; the entities {startEntity} and {endEntity} are invented. Solving them ...")
startEntity.embed_Entity(embeddings_function=self.langchain_output_parser.calculate_embeddings,
entity_label_weight=entity_label_weight,
entity_name_weight=entity_name_weight)
endEntity.embed_Entity(embeddings_function=self.langchain_output_parser.calculate_embeddings,
entity_label_weight=entity_label_weight,
entity_name_weight=entity_name_weight)

            startEntity = self.matcher.find_match(obj1=startEntity, list_objects=entities, threshold=0.5)
            endEntity = self.matcher.find_match(obj1=endEntity, list_objects=entities, threshold=0.5)
            
            curated_relationships.append(Relationship(startEntity= startEntity, 
                                  endEntity = endEntity,
                                  name = relationship["name"]))

`
According to the ”find_match“, startEntity is returned if it does not find a similar entity among entities
At this point, startEntity is not in the entities list, but in the curated_relationships list. Is this correct?

@lairgiyassir lairgiyassir added the enhancement New feature or request label Dec 7, 2024
@lairgiyassir
Copy link
Collaborator

Hello,

Yes, your understanding is correct. Based on the behavior of find_match, if it does not find a similar entity among the entities list, it simply returns the startEntity as-is.

I have lowered the value of threshold to 0.5 to maximise the chances to have a match because we assume that the extracted entities are exhaustive, so any invented entity might be just a rewriting of an original entity from the entities list.

However, to keep the code clean and handle all the possible cases, I will add a feature which consists of adding the invented entity (in case no match found under 0.5 threshold) to the input entities list.

Your question is very pertinent, thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants