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
428 B

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