Back to

Package document

Latest Go to latest

The highest tagged major version is .

Published: Jul 28, 2019 | License: MIT | Module:


type Document

type Document struct {
	Hash     string     `json:"hash"`
	Content  string     `json:"content"`
	Segments []*Segment `json:"segments,omitempty"`

Document starts with Content which is then analyzed

func New

func New(ctx context.Context, from string, steps ...Step) (*Document, error)

New takes the input string for segmenting and runs all segments through the steps before returning the final document

type Keyword

type Keyword struct {
	Key   string  `json:"key"`
	Value float64 `json:"value"`

Keyword as found inside a Segment

type Segment

type Segment struct {
	Text     string     `json:"text"`
	Keywords []*Keyword `json:"keywords,omitempty"`

Segment of a Document

type Step

type Step func(Segment) (Segment, error)

Step taking a segment and returning updated segment or error

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier