Example #1
0
    def test_load_from_library(self, mock_open, mock_load_model,
                               mock_base_processor):

        self._setup_mock_load_model(mock_load_model)
        self._setup_mock_load_processor(mock_base_processor)

        # load default
        data_labeler = UnstructuredDataLabeler.load_from_library("default")

        self.assertDictEqual(data_labeler.label_mapping,
                             data_labeler_parameters["label_mapping"])
        self.assertListEqual(data_labeler.labels,
                             ["PAD", "UNKNOWN", "ADDRESS", "PERSON"])
        self.assertIsInstance(data_labeler.preprocessor,
                              data_processing.BaseDataPreprocessor)
        self.assertIsInstance(data_labeler.postprocessor,
                              data_processing.BaseDataPostprocessor)
Example #2
0
    def test_load_from_library(self, mock_open, mock_load_model,
                               mock_base_processor):

        self._setup_mock_load_model(mock_load_model)
        self._setup_mock_load_processor(mock_base_processor)

        # load default
        data_labeler = UnstructuredDataLabeler.load_from_library('default')

        self.assertDictEqual(data_labeler.label_mapping,
                             data_labeler_parameters['label_mapping'])
        self.assertListEqual(data_labeler.labels,
                             ['PAD', 'UNKNOWN', 'ADDRESS', 'PERSON'])
        self.assertIsInstance(data_labeler.preprocessor,
                              data_processing.BaseDataPreprocessor)
        self.assertIsInstance(data_labeler.postprocessor,
                              data_processing.BaseDataPostprocessor)