def test_multiple_choice_a(self): multiwoz_data = multiwoz_utils.load_data( data_path=self._temp_dir, multiwoz_version='2.1', is_trade=True) schema_info = multiwoz_utils.load_schema(self._schema_file) # The testdata example doesn't have any categorical slots, so mock some. schema_info.slots_by_domain['train']['train-departure'] = ( multiwoz_utils.SlotInfo( is_categorical=True, possible_values=['leicester', 'cambridge'])) schema_info.slots_by_domain['train']['train-destination'] = ( multiwoz_utils.SlotInfo( is_categorical=True, possible_values=['leicester', 'cambridge'])) examples = create_multiwoz21_trade_schemaless_data.create_schemaless_data( multiwoz_data.train_json, schema_info, multiwoz_data.slot_descriptions, create_multiwoz21_trade_schemaless_data.Options( description_type='full_desc', delimiter=':', multiple_choice='a', use_active_domains_only=True, blocked_domains=set())) self.assertLen(examples, 7) self.assertEqual( examples[1].src, '0:departure location of the train a) leicester b) cambridge 1:arrival ' 'time of the train 2:number of people booking for train 3:leaving time ' 'for the train 4:day of the train a) sunday b) friday c) tuesday ' 'd) monday e) wednesday f) saturday g) thursday 5:destination of the ' 'train a) leicester b) cambridge [user] hi , can you help me find a ' 'train departing from cambridge ? [system] what is your destination ? ' '[user] i am going to leicester') self.assertEqual(examples[1].tgt, '[states] 0:b 5:a [intents] [req_slots]') self.assertEqual(examples[1].dialog_id, 'mul0708.json') self.assertEqual(examples[1].turn, 1)
def test_blocked_one_domain(self): multiwoz_data = multiwoz_utils.load_data( data_path=self._temp_dir, multiwoz_version='2.1', is_trade=True) schema_info = multiwoz_utils.load_schema(self._schema_file) # The testdata example doesn't have any categorical slots, so mock some. schema_info.slots_by_domain['train']['train-departure'] = ( multiwoz_utils.SlotInfo( is_categorical=True, possible_values=['leicester', 'cambridge'])) schema_info.slots_by_domain['train']['train-destination'] = ( multiwoz_utils.SlotInfo( is_categorical=True, possible_values=['leicester', 'cambridge'])) examples = create_multiwoz21_trade_schemaless_data.create_schemaless_data( multiwoz_data.train_json, schema_info, multiwoz_data.slot_descriptions, create_multiwoz21_trade_schemaless_data.Options( description_type='full_desc_with_domain', delimiter=':', multiple_choice='none', use_active_domains_only=False, blocked_domains=set(['hotel']))) self.assertLen(examples, 4) self.assertEqual( examples[1].src, '0:restaurant-area or place of the restaurant 1:bus-destination of bus ' '2:train-departure location of the train 3:restaurant-name of the ' 'restaurant 4:attraction-name of the attraction 5:bus-leaving time of ' 'bus 6:hotel-name of the hotel 7:restaurant-time of the restaurant ' 'booking 8:train-number of people booking for train 9:restaurant-food ' 'type for the restaurant 10:taxi-departure location of taxi 11:bus-day ' 'to use the bus tickets 12:train-day of the train 13:hotel-what is the ' 'type of the hotel 14:train-leaving time for the train 15:taxi-arrival ' 'time of taxi 16:hotel-length of stay at the hotel 17:train-arrival ' 'time of the train 18:taxi-leaving time of taxi 19:hotel-star rating ' 'of the hotel 20:hotel-number of people for the hotel booking ' '21:hotel-price budget of the hotel 22:hotel-parking facility at the ' 'hotel 23:hotel-internet option at the hotel 24:restaurant-day of the ' 'restaurant booking 25:attraction-type of the attraction ' '26:restaurant-price budget for the restaurant 27:hotel-area or place ' 'of the hotel 28:train-destination of the train 29:bus-departure ' 'location of bus 30:hospital-name of hospital department 31:hotel-day ' 'of the hotel booking 32:attraction-area or place of the attraction ' '33:restaurant-number of people booking the restaurant ' '34:taxi-destination of taxi [user] hi , can you help me find a train ' 'departing from cambridge ? [system] what is your destination ? [user] ' 'i am going to leicester') self.assertEqual(examples[1].tgt, '[states] 2:cambridge 28:leicester [intents] [req_slots]') self.assertEqual(examples[1].dialog_id, 'mul0708.json') self.assertEqual(examples[1].turn, 1)
def test_blocked_many_domains(self): multiwoz_data = multiwoz_utils.load_data( data_path=self._temp_dir, multiwoz_version='2.1', is_trade=True) schema_info = multiwoz_utils.load_schema(self._schema_file) # The testdata example doesn't have any categorical slots, so mock some. schema_info.slots_by_domain['train']['train-departure'] = ( multiwoz_utils.SlotInfo( is_categorical=True, possible_values=['leicester', 'cambridge'])) schema_info.slots_by_domain['train']['train-destination'] = ( multiwoz_utils.SlotInfo( is_categorical=True, possible_values=['leicester', 'cambridge'])) examples = create_multiwoz21_trade_schemaless_data.create_schemaless_data( multiwoz_data.train_json, schema_info, multiwoz_data.slot_descriptions, create_multiwoz21_trade_schemaless_data.Options( description_type='full_desc_with_domain', delimiter=':', multiple_choice='none', use_active_domains_only=False, blocked_domains=set(['hotel', 'train']))) self.assertEmpty(examples)