Browse Source

Add factories for exporting relation data

pull/1703/head
Hironsan 2 years ago
parent
commit
a0538d105d
1 changed files with 3 additions and 0 deletions
  1. 3
      backend/data_export/pipeline/factories.py

3
backend/data_export/pipeline/factories.py

@ -12,6 +12,8 @@ from projects.models import (
def create_repository(project): def create_repository(project):
if getattr(project, "use_relation", False):
return repositories.RelationExtractionRepository(project)
mapping = { mapping = {
DOCUMENT_CLASSIFICATION: repositories.TextClassificationRepository, DOCUMENT_CLASSIFICATION: repositories.TextClassificationRepository,
SEQUENCE_LABELING: repositories.SequenceLabelingRepository, SEQUENCE_LABELING: repositories.SequenceLabelingRepository,
@ -33,6 +35,7 @@ def create_writer(file_format: str) -> Type[writers.BaseWriter]:
catalog.JSONL.name: writers.JSONLWriter, catalog.JSONL.name: writers.JSONLWriter,
catalog.FastText.name: writers.FastTextWriter, catalog.FastText.name: writers.FastTextWriter,
catalog.IntentAndSlot.name: writers.IntentAndSlotWriter, catalog.IntentAndSlot.name: writers.IntentAndSlotWriter,
catalog.JSONLRelation.name: writers.EntityAndRelationWriter,
} }
if file_format not in mapping: if file_format not in mapping:
ValueError(f"Invalid format: {file_format}") ValueError(f"Invalid format: {file_format}")

Loading…
Cancel
Save