class Config(Task.Config): labels: ContextualIntentSlot.TargetConfig features: ContextualIntentSlot.ModelInputConfig = ( ContextualIntentSlot.ModelInputConfig()) model: ContextualIntentSlotModel.Config = ContextualIntentSlotModel.Config( ) trainer: Trainer.Config = Trainer.Config() data_handler: ContextualIntentSlotModelDataHandler.Config = ( ContextualIntentSlotModelDataHandler.Config()) metric_reporter: IntentSlotMetricReporter.Config = ( IntentSlotMetricReporter.Config())
def setUp(self): file_name = tests_module.test_file( "contextual_intent_slot_train_tiny.tsv") self.dh = ContextualIntentSlotModelDataHandler.from_config( ContextualIntentSlotModelDataHandler.Config(), ModelInputConfig(), [DocLabelConfig(), WordLabelConfig()], featurizer=SimpleFeaturizer(SimpleFeaturizer.Config(), ModelInputConfig()), ) self.data = self.dh.read_from_file(file_name, self.dh.raw_columns)
class Config(Task_Deprecated.Config): labels: ContextualIntentSlot.TargetConfig features: ContextualIntentSlot.ModelInputConfig = ( ContextualIntentSlot.ModelInputConfig()) model: ContextualIntentSlotModel.Config = ContextualIntentSlotModel.Config( ) trainer: Trainer.Config = Trainer.Config() data_handler: ContextualIntentSlotModelDataHandler.Config = ( ContextualIntentSlotModelDataHandler.Config()) metric_reporter: IntentSlotMetricReporter.Config = ( IntentSlotMetricReporter.Config()) exporter: Optional[DenseFeatureExporter.Config] = None
def test_read_file_with_dense_features(self): data_handler_config = ContextualIntentSlotModelDataHandler.Config() data_handler_config.columns_to_read.append(ModelInput.DENSE) dense_file_name = tests_module.test_file( "contextual_intent_slot_train_tiny_dense.tsv") data_handler = ContextualIntentSlotModelDataHandler.from_config( data_handler_config, ModelInputConfig(), [DocLabelConfig(), WordLabelConfig()], featurizer=SimpleFeaturizer(SimpleFeaturizer.Config(), ModelInputConfig()), ) dense_data = list( data_handler.read_from_file(dense_file_name, data_handler.raw_columns)) self.assertEqual(dense_data[0][ModelInput.DENSE], "[0,1,2,3,4]")