Skip to content

Commit cfa6301

Browse files
committed
feat(annotation-templates): add new NLP templates for multilabel classification, keyword extraction, and text summarization
1 parent 2f3ae21 commit cfa6301

File tree

1 file changed

+144
-2
lines changed

1 file changed

+144
-2
lines changed

scripts/db/data-annotation-init.sql

Lines changed: 144 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ INSERT INTO t_dm_annotation_templates (
192192
configuration, style, category, built_in, version, created_at
193193
) VALUES (
194194
'tpl-text-classification-001',
195-
'文本分类',
196-
'将文本划分到预定义的类别',
195+
'文本情感分类',
196+
'将文本中表达的情感划分到预定义的类别',
197197
'文本',
198198
'分类',
199199
JSON_OBJECT(
@@ -329,3 +329,145 @@ ON DUPLICATE KEY UPDATE
329329
version = VALUES(version),
330330
updated_at = NOW();
331331

332+
333+
-- 7. 文本多标签分类模板
334+
INSERT INTO t_dm_annotation_templates (
335+
id, name, description, data_type, labeling_type,
336+
configuration, style, category, built_in, version, created_at
337+
) VALUES (
338+
'tpl-text-multilabel-001',
339+
'文本多标签分类',
340+
'可为文本选择多个标签,适用于主题、内容类别等多标签任务',
341+
'文本',
342+
'分类',
343+
JSON_OBJECT(
344+
'labels', JSON_ARRAY(
345+
JSON_OBJECT(
346+
'fromName', 'labels',
347+
'toName', 'text',
348+
'type', 'Choices',
349+
'options', JSON_ARRAY('Sports','Politics','Tech','Entertainment'),
350+
'required', true,
351+
'choice', 'multiple',
352+
'description', '可选择多个标签'
353+
)
354+
),
355+
'objects', JSON_ARRAY(
356+
JSON_OBJECT(
357+
'name', 'text',
358+
'type', 'Text',
359+
'value', '$text'
360+
)
361+
)
362+
),
363+
'vertical',
364+
'自然语言处理',
365+
1,
366+
'1.0.0',
367+
NOW()
368+
)
369+
ON DUPLICATE KEY UPDATE
370+
name = VALUES(name),
371+
description = VALUES(description),
372+
data_type = VALUES(data_type),
373+
labeling_type = VALUES(labeling_type),
374+
configuration = VALUES(configuration),
375+
style = VALUES(style),
376+
category = VALUES(category),
377+
built_in = VALUES(built_in),
378+
version = VALUES(version),
379+
updated_at = NOW();
380+
381+
382+
-- 8. 文本摘要模板
383+
INSERT INTO t_dm_annotation_templates (
384+
id, name, description, data_type, labeling_type,
385+
configuration, style, category, built_in, version, created_at
386+
) VALUES (
387+
'tpl-text-summarization-001',
388+
'文本摘要',
389+
'根据原文撰写简要摘要',
390+
'文本',
391+
'摘要',
392+
JSON_OBJECT(
393+
'labels', JSON_ARRAY(
394+
JSON_OBJECT(
395+
'fromName', 'summary',
396+
'toName', 'text',
397+
'type', 'TextArea',
398+
'required', true,
399+
'description', '在此填写摘要内容'
400+
)
401+
),
402+
'objects', JSON_ARRAY(
403+
JSON_OBJECT(
404+
'name', 'text',
405+
'type', 'Text',
406+
'value', '$text'
407+
)
408+
)
409+
),
410+
'vertical',
411+
'自然语言处理',
412+
1,
413+
'1.0.0',
414+
NOW()
415+
)
416+
ON DUPLICATE KEY UPDATE
417+
name = VALUES(name),
418+
description = VALUES(description),
419+
data_type = VALUES(data_type),
420+
labeling_type = VALUES(labeling_type),
421+
configuration = VALUES(configuration),
422+
style = VALUES(style),
423+
category = VALUES(category),
424+
built_in = VALUES(built_in),
425+
version = VALUES(version),
426+
updated_at = NOW();
427+
428+
-- 9. 关键词抽取模板
429+
INSERT INTO t_dm_annotation_templates (
430+
id, name, description, data_type, labeling_type,
431+
configuration, style, category, built_in, version, created_at
432+
) VALUES (
433+
'tpl-keyword-extract-001',
434+
'关键词抽取',
435+
'从文本中选出关键词或关键短语',
436+
'文本',
437+
'实体识别',
438+
JSON_OBJECT(
439+
'labels', JSON_ARRAY(
440+
JSON_OBJECT(
441+
'fromName', 'kw',
442+
'toName', 'text',
443+
'type', 'Labels',
444+
'labels', JSON_ARRAY('Keyword'),
445+
'required', false,
446+
'description', '高亮文本并标注关键词'
447+
)
448+
),
449+
'objects', JSON_ARRAY(
450+
JSON_OBJECT(
451+
'name', 'text',
452+
'type', 'Text',
453+
'value', '$text'
454+
)
455+
)
456+
),
457+
'vertical',
458+
'自然语言处理',
459+
1,
460+
'1.0.0',
461+
NOW()
462+
)
463+
ON DUPLICATE KEY UPDATE
464+
name = VALUES(name),
465+
description = VALUES(description),
466+
data_type = VALUES(data_type),
467+
labeling_type = VALUES(labeling_type),
468+
configuration = VALUES(configuration),
469+
style = VALUES(style),
470+
category = VALUES(category),
471+
built_in = VALUES(built_in),
472+
version = VALUES(version),
473+
updated_at = NOW();

0 commit comments

Comments
 (0)