mirror of https://github.com/doccano/doccano.git
Hironsan
1 year ago
31 changed files with 228 additions and 338 deletions
Split View
Diff Options
-
8backend/auto_labeling/migrations/0003_fill_task_type.py
-
18backend/auto_labeling/tests/test_views.py
-
42backend/data_export/pipeline/catalog.py
-
49backend/data_export/pipeline/factories.py
-
25backend/data_export/tests/test_catalog.py
-
4backend/data_export/tests/test_labels.py
-
36backend/data_export/tests/test_task.py
-
4backend/data_export/tests/test_views.py
-
31backend/data_import/datasets.py
-
52backend/data_import/pipeline/catalog.py
-
19backend/data_import/tests/test_catalog.py
-
4backend/data_import/tests/test_examples.py
-
10backend/data_import/tests/test_label.py
-
4backend/data_import/tests/test_label_types.py
-
10backend/data_import/tests/test_labels.py
-
26backend/data_import/tests/test_tasks.py
-
4backend/data_import/tests/test_views.py
-
10backend/examples/tests/test_document.py
-
8backend/examples/tests/test_models.py
-
12backend/label_types/tests/test_views.py
-
7backend/label_types/tests/utils.py
-
4backend/labels/tests/test_category.py
-
4backend/labels/tests/test_relation.py
-
16backend/labels/tests/test_span.py
-
4backend/labels/tests/test_text_label.py
-
58backend/labels/tests/test_views.py
-
15backend/labels/tests/utils.py
-
10backend/metrics/tests.py
-
33backend/projects/models.py
-
7backend/projects/tests/test_project.py
-
32backend/projects/tests/utils.py
@ -1,33 +1,12 @@ |
|||
import unittest |
|||
|
|||
from ..pipeline.catalog import Options |
|||
from projects.models import ( |
|||
BOUNDING_BOX, |
|||
DOCUMENT_CLASSIFICATION, |
|||
IMAGE_CAPTIONING, |
|||
IMAGE_CLASSIFICATION, |
|||
INTENT_DETECTION_AND_SLOT_FILLING, |
|||
SEGMENTATION, |
|||
SEQ2SEQ, |
|||
SEQUENCE_LABELING, |
|||
SPEECH2TEXT, |
|||
) |
|||
from projects.models import ProjectType |
|||
|
|||
|
|||
class TestOptions(unittest.TestCase): |
|||
def test_return_at_least_one_option(self): |
|||
tasks = [ |
|||
BOUNDING_BOX, |
|||
DOCUMENT_CLASSIFICATION, |
|||
IMAGE_CAPTIONING, |
|||
IMAGE_CLASSIFICATION, |
|||
INTENT_DETECTION_AND_SLOT_FILLING, |
|||
SEGMENTATION, |
|||
SEQ2SEQ, |
|||
SEQUENCE_LABELING, |
|||
SPEECH2TEXT, |
|||
] |
|||
for task in tasks: |
|||
for task in ProjectType: |
|||
with self.subTest(task=task): |
|||
options = Options.filter_by_task(task) |
|||
self.assertGreaterEqual(len(options), 1) |
@ -1,27 +1,12 @@ |
|||
import unittest |
|||
|
|||
from data_import.pipeline.catalog import Options |
|||
from projects.models import ( |
|||
DOCUMENT_CLASSIFICATION, |
|||
IMAGE_CLASSIFICATION, |
|||
INTENT_DETECTION_AND_SLOT_FILLING, |
|||
SEQ2SEQ, |
|||
SEQUENCE_LABELING, |
|||
SPEECH2TEXT, |
|||
) |
|||
from projects.models import ProjectType |
|||
|
|||
|
|||
class TestOptions(unittest.TestCase): |
|||
def test_return_at_least_one_option(self): |
|||
tasks = [ |
|||
DOCUMENT_CLASSIFICATION, |
|||
IMAGE_CLASSIFICATION, |
|||
INTENT_DETECTION_AND_SLOT_FILLING, |
|||
SEQ2SEQ, |
|||
SEQUENCE_LABELING, |
|||
SPEECH2TEXT, |
|||
] |
|||
for task in tasks: |
|||
for task in ProjectType: |
|||
with self.subTest(task=task): |
|||
options = Options.filter_by_task(task) |
|||
self.assertGreaterEqual(len(options), 1) |
@ -1,10 +1,13 @@ |
|||
from model_mommy import mommy |
|||
|
|||
from projects.models import BOUNDING_BOX, SEGMENTATION |
|||
from projects.models import ProjectType |
|||
|
|||
|
|||
def make_label(project, **kwargs): |
|||
if project.project_type.endswith("Classification") or project.project_type in {BOUNDING_BOX, SEGMENTATION}: |
|||
if project.project_type.endswith("Classification") or project.project_type in { |
|||
ProjectType.BOUNDING_BOX, |
|||
ProjectType.SEGMENTATION, |
|||
}: |
|||
return mommy.make("CategoryType", project=project, **kwargs) |
|||
else: |
|||
return mommy.make("SpanType", project=project, **kwargs) |
@ -1,18 +1,13 @@ |
|||
from model_mommy import mommy |
|||
|
|||
from projects.models import ( |
|||
DOCUMENT_CLASSIFICATION, |
|||
SEQ2SEQ, |
|||
SEQUENCE_LABELING, |
|||
SPEECH2TEXT, |
|||
) |
|||
from projects.models import ProjectType |
|||
|
|||
|
|||
def make_annotation(task, doc, user, **kwargs): |
|||
annotation_model = { |
|||
DOCUMENT_CLASSIFICATION: "Category", |
|||
SEQUENCE_LABELING: "Span", |
|||
SEQ2SEQ: "TextLabel", |
|||
SPEECH2TEXT: "TextLabel", |
|||
ProjectType.DOCUMENT_CLASSIFICATION: "Category", |
|||
ProjectType.SEQUENCE_LABELING: "Span", |
|||
ProjectType.SEQ2SEQ: "TextLabel", |
|||
ProjectType.SPEECH2TEXT: "TextLabel", |
|||
}.get(task) |
|||
return mommy.make(annotation_model, example=doc, user=user, **kwargs) |
Write
Preview
Loading…
Cancel
Save