|
|
@ -19,6 +19,9 @@ export class ProjectReadItem { |
|
|
|
public tags: Object[], |
|
|
|
public is_text_project: boolean, |
|
|
|
public can_define_label: boolean, |
|
|
|
public can_define_relation: boolean, |
|
|
|
public can_define_span: boolean, |
|
|
|
public can_define_category: boolean, |
|
|
|
) {} |
|
|
|
|
|
|
|
static valueOf( |
|
|
@ -39,6 +42,9 @@ export class ProjectReadItem { |
|
|
|
tags, |
|
|
|
is_text_project, |
|
|
|
can_define_label, |
|
|
|
can_define_relation, |
|
|
|
can_define_span, |
|
|
|
can_define_category, |
|
|
|
}: |
|
|
|
{ |
|
|
|
id: number, |
|
|
@ -56,7 +62,10 @@ export class ProjectReadItem { |
|
|
|
grapheme_mode: boolean, |
|
|
|
tags: Object[], |
|
|
|
is_text_project: boolean, |
|
|
|
can_define_label: boolean |
|
|
|
can_define_label: boolean, |
|
|
|
can_define_relation: boolean, |
|
|
|
can_define_span: boolean, |
|
|
|
can_define_category: boolean |
|
|
|
} |
|
|
|
): ProjectReadItem { |
|
|
|
return new ProjectReadItem( |
|
|
@ -75,7 +84,10 @@ export class ProjectReadItem { |
|
|
|
grapheme_mode, |
|
|
|
tags, |
|
|
|
is_text_project, |
|
|
|
can_define_label |
|
|
|
can_define_label, |
|
|
|
can_define_relation, |
|
|
|
can_define_span, |
|
|
|
can_define_category |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
@ -97,10 +109,7 @@ export class ProjectReadItem { |
|
|
|
} |
|
|
|
|
|
|
|
get canDefineRelation() { |
|
|
|
const allowedProjectTypes = [ |
|
|
|
'SequenceLabeling' |
|
|
|
] |
|
|
|
return allowedProjectTypes.includes(this.project_type) |
|
|
|
return this.can_define_relation |
|
|
|
} |
|
|
|
|
|
|
|
get isTextProject() { |
|
|
@ -108,41 +117,11 @@ export class ProjectReadItem { |
|
|
|
} |
|
|
|
|
|
|
|
get hasCategory(): boolean { |
|
|
|
const allowedProjectTypes = [ |
|
|
|
'DocumentClassification', |
|
|
|
'IntentDetectionAndSlotFilling', |
|
|
|
'ImageClassification' |
|
|
|
] |
|
|
|
return allowedProjectTypes.includes(this.project_type) |
|
|
|
return this.can_define_category |
|
|
|
} |
|
|
|
|
|
|
|
get hasSpan(): boolean { |
|
|
|
const allowedProjectTypes = [ |
|
|
|
'IntentDetectionAndSlotFilling', |
|
|
|
'SequenceLabeling' |
|
|
|
] |
|
|
|
return allowedProjectTypes.includes(this.project_type) |
|
|
|
} |
|
|
|
|
|
|
|
toObject(): Object { |
|
|
|
return { |
|
|
|
id: this.id, |
|
|
|
name: this.name, |
|
|
|
description: this.description, |
|
|
|
guideline: this.guideline, |
|
|
|
users: this.users, |
|
|
|
project_type: this.project_type, |
|
|
|
updated_at: this.updated_at, |
|
|
|
random_order: this.random_order, |
|
|
|
collaborative_annotation: this.collaborative_annotation, |
|
|
|
single_class_classification: this.single_class_classification, |
|
|
|
resourcetype: this.resourcetype, |
|
|
|
allow_overlapping: this.allow_overlapping, |
|
|
|
grapheme_mode: this.grapheme_mode, |
|
|
|
tags: this.tags, |
|
|
|
is_text_project: this.is_text_project, |
|
|
|
can_define_label: this.can_define_label |
|
|
|
} |
|
|
|
return this.can_define_span |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|