Skip to content

Commit

Permalink
Lintin'
Browse files Browse the repository at this point in the history
  • Loading branch information
caufieldjh committed Sep 22, 2023
1 parent 025d56b commit 941d250
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/ontogpt/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ def iteratively_generate_extract(
):
write_extraction(results, output, output_format)


# TODO: combine this command with pubmed_annotate - they are converging
@main.command()
@template_option
Expand Down
8 changes: 4 additions & 4 deletions src/ontogpt/engines/spires_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def extract_from_text(
logging.info(f"RAW TEXT: {raw_text}")
next_object = self.parse_completion_payload(
raw_text, cls, object=object # type: ignore
)
)
if extracted_object is None:
extracted_object = next_object
else:
Expand All @@ -96,7 +96,7 @@ def extract_from_text(
logging.info(f"RAW TEXT: {raw_text}")
extracted_object = self.parse_completion_payload(
raw_text, cls, object=object # type: ignore
)
)
return ExtractionResult(
input_text=text,
raw_completion_output=raw_text,
Expand Down Expand Up @@ -516,13 +516,13 @@ def _parse_line_to_dict(
logging.debug(f" RECURSING ON SLOT: {slot.name}, range={slot_range.name}")
vals = [
self._extract_from_text_to_dict(v, slot_range) for v in vals # type: ignore
]
]
else:
for sep in [" - ", ":", "/", "*", "-"]:
if all([sep in v for v in vals]):
vals = [
dict(zip(slots_of_range, v.split(sep, 1))) for v in vals # type: ignore
]
]
for v in vals:
for k in v.keys(): # type: ignore
v[k] = v[k].strip() # type: ignore
Expand Down
4 changes: 2 additions & 2 deletions src/ontogpt/evaluation/hpoa/eval_hpoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
DATABASE_DIR = Path(__file__).parent / "database"
TEST_CASES_DIR = Path("tests").joinpath("input")
TEST_HPOA_FILE = "test_sample.hpoa.tsv"
NUM_TESTS = 3 # Note: each test requires input text; see provided test cases
NUM_TESTS = 3 # Note: each test requires input text; see provided test cases

DISEASE_ID = str
TERM = str
Expand Down Expand Up @@ -182,7 +182,7 @@ def eval_against_pubs(self, num_tests=NUM_TESTS) -> EvaluationObjectSetHPOA:
eos.training = []
eos.predictions = []
shuffle(eos.test)
for test_case in eos.test[0:num_tests-1]:
for test_case in eos.test[0 : num_tests - 1]:
# text = self.disease_text(test_case.id)
if len(test_case.publications) != 1:
raise ValueError(f"Expected 1 publication, got {len(test_case.publications)}")
Expand Down
1 change: 0 additions & 1 deletion src/ontogpt/io/yaml_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import pydantic
from ruamel.yaml import YAML, RoundTripRepresenter
from ruamel.yaml.comments import CommentedMap

# import yaml
# from yaml import SafeDumper
Expand Down

0 comments on commit 941d250

Please sign in to comment.