Browse Source

Add text file dataset to catalog

pull/1310/head
Hironsan 3 years ago
parent
commit
d418d6df5a
2 changed files with 9 additions and 0 deletions
  1. 8
      app/api/views/upload/catalog.py
  2. 1
      app/api/views/upload/factory.py

8
app/api/views/upload/catalog.py

@ -44,6 +44,11 @@ class Excel(Format):
accept_types = 'application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
class TextFile(Format):
name = 'TextFile'
accept_types = 'text/*'
class CoNLL(Format):
name = 'CoNLL'
accept_types = 'text/*'
@ -80,6 +85,7 @@ class Options:
# Text Classification
Options.register(DOCUMENT_CLASSIFICATION, TextFile, OptionNone)
Options.register(DOCUMENT_CLASSIFICATION, CSV, OptionDelimiter)
Options.register(DOCUMENT_CLASSIFICATION, FastText, OptionNone)
Options.register(DOCUMENT_CLASSIFICATION, JSON, OptionColumn)
@ -87,10 +93,12 @@ Options.register(DOCUMENT_CLASSIFICATION, JSONL, OptionColumn)
Options.register(DOCUMENT_CLASSIFICATION, Excel, OptionColumn)
# Sequence Labeling
Options.register(SEQUENCE_LABELING, TextFile, OptionNone)
Options.register(SEQUENCE_LABELING, JSONL, OptionColumn)
Options.register(SEQUENCE_LABELING, CoNLL, OptionNone)
# Sequence to sequence
Options.register(SEQ2SEQ, TextFile, OptionNone)
Options.register(SEQ2SEQ, CSV, OptionDelimiter)
Options.register(SEQ2SEQ, JSON, OptionColumn)
Options.register(SEQ2SEQ, JSONL, OptionColumn)

1
app/api/views/upload/factory.py

@ -12,6 +12,7 @@ def get_data_class(project_type: str):
def get_dataset_class(format: str):
mapping = {
catalog.TextFile.name: dataset.TextFileDataset,
catalog.CSV.name: dataset.CsvDataset,
catalog.JSONL.name: dataset.JSONLDataset,
catalog.JSON.name: dataset.JSONDataset,

Loading…
Cancel
Save