You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
433 B

2 years ago
  1. from model_mommy import mommy
  2. from projects.models import DOCUMENT_CLASSIFICATION, SEQUENCE_LABELING, SEQ2SEQ, SPEECH2TEXT
  3. def make_annotation(task, doc, user, **kwargs):
  4. annotation_model = {
  5. DOCUMENT_CLASSIFICATION: "Category",
  6. SEQUENCE_LABELING: "Span",
  7. SEQ2SEQ: "TextLabel",
  8. SPEECH2TEXT: "TextLabel",
  9. }.get(task)
  10. return mommy.make(annotation_model, example=doc, user=user, **kwargs)