textbox

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Overview

Package textbox provides a client for accessing Textbox services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analysis

type Analysis struct {
	Sentences []Sentence `json:"sentences"`
	Keywords  []Keyword  `json:"keywords"`
}

Analysis represents an analysis of text.

type Client

type Client struct {

	// HTTPClient is the http.Client that will be used to
	// make requests.
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client is an HTTP client that can make requests to the box.

func New

func New(addr string) *Client

New makes a new Client.

func (*Client) Check

func (c *Client) Check(r io.Reader) (*Analysis, error)

Check passes the text from the Reader to Textbox for analysis.

func (*Client) Info

func (c *Client) Info() (*boxutil.Info, error)

Info gets the details about the box.

type Entity

type Entity struct {
	// Type is a string describing the kind of entity.
	Type string `json:"type"`
	// Text is the text of the entity.
	Text string `json:"text"`
	// Start is the absolute start position of the entity (in the original text).
	Start int `json:"start"`
	// Start is the absolute end position of the entity (in the original text).
	End int `json:"end"`
}

Entity represents an entity discovered in the text.

type Keyword

type Keyword struct {
	Keyword string `json:"keyword"`
}

Keyword represents a key word.

type Sentence

type Sentence struct {
	// Text is the text of the sentence.
	Text string `json:"text"`
	// Start is the absolute start position of the sentence (in the original text).
	Start int `json:"start"`
	// Start is the absolute end position of the sentence (in the original text).
	End int `json:"end"`
	// Sentiment is a probability score (between 0 and 1) of the sentiment of the sentence;
	// higher is more positive, lower is more negative.
	Sentiment float64 `json:"sentiment"`
	// Entities represents entities discovered in the text.
	Entities []Entity `json:"entities"`
}

Sentence represents a single sentence of text.

Jump to

Keyboard shortcuts

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