Skip to content

Commit

Permalink
Cleanup and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
caufieldjh committed Oct 4, 2023
1 parent ec3a151 commit de98bc5
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/ontogpt/evaluation/ctd/eval_ctd.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class EvaluationObjectSetRE(BaseModel):

@dataclass
class EvalCTD(SPIRESEvaluationEngine):
# ontology: OboGraphInterface = None
subject_prefix = "MESH"
object_prefix = "MESH"

Expand All @@ -158,7 +157,7 @@ def load_cases(self, path: Path) -> Iterable[ChemicalToDiseaseDocument]:
doc[p.infons["type"]] = p.text
title = doc["title"]
abstract = doc["abstract"]
# text = f"Title: {title} Abstract: {abstract}"
logger.debug(f"Title: {title} Abstract: {abstract}")
for r in document.relations:
i = r.infons
t = ChemicalToDiseaseRelationship.model_validate(
Expand Down Expand Up @@ -189,7 +188,7 @@ def create_training_set(self, num=100):
for doc in docs[0:num]:
text = doc.text
prompt = ke.get_completion_prompt(None, text)
completion = ke.serialize_object(m)
completion = ke.serialize_object()
yield dict(prompt=prompt, completion=completion)

def eval(self) -> EvaluationObjectSetRE:
Expand Down Expand Up @@ -230,18 +229,6 @@ def eval(self) -> EvaluationObjectSetRE:
logger.debug(f"concatenated triples: {predicted_obj.triples}")
named_entities.extend(extraction.named_entities)

# title_extraction = ke.extract_from_text(doc.publication.title)
# logger.info(f"{len(title_extraction.extracted_object.triples)}\
# triples from: Title {doc.publication.title}")
# abstract_extraction = ke.extract_from_text(doc.publication.abstract)
# logger.info(f"{len(abstract_extraction.extracted_object.triples)}\
# triples from: Abstract {doc.publication.abstract}")
# ke.merge_resultsets([results, results2])
# predicted_obj = title_extraction.extracted_object
# predicted_obj.triples.extend(abstract_extraction.extracted_object.triples)
# logger.info(f"{len(predicted_obj.triples)} total triples, after concatenation")
# logger.debug(f"concatenated triples: {predicted_obj.triples}")

def included(t: ChemicalToDiseaseRelationship):
if not [var for var in (t.subject, t.object, t.predicate) if var is None]:
return (
Expand Down

0 comments on commit de98bc5

Please sign in to comment.