rbawden commited on
Commit
3d4cc61
1 Parent(s): 82a987c

Update DiaBLa.py

Browse files
Files changed (1) hide show
  1. DiaBLa.py +49 -43
DiaBLa.py CHANGED
@@ -50,9 +50,9 @@ class Diabla(datasets.GeneratorBasedBuilder):
50
 
51
  BUILDER_CONFIGS = [
52
  DiablaConfig(
53
- name="plain_text",
54
- version=datasets.Version("1.0.0", ""),
55
- description="Plain text",
56
  ),
57
  ]
58
 
@@ -62,11 +62,11 @@ class Diabla(datasets.GeneratorBasedBuilder):
62
  description=_DESCRIPTION,
63
  features=datasets.Features(
64
  {
65
- 'id': datasets.Value("string"),
66
- 'orig': datasets.Value("string"),
67
- 'norm': datasets.Value("string"),
68
- 'mt': datasets.Value("string"),
69
- 'ref': datasets.Value("string"),
70
  'utterance_meta': datasets.features.Sequence(
71
  {
72
  'eval-judgment': ClassLabel(num_classes=3, names=['poor', 'medium', 'perfect']),
@@ -81,19 +81,27 @@ class Diabla(datasets.GeneratorBasedBuilder):
81
  ),
82
  'dialogue_meta': datasets.features.Sequence(
83
  {
84
- 'start_time': datasets.Value("string"),
85
- 'end_time' : datasets.Value("string"),
86
- 'translation_model': datasets.Value("string"),
87
  'final_evaluation_user1': datasets.features.Sequence(
88
  {
89
- "style": ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent']),
90
- "coherence": ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent']),
91
- "grammaticality": ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent']),
92
- "meaning": ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent']),
93
- "word_choice": ClassLabel(num_classes=3, names=['poor', 'average', 'good',
94
- },
95
-
96
- 'final_evaluation_user2': datasets.Value("string"),
 
 
 
 
 
 
 
 
97
  'scenario': datasets.features.Sequence(
98
  [
99
  [
@@ -103,20 +111,20 @@ class Diabla(datasets.GeneratorBasedBuilder):
103
  ),
104
  'user1': datasets.features.Sequence(
105
  {
106
- 'rolenum': datasets.Value("int64"),
107
- 'role': datasets.Value("string"),
108
- 'initiated_dialogue': datasets.Value("bool"),
109
- 'turn_number': datasets.Value("int64"),
110
- 'lang': datasets.Value("string"),
111
  }
112
  ),
113
  'user2': datasets.features.Sequence(
114
  {
115
- 'rolenum': datasets.Value("int64"),
116
- 'role': datasets.Value("string"),
117
- 'initiated_dialogue': datasets.Value("bool"),
118
- 'turn_number': datasets.Value("int64"),
119
- 'lang': datasets.Value("string"),
120
  }
121
  )
122
  }
@@ -125,11 +133,11 @@ class Diabla(datasets.GeneratorBasedBuilder):
125
  [
126
  datasets.features.Sequence(
127
  {
128
- 'id': datasets.Value("string"),
129
- 'orig': datasets.Value("string"),
130
- 'norm': datasets.Value("string"),
131
- 'mt': datasets.Value("string"),
132
- 'ref': datasets.Value("string"),
133
  'utterance_meta': datasets.features.Sequence(
134
  {
135
  'judgment': ClassLabel(num_classes=3, names=['poor', 'medium', 'perfect']),
@@ -182,6 +190,12 @@ class Diabla(datasets.GeneratorBasedBuilder):
182
  dialogue_info = {k: dialogue[k] for k in dialogue_info_keys}
183
  if dialogue_info['end_time'] is None:
184
  dialogue_info['end_time'] = ''
 
 
 
 
 
 
185
  # Main data: the utterances
186
  for utterance_id in dialogue['utterances']:
187
  utterance = dialogue['utterances'][utterance_id]
@@ -205,15 +219,7 @@ class Diabla(datasets.GeneratorBasedBuilder):
205
  'ref': reference_text,
206
  'utterance_meta': utterance_info
207
  }
208
- "interface": "",
209
- "verbatim_quality": datasets.Value("string"),
210
-
211
- "particular_problems": "",
212
- "tech": "There were no technical problems",
213
- "would_use": false,
214
- "timestamp": "2018-05-18T17:11:39.104833",
215
-
216
- "technical_issue": "There were no technical problems"
217
  # add to history (without dialogue info and history)
218
  dialogue_history.append(utterance_instance.copy())
219
  utterance_instance['dialogue_meta'] = dialogue_info
 
50
 
51
  BUILDER_CONFIGS = [
52
  DiablaConfig(
53
+ name='plain_text',
54
+ version=datasets.Version('1.0.0", ''),
55
+ description='Plain text',
56
  ),
57
  ]
58
 
 
62
  description=_DESCRIPTION,
63
  features=datasets.Features(
64
  {
65
+ 'id': datasets.Value('string'),
66
+ 'orig': datasets.Value('string'),
67
+ 'norm': datasets.Value('string'),
68
+ 'mt': datasets.Value('string'),
69
+ 'ref': datasets.Value('string'),
70
  'utterance_meta': datasets.features.Sequence(
71
  {
72
  'eval-judgment': ClassLabel(num_classes=3, names=['poor', 'medium', 'perfect']),
 
81
  ),
82
  'dialogue_meta': datasets.features.Sequence(
83
  {
84
+ 'start_time': datasets.Value('string'),
85
+ 'end_time' : datasets.Value('string'),
86
+ 'translation_model': datasets.Value('string'),
87
  'final_evaluation_user1': datasets.features.Sequence(
88
  {
89
+ 'style': ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent']),
90
+ 'coherence': ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent']),
91
+ 'grammaticality': ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent']),
92
+ 'meaning': ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent']),
93
+ 'word_choice': ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent'])
94
+ }
95
+ ),
96
+ 'final_evaluation_user2': datasets.features.Sequence(
97
+ {
98
+ 'style': ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent']),
99
+ 'coherence': ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent']),
100
+ 'grammaticality': ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent']),
101
+ 'meaning': ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent']),
102
+ 'word_choice': ClassLabel(num_classes=3, names=['poor', 'average', 'good', 'excellent'])
103
+ }
104
+ ),
105
  'scenario': datasets.features.Sequence(
106
  [
107
  [
 
111
  ),
112
  'user1': datasets.features.Sequence(
113
  {
114
+ 'rolenum': datasets.Value('int64'),
115
+ 'role': datasets.Value('string'),
116
+ 'initiated_dialogue': datasets.Value('bool'),
117
+ 'turn_number': datasets.Value('int64'),
118
+ 'lang': datasets.Value('string'),
119
  }
120
  ),
121
  'user2': datasets.features.Sequence(
122
  {
123
+ 'rolenum': datasets.Value('int64'),
124
+ 'role': datasets.Value('string'),
125
+ 'initiated_dialogue': datasets.Value('bool'),
126
+ 'turn_number': datasets.Value('int64'),
127
+ 'lang': datasets.Value('string'),
128
  }
129
  )
130
  }
 
133
  [
134
  datasets.features.Sequence(
135
  {
136
+ 'id': datasets.Value('string'),
137
+ 'orig': datasets.Value('string'),
138
+ 'norm': datasets.Value('string'),
139
+ 'mt': datasets.Value('string'),
140
+ 'ref': datasets.Value('string'),
141
  'utterance_meta': datasets.features.Sequence(
142
  {
143
  'judgment': ClassLabel(num_classes=3, names=['poor', 'medium', 'perfect']),
 
190
  dialogue_info = {k: dialogue[k] for k in dialogue_info_keys}
191
  if dialogue_info['end_time'] is None:
192
  dialogue_info['end_time'] = ''
193
+ for info_to_remove in ['interface','verbatim_quality',
194
+ 'particular_problems', 'tech',
195
+ 'would_use', 'timestamp', 'technical_issue']:
196
+ del dialogue_info['final_evaluation_user1'][info_to_remove]
197
+ del dialogue_info['final_evaluation_user2'][info_to_remove]
198
+
199
  # Main data: the utterances
200
  for utterance_id in dialogue['utterances']:
201
  utterance = dialogue['utterances'][utterance_id]
 
219
  'ref': reference_text,
220
  'utterance_meta': utterance_info
221
  }
222
+
 
 
 
 
 
 
 
 
223
  # add to history (without dialogue info and history)
224
  dialogue_history.append(utterance_instance.copy())
225
  utterance_instance['dialogue_meta'] = dialogue_info