Browse Source

Implement data download for seq2seq

pull/10/head
Hironsan 6 years ago
parent
commit
85339acd44
1 changed files with 7 additions and 1 deletions
  1. 8
      app/server/models.py

8
app/server/models.py

@ -137,7 +137,7 @@ class Document(models.Model):
elif self.project.is_type_of(Project.SEQUENCE_LABELING):
return self.seq_annotations.all()
elif self.project.is_type_of(Project.Seq2seq):
return self.seq2seq_annotations.all()
return self.make_dataset_for_seq2seq()
def make_dataset_for_classification(self):
annotations = self.get_annotations()
@ -145,6 +145,12 @@ class Document(models.Model):
for a in annotations]
return dataset
def make_dataset_for_seq2seq(self):
annotations = self.get_annotations()
dataset = [[a.document.id, a.document.text, a.text, a.user.username]
for a in annotations]
return dataset
def __str__(self):
return self.text[:50]

Loading…
Cancel
Save