Databases-and-Informationsystems / api

Nlp Project Backend
1 stars 0 forks source link

A001: Requirements Recommendation Pipeline #7

Open L-Moritz opened 1 week ago

L-Moritz commented 1 week ago

Description

This issue aims to summarize the requirements for the recommendation pipelines. It is therefore not a requirement to be implemented

Open questions

Possible design

---
title: Process Annotation Pipeline Design
---
classDiagram
    Model <|-- ConcreteModel
    PipelineFactory --> Pipeline: creates
    Pipeline *--"n" PipelineStep: contains
    PipelineStep <|-- ConcretePipelineStep

    ConcretePipelineStep -->"1 model" ConcreteModel: works with
    AnnotatedDocument "n train_documents"<-- PipelineStep
    AnnotatedDocument "n test_documents"<-- PipelineStep
    Schema "1 schema"<-- PipelineStep

    PipelineStep -->"1 +step_type" PipelineStepType: has

    class PipelineFactory {
        createPipeline(settings): Pipeline$
        createPipelineStep(settings: any, stepType: PipelineStepType): Pipeline$
    }

    note for Pipeline "The Pipeline normally contains 4 Steps"
    class Pipeline {
        getPipelineSteps(): PipelineStep[]
    }

    class PipelineStep {
        <<abstract>>
        name()*
        run()*
        train(train_documents: AnnotatedDocument[], test_documents: AnnotatedDocument[])*
    }

    class PipelineStepType {
        <<enumeration>>
        Tokenizer,
        MentionPrediction,
        EntityPrediction,
        RelationPrediction,
    }

    class Model {
        <<abstract>>
        model_dir: string$
        abstract load()$
        train()
        predict()
    }

    class ConcreteModel {

    }

    class ConcretePipelineStep {

    }

    class Schema {
        id: string
        schemaMentions: SchemaMentions[]
        schemaRelations: SchemaRelations[]
        schemaConstraints: SchemaConstraints[]
    }

    class AnnotatedDocument {
        text: str,
        tokens: Token[]
        mentions: Mention[]
        entities: Entity[]
        relations: Relation[]
    }