def test_generate_and_save_package_topic_model_local(self): input_data_store = LocalFileSystem( "tests/data/data_gnosis/input-ptm-data") self.assertTrue(input_data_store is not None) output_data_store = LocalFileSystem( "tests/data/data_gnosis/output-ptm-data") self.assertTrue(output_data_store is not None) package_topic_model = GnosisPackageTopicModel.curate( data_store=input_data_store, filename="data_input_curated_package_topic/package_topic.json") self.assertTrue(package_topic_model is not None) output_result = package_topic_model.get_dictionary() self.assertTrue(output_result is not None) expected_package_topic_model = GnosisPackageTopicModel.load( data_store=output_data_store, filename="data_package_topic/expected_package_topic.json") self.assertTrue(expected_package_topic_model is not None) expected_output_result = expected_package_topic_model.get_dictionary() self.assertTrue(expected_output_result is not None) self.assertDictEqual(output_result, expected_output_result) package_topic_model.save( data_store=output_data_store, filename="data_package_topic/package_topic.json")
def generate_and_save_gnosis_package_topic_model(input_data_store, output_data_store, additional_path): """Trains the package to topic map as well as topic to package map. :param input_data_store: source data store. :param output_data_store: destination data store. :param type: "curate" or "train". """ gnosis_package_topic_model_obj = GnosisPackageTopicModel.curate( data_store=input_data_store, filename=additional_path + GNOSIS_PTM_INPUT_PATH) gnosis_package_topic_model_obj.save(data_store=output_data_store, filename=additional_path + GNOSIS_PTM_OUTPUT_PATH) return None