Skip to content

Commit

Permalink
Merge fc96083 into 0375ce1
Browse files Browse the repository at this point in the history
  • Loading branch information
justaddcoffee committed Jul 24, 2020
2 parents 0375ce1 + fc96083 commit 50ded32
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions kg_covid_19/transform_utils/scibite_cord/scibite_cord.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'WD': 'http://www.wikidata.org/entity/'
}


class ScibiteCordTransform(Transform):
"""
ScibiteCordTransform parses the SciBite annotations on CORD-19 dataset
Expand Down Expand Up @@ -94,14 +95,12 @@ def parse_annotations(self, node_handle: Any, edge_handle: Any,
subsets = ['pmc_json', 'pdf_json']
for subset in subsets:
subset_dir = os.path.join(self.input_base_dir, subset)
for data_dir in os.listdir(subset_dir):
if os.path.isdir(os.path.join(subset_dir, data_dir)):
for filename in os.listdir(os.path.join(subset_dir, data_dir)):
file = os.path.join(subset_dir, data_dir, filename)
doc = json.load(open(file))
self.parse_annotation_doc(node_handle, edge_handle, doc, subset)

def parse_annotation_doc(self, node_handle, edge_handle, doc: Dict, subset: str = None) -> None:
for filename in os.listdir(subset_dir):
file = os.path.join(subset_dir, filename)
doc = json.load(open(file))
self.parse_annotation_doc(node_handle, edge_handle, doc)

def parse_annotation_doc(self, node_handle, edge_handle, doc: Dict) -> None:
"""Parse a JSON document corresponding to a publication.
Args:
Expand Down

0 comments on commit 50ded32

Please sign in to comment.