Skip to content

Commit

Permalink
implement Create fact statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
Jabbawukis committed Oct 15, 2024
1 parent b9dba18 commit e2daad6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/sample_efficiency_evaluation/fact_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ def index_dataset(
def commit_index(self) -> None:
self.writer.commit()

def convert_relation_info_dict_to_json(self, file_path: str) -> None:
"""
Convert relation info dictionary to json file.
:param file_path: Path to save the json file.
:return:
"""
utility.save_json_dict(self.entity_relation_info_dict, file_path)

@staticmethod
def _initialize_index(index_path) -> tuple[SegmentWriter, FileIndex]:
"""
Expand Down
10 changes: 10 additions & 0 deletions src/utility/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ def load_json_str(json_str: str) -> dict:
"""
json_dict = json.loads(json_str)
return json_dict


def save_json_dict(json_dict: dict, json_file_path: str):
"""
Save json file.
:param json_dict: Dictionary containing information
:param json_file_path: Path to json file
"""
with open(json_file_path, "w", encoding="utf-8") as f:
json.dump(json_dict, f, indent=4)

0 comments on commit e2daad6

Please sign in to comment.