Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotSegmented = errors.New("document not segmented")
ErrNotSegmented .
Functions ¶
This section is empty.
Types ¶
type Accessor ¶
Accessor stores a Linker instance and it's access information It is a helper type for working with pooled linkers
type Edge ¶
type Edge struct { Source *Node `json:"source"` Target *Node `json:"target"` Weight float32 `json:"weight"` // contains filtered or unexported fields }
Edge between two nodes
type InstanceCreator ¶
InstanceCreator defines the function called to initialize new Linkers
type Linker ¶
type Linker interface { Run(context.Context) error InsertDocument(ctx context.Context, doc *document.Document) error ListDocuments(ctx context.Context) []*document.Document ListLinks(ctx context.Context) []*Edge }
Linker stores all documents and compares them for building a link matrix
type Metadata ¶
type Metadata struct { ID string `json:"id"` Rater string `json:"rater"` Threshold float32 `json:"threshold"` }
Metadata for storing linker settings
type Node ¶
type Node struct { Doc string `json:"doc"` Seg int `json:"seg"` // contains filtered or unexported fields }
Node in the link graph
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool offers management for multiple linker instances It takes care of creating new ones and accessing existing ones
func New ¶
func New(ctx context.Context, storageManager StorageManager, creator InstanceCreator) *Pool
New initializes the pool and prepares for storing instances
func (*Pool) Create ¶
Create new linker, store it in the pool and start running it's background process
type Storage ¶
type Storage interface { SetMetadata(ctx context.Context, meta *Metadata) Metadata(ctx context.Context) (*Metadata, error) InsertDocument(ctx context.Context, doc *document.Document) InsertSegment(ctx context.Context, doc *Segment) InsertLink(ctx context.Context, doc *Edge) Documents(ctx context.Context) (map[string]*document.Document, error) Segments(ctx context.Context) (map[string]*Segment, error) Links(ctx context.Context) (map[string]*Edge, error) }
Storage defines the minimal interface for a linker persistence layer