From c51d600a3d51c2eb38281b21dda14de4b19d132d Mon Sep 17 00:00:00 2001 From: Hironsan Date: Wed, 22 Dec 2021 13:55:09 +0900 Subject: [PATCH] Add a project for intent detection and slot filling --- .../api/migrations/0025_auto_20211222_0454.py | 30 +++++++++++++++++++ backend/api/models.py | 8 +++++ 2 files changed, 38 insertions(+) create mode 100644 backend/api/migrations/0025_auto_20211222_0454.py diff --git a/backend/api/migrations/0025_auto_20211222_0454.py b/backend/api/migrations/0025_auto_20211222_0454.py new file mode 100644 index 00000000..f11a7671 --- /dev/null +++ b/backend/api/migrations/0025_auto_20211222_0454.py @@ -0,0 +1,30 @@ +# Generated by Django 3.2.8 on 2021-12-22 04:54 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0024_auto_20211221_1444'), + ] + + operations = [ + migrations.CreateModel( + name='IntentDetectionAndSlotFillingProject', + fields=[ + ('project_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='api.project')), + ], + options={ + 'abstract': False, + 'base_manager_name': 'objects', + }, + bases=('api.project',), + ), + migrations.AlterField( + model_name='project', + name='project_type', + field=models.CharField(choices=[('DocumentClassification', 'document classification'), ('SequenceLabeling', 'sequence labeling'), ('Seq2seq', 'sequence to sequence'), ('IntentDetectionAndSlotFilling', 'intent detection and slot filling'), ('Speech2text', 'speech to text'), ('ImageClassification', 'image classification')], max_length=30), + ), + ] diff --git a/backend/api/models.py b/backend/api/models.py index 50c6f6d4..3528d562 100644 --- a/backend/api/models.py +++ b/backend/api/models.py @@ -17,10 +17,12 @@ SEQUENCE_LABELING = 'SequenceLabeling' SEQ2SEQ = 'Seq2seq' SPEECH2TEXT = 'Speech2text' IMAGE_CLASSIFICATION = 'ImageClassification' +INTENT_DETECTION_AND_SLOT_FILLING = 'IntentDetectionAndSlotFilling' PROJECT_CHOICES = ( (DOCUMENT_CLASSIFICATION, 'document classification'), (SEQUENCE_LABELING, 'sequence labeling'), (SEQ2SEQ, 'sequence to sequence'), + (INTENT_DETECTION_AND_SLOT_FILLING, 'intent detection and slot filling'), (SPEECH2TEXT, 'speech to text'), (IMAGE_CLASSIFICATION, 'image classification') ) @@ -65,6 +67,12 @@ class Seq2seqProject(Project): return task == 'text' +class IntentDetectionAndSlotFillingProject(Project): + + def is_task_of(self, task: Literal['text', 'image', 'speech']): + return task == 'text' + + class Speech2textProject(Project): def is_task_of(self, task: Literal['text', 'image', 'speech']):