class documentation

Translate the image captions to English via OpenAI API.

Method __init__ Initialize CaptionTranslator.
Method load_data Load the original and the translated json file.
Method load_from_xz Load info from the xz file and save a json format.
Method translate Translate the captions to English via OpenAI API.
Instance Variable data_path path of the original json file.
Instance Variable out_json path of the output json file.
def __init__(self, data_path: Path, out_json: Path): (source)

Initialize CaptionTranslator.

Parameters
data_path:Pathpath of the original json file.
out_json:Pathpath of the output json file.
def load_data(self, check_type: str) -> tuple[dict[str, dict], dict]: (source)

Load the original and the translated json file.

Returns
Tuple[Dict[str, dict], dict]original data and translated data.
def load_from_xz(self, json_path: Path, xz_path: Path) -> dict[str, dict]: (source)

Load info from the xz file and save a json format.

Parameters
json_path:Pathpath of the json file.
xz_path:Pathpath of the xz file.
Returns
dict[str, dict]Undocumented
def translate(self, info: dict[str, dict]) -> dict[str, dict]: (source)

Translate the captions to English via OpenAI API.

Parameters
info:Dict[str, dict]meta data of a single patient.
Returns
Dict[str, dict]json data with translated captions.
data_path: Path = (source)

path of the original json file.

out_json: Path = (source)

path of the output json file.