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.

18 lines
454 B

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