|
|
@ -45,6 +45,11 @@ class Project(PolymorphicModel): |
|
|
|
def is_text_project(self) -> bool: |
|
|
|
return False |
|
|
|
|
|
|
|
@property |
|
|
|
@abc.abstractmethod |
|
|
|
def can_define_label(self) -> bool: |
|
|
|
return False |
|
|
|
|
|
|
|
def __str__(self): |
|
|
|
return self.name |
|
|
|
|
|
|
@ -55,6 +60,10 @@ class TextClassificationProject(Project): |
|
|
|
def is_text_project(self) -> bool: |
|
|
|
return True |
|
|
|
|
|
|
|
@property |
|
|
|
def can_define_label(self) -> bool: |
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
class SequenceLabelingProject(Project): |
|
|
|
allow_overlapping = models.BooleanField(default=False) |
|
|
@ -64,6 +73,10 @@ class SequenceLabelingProject(Project): |
|
|
|
def is_text_project(self) -> bool: |
|
|
|
return True |
|
|
|
|
|
|
|
@property |
|
|
|
def can_define_label(self) -> bool: |
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
class Seq2seqProject(Project): |
|
|
|
|
|
|
@ -71,6 +84,10 @@ class Seq2seqProject(Project): |
|
|
|
def is_text_project(self) -> bool: |
|
|
|
return True |
|
|
|
|
|
|
|
@property |
|
|
|
def can_define_label(self) -> bool: |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
class IntentDetectionAndSlotFillingProject(Project): |
|
|
|
|
|
|
@ -78,6 +95,10 @@ class IntentDetectionAndSlotFillingProject(Project): |
|
|
|
def is_text_project(self) -> bool: |
|
|
|
return True |
|
|
|
|
|
|
|
@property |
|
|
|
def can_define_label(self) -> bool: |
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
class Speech2textProject(Project): |
|
|
|
|
|
|
@ -85,6 +106,10 @@ class Speech2textProject(Project): |
|
|
|
def is_text_project(self) -> bool: |
|
|
|
return False |
|
|
|
|
|
|
|
@property |
|
|
|
def can_define_label(self) -> bool: |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
class ImageClassificationProject(Project): |
|
|
|
|
|
|
@ -92,6 +117,10 @@ class ImageClassificationProject(Project): |
|
|
|
def is_text_project(self) -> bool: |
|
|
|
return False |
|
|
|
|
|
|
|
@property |
|
|
|
def can_define_label(self) -> bool: |
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
def generate_random_hex_color(): |
|
|
|
return f'#{random.randint(0, 0xFFFFFF):06x}' |
|
|
|