ShutongFeng commited on
Commit
9b592da
1 Parent(s): 0315ca1

Update emowoz.py

Browse files

Improve usage: load EmoWOZ/MultiWOZ/DialMage at one go

Files changed (1) hide show
  1. emowoz.py +6 -13
emowoz.py CHANGED
@@ -91,15 +91,9 @@ class EmoWOZ(datasets.GeneratorBasedBuilder):
91
  # data = datasets.load_dataset('my_dataset', 'first_domain')
92
  # data = datasets.load_dataset('my_dataset', 'second_domain')
93
  BUILDER_CONFIGS = [
94
- datasets.BuilderConfig(name="train-all", version=VERSION, description="This part contains the training set of all user-emotion-annotated dialogues from EmoWOZ"),
95
- datasets.BuilderConfig(name="dev-all", version=VERSION, description="This part contains the development set of all user-emotion-annotated dialogues from EmoWOZ"),
96
- datasets.BuilderConfig(name="test-all", version=VERSION, description="This part contains the test set of all user-emotion-annotated dialogues from EmoWOZ"),
97
- datasets.BuilderConfig(name="train-multiwoz", version=VERSION, description="This part contains the training set of user-emotion-annotated dialogues from MultiWOZ"),
98
- datasets.BuilderConfig(name="dev-multiwoz", version=VERSION, description="This part contains the development set of user-emotion-annotated dialogues from MultiWOZ"),
99
- datasets.BuilderConfig(name="test-multiwoz", version=VERSION, description="This part contains the test set of user-emotion-annotated dialogues from MultiWOZ"),
100
- datasets.BuilderConfig(name="train-dialmage", version=VERSION, description="This part contains the training set of user-emotion-annotated dialogues from human-machine interaction (DialMAGE)"),
101
- datasets.BuilderConfig(name="dev-dialmage", version=VERSION, description="This part contains the development set of user-emotion-annotated dialogues from human-machine interaction (DialMAGE)"),
102
- datasets.BuilderConfig(name="test-dialmage", version=VERSION, description="This part contains the test set of user-emotion-annotated dialogues from human-machine interaction (DialMAGE)"),
103
  ]
104
 
105
  # DEFAULT_CONFIG_NAME = "first_domain" # It's not mandatory to have a default configuration. Just use one if it make sense.
@@ -182,13 +176,12 @@ class EmoWOZ(datasets.GeneratorBasedBuilder):
182
  with open(split_filepath, encoding="utf-8") as f:
183
  data_split = json.load(f)
184
 
185
- _, subset = self.config.name.split('-')
186
- if subset == 'all':
187
  dial_ids = data_split[split]['multiwoz'] + data_split[split]['dialmage']
188
  else:
189
- dial_ids = data_split[split][subset]
190
 
191
- # resolve the duplicate key in the training set of emowoz/data-split.json
192
  dial_ids = list(set(dial_ids))
193
 
194
  for key in dial_ids:
 
91
  # data = datasets.load_dataset('my_dataset', 'first_domain')
92
  # data = datasets.load_dataset('my_dataset', 'second_domain')
93
  BUILDER_CONFIGS = [
94
+ datasets.BuilderConfig(name="all", version=VERSION, description="This part contains all user-emotion-annotated dialogues from EmoWOZ"),
95
+ datasets.BuilderConfig(name="multiwoz", version=VERSION, description="This part contains all user-emotion-annotated dialogues from MultiWOZ"),
96
+ datasets.BuilderConfig(name="dialmage", version=VERSION, description="This part contains all user-emotion-annotated dialogues from human-machine interactions (DialMAGE)"),
 
 
 
 
 
 
97
  ]
98
 
99
  # DEFAULT_CONFIG_NAME = "first_domain" # It's not mandatory to have a default configuration. Just use one if it make sense.
 
176
  with open(split_filepath, encoding="utf-8") as f:
177
  data_split = json.load(f)
178
 
179
+ if self.config.name == 'all':
 
180
  dial_ids = data_split[split]['multiwoz'] + data_split[split]['dialmage']
181
  else:
182
+ dial_ids = data_split[split][self.config.name]
183
 
184
+ # resolve the one duplicate key in the training set of emowoz/data-split.json
185
  dial_ids = list(set(dial_ids))
186
 
187
  for key in dial_ids: