Browse Source

allow for uploading empty label

testcase for empty label
pull/861/head
Christian Gill 4 years ago
parent
commit
303f9851c4
2 changed files with 6 additions and 2 deletions
  1. 3
      app/api/tests/data/example.csv
  2. 5
      app/api/utils.py

3
app/api/tests/data/example.csv

@ -1,4 +1,5 @@
text,label,meta
AAA
BBB,Positive,The following is meta data
CCC,Negative
CCC,Negative
DDD,,This is meta data

5
app/api/utils.py

@ -392,7 +392,10 @@ class ExcelParser(FileParser):
datum = dict(zip(columns, row))
text, label = datum.pop('text'), datum.pop('label')
meta = FileParser.encode_metadata(datum)
j = {'text': text, 'labels': [label], 'meta': meta}
if label != '':
j = {'text': text, 'labels': [label], 'meta': meta}
else:
j = {'text': text, 'meta': meta}
data.append(j)
else:
raise FileParseException(line_num=i, line=row)

Loading…
Cancel
Save