sentences

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	http.Stack
	// contains filtered or unexported fields
}

Client for reading/writing natural language text and searching for nearest neighbor.

func New

func New(stack http.Stack, host string) *Client

Creates the client for reading/writing natural language text and searching for nearest neighbor.

func (*Client) Query

func (api *Client) Query(ctx context.Context, cask curie.IRI, q Query) (*Result, error)

Query nearest neighbor text to the given sample.

func (*Client) Write

func (api *Client) Write(ctx context.Context, cask curie.IRI, bag []Sentence) error

Write the sentence

type Hit

type Hit struct {
	Sentence
	Rank float32 `json:"rank,omitempty"`
}

type Query

type Query struct {
	K        int     `json:"k,omitempty"`
	EfSearch int     `json:"efSearch,omitempty"`
	Distance float32 `json:"distance,omitempty"`
	Text     string  `json:"text"`
}

Query textual corpus

type Result

type Result struct {
	Took   time.Duration  `json:"took,omitempty"`
	Source optimum.Source `json:"source,omitempty"`
	Hits   []Hit          `json:"hits,omitempty"`
}

Results from the query

type Sentence

type Sentence struct {
	// Short text block.
	Text schemaorg.Text `json:"text,omitempty"`

	// URL of the original CreativeWork from which this text block is derived.
	IsPartOf schemaorg.IsPartOf `json:"isPartOf,omitempty"`

	// Headline(s) of the text block.
	Headline []schemaorg.Headline `json:"headline,omitempty"`

	// Relevant Keywords for the text block.
	Keywords []schemaorg.Keywords `json:"keywords,omitempty"`

	// External URIs associated with the text block.
	//
	// The purpose lacks a defined product type for representing the URI and its
	// human-readable format. The client selects own format.
	//
	// We recommend:
	//	- URIs with Fragments is recommended to represent url and human readable name
	//	<http://example.com/article123#An_Example_Article>
	//
	//	- Markdown format
	//	[An Example Article](http://example.com/article123)
	//
	//	- HTML Anchor Tag
	//	<a href="http://example.com/article123">An Example Article</a>
	//
	//	- URI with Label Convention (RDF-style text)
	//	<http://example.com/article123> "An Example Article"
	Links []schemaorg.RelatedLink `json:"links,omitempty"`
}

Sentence defines textual content

type Writer

type Writer struct {
	http.Stack
	// contains filtered or unexported fields
}

Client for streaming to Graph-based Nearest Neighbor Search Algorithms

func NewWriter

func NewWriter(stack http.Stack, host string, cask curie.IRI, chunk int) *Writer

Creates the client for streaming to Graph-based Nearest Neighbor Search Algorithms

func (*Writer) Sync

func (stream *Writer) Sync(ctx context.Context) (err error)

Sync local cache

func (*Writer) Write

func (stream *Writer) Write(ctx context.Context, v Sentence) error

Write vector

Jump to

Keyboard shortcuts

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