extract

package
v0.10.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package extract provides the wire contract and interface for an extraction sidecar.

Index

Constants

View Source
const Path = "/extract"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an HTTP client for the extraction sidecar.

func NewClient

func NewClient(baseURL string) *Client

NewClient creates a new extraction client.

func (*Client) Extract

func (c *Client) Extract(ctx context.Context, req Request) ([]Span, error)

Extract calls the extraction sidecar.

type Extractor

type Extractor interface {
	Extract(ctx context.Context, req Request) ([]Span, error)
}

Extractor can extract entities from text.

type Request

type Request struct {
	Text      string   `json:"text"`
	Labels    []string `json:"labels"`
	Threshold float64  `json:"threshold"`
}

Request is the wire format for an extraction request.

type Span

type Span struct {
	Text  string  `json:"text"`
	Label string  `json:"label"`
	Start int     `json:"start"`
	End   int     `json:"end"`
	Score float64 `json:"score"`
}

Span is a single extracted entity.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL