Documentation ¶
Index ¶
- type Aspect
- type AspectBasedSentimentParams
- type AspectBasedSentimentResponse
- type Auth
- type Category
- type ClassifyByTaxonomyParams
- type ClassifyByTaxonomyResponse
- type ClassifyParams
- type ClassifyResponse
- type Client
- func (c *Client) AspectBasedSentiment(params *AspectBasedSentimentParams) (*AspectBasedSentimentResponse, error)
- func (c *Client) Classify(params *ClassifyParams) (*ClassifyResponse, error)
- func (c *Client) ClassifyByTaxonomy(params *ClassifyByTaxonomyParams) (*ClassifyByTaxonomyResponse, error)
- func (c *Client) Combined(params *CombinedParams) (*CombinedResponse, error)
- func (c *Client) Concepts(params *ConceptsParams) (*ConceptsResponse, error)
- func (c *Client) Elsa(params *ElsaParams) (*ElsaResponse, error)
- func (c *Client) Entities(params *EntitiesParams) (*EntitiesResponse, error)
- func (c *Client) Extract(params *ExtractParams) (*ExtractResponse, error)
- func (c *Client) Hashtags(params *HashtagsParams) (*HashtagsResponse, error)
- func (c *Client) ImageTags(params *ImageTagsParams) (*ImageTagsResponse, error)
- func (c *Client) Language(params *LanguageParams) (*LanguageResponse, error)
- func (c *Client) Sentiment(params *SentimentParams) (*SentimentResponse, error)
- func (c *Client) Summarize(params *SummarizeParams) (*SummarizeResponse, error)
- type CombinedParams
- type CombinedResponse
- type Concept
- type ConceptsParams
- type ConceptsResponse
- type DateTime
- type ElsaParams
- type ElsaResponse
- type EntitiesParams
- type EntitiesResponse
- type Entity
- type Error
- type ExtractParams
- type ExtractResponse
- type HashtagsParams
- type HashtagsResponse
- type ImageTag
- type ImageTagsParams
- type ImageTagsResponse
- type LanguageParams
- type LanguageResponse
- type Link
- type Mention
- type RateLimits
- type Sentiment
- type SentimentParams
- type SentimentResponse
- type SummarizeParams
- type SummarizeResponse
- type SurfaceForm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aspect ¶
type Aspect struct { Aspect string `json:"aspect"` AspectConfidence float32 `json:"aspect_confidence"` Polarity string `json:"polarity"` PolarityConfidence float32 `json:"polarity_confidence"` }
Aspect is the JSON description of an aspect.
type AspectBasedSentimentParams ¶
type AspectBasedSentimentParams struct { // Either URL or Text is required. Text string URL string // The domain that document belongs to. Domain string }
AspectBasedSentimentParams is the set of parameters that defines a document whose sentiment needs analysis.
type AspectBasedSentimentResponse ¶
type AspectBasedSentimentResponse struct { Text string `json:"text"` Domain string `json:"domain"` Aspects []Aspect `json:"aspects"` Sentences []struct { Text string `json:"text"` Polarity string `json:"polarity"` PolarityConfidence float32 `json:"polarity_confidence"` Aspects []Aspect `json:"aspects"` } `json:"sentences"` }
AspectBasedSentimentResponse is the JSON description of aspect based sentiment analysis.
type Auth ¶
type Auth struct { // ApplicationID and ApplicationKey identify the client using Text API. // These fields are always required ApplicationID string ApplicationKey string }
An Auth is an authentication token that will be used to authenticate client.
type Category ¶
type Category struct { // IPTC SubjectCode Code string `json:"code"` Label string `json:"label"` Confidence float32 `json:"confidence"` }
A Category is the JSON description of a classification category.
type ClassifyByTaxonomyParams ¶
type ClassifyByTaxonomyParams struct { // Either URL or Text is required. URL string Text string // Valid languages are en, de, fr, es, it, pt and auto. // Default is en. Language string // Valid taxonomies are iab-qag and iptc-subjectcode. Taxonomy string }
A ClassifyByTaxonomyParams is the set of parameters that defines a document whose needs to be classified according to a taxonomy.
type ClassifyByTaxonomyResponse ¶
type ClassifyByTaxonomyResponse struct { Text string `json:"text"` Language string `json:"language"` Taxonomy string `json:"taxonomy"` Categories []struct { Id string `json:"id"` Label string `json:"label"` Score float32 `json:"score"` Confident bool `json:"confident"` Links []struct { Link string `json:"link"` Rel string `json:"rel"` } `json:"links"` } `json:"categories"` }
A ClassifyByTaxonomyResponse is the JSON description of classification by taxonomy response.
type ClassifyParams ¶
type ClassifyParams struct { // Either URL or Text is required. URL string Text string // Valid languages are en, de, fr, es, it, pt and auto. // Default is en. Language string }
ClassifyParams is the set of parameters that defines a document whose classification needs to be calculated.
type ClassifyResponse ¶
type ClassifyResponse struct { Text string `json:"text"` Language string `json:"language"` Categories []Category `json:"categories"` }
A ClassifyResponse is the JSON description of classify response.
type Client ¶
type Client struct { RateLimits *RateLimits // contains filtered or unexported fields }
A Client can make calls to the Text API.
func NewClient ¶
NewClient returns a new client using the given auth information. To use HTTPS, pas useHttps = true.
func (*Client) AspectBasedSentiment ¶
func (c *Client) AspectBasedSentiment(params *AspectBasedSentimentParams) (*AspectBasedSentimentResponse, error)
AspectBasedSentiment given a review for a product or service, analyzes the sentiment of the review towards each of the aspects of the product or review that are mentioned in it.
func (*Client) Classify ¶
func (c *Client) Classify(params *ClassifyParams) (*ClassifyResponse, error)
Classify classifies the document defined by the given params information.
func (*Client) ClassifyByTaxonomy ¶
func (c *Client) ClassifyByTaxonomy(params *ClassifyByTaxonomyParams) (*ClassifyByTaxonomyResponse, error)
ClassifyByTaxonomy classifies the document defined by the given params information according to the specified taxonomy.
func (*Client) Combined ¶
func (c *Client) Combined(params *CombinedParams) (*CombinedResponse, error)
func (*Client) Concepts ¶
func (c *Client) Concepts(params *ConceptsParams) (*ConceptsResponse, error)
Concepts extracts concepts mentioned in the document defined by the given params information.
func (*Client) Elsa ¶ added in v0.6.0
func (c *Client) Elsa(params *ElsaParams) (*ElsaResponse, error)
Elsa extracts entities mentioned in the document defined by the given params information.
func (*Client) Entities ¶
func (c *Client) Entities(params *EntitiesParams) (*EntitiesResponse, error)
Entities extracts entities mentioned in the document defined by the given params information.
func (*Client) Extract ¶
func (c *Client) Extract(params *ExtractParams) (*ExtractResponse, error)
Extract extracts information from the web page defined by the given params information.
func (*Client) Hashtags ¶
func (c *Client) Hashtags(params *HashtagsParams) (*HashtagsResponse, error)
Hashtags calculates best hashtags describing the document defined by the given params information.
func (*Client) ImageTags ¶
func (c *Client) ImageTags(params *ImageTagsParams) (*ImageTagsResponse, error)
TagImage tags image defined by the given params information.
func (*Client) Language ¶
func (c *Client) Language(params *LanguageParams) (*LanguageResponse, error)
Language calculates the language in which the document defined by the given params information is written in.
func (*Client) Sentiment ¶
func (c *Client) Sentiment(params *SentimentParams) (*SentimentResponse, error)
Sentiment detects the sentiment of the document defined by the given params information. It detects the sentiment in terms of polarity (positive, negative or neutral). And in terms of subjectivity (subjective or objective).
func (*Client) Summarize ¶
func (c *Client) Summarize(params *SummarizeParams) (*SummarizeResponse, error)
Summarize summarizes the document defined by the given params information.
type CombinedParams ¶
type CombinedResponse ¶
type CombinedResponse struct { Text string Article ExtractResponse Summary SummarizeResponse Concepts ConceptsResponse Entities EntitiesResponse Language LanguageResponse Sentiment SentimentResponse Classifications ClassifyResponse }
func (*CombinedResponse) UnmarshalJSON ¶
func (c *CombinedResponse) UnmarshalJSON(data []byte) error
type Concept ¶
type Concept struct { SurfaceForms []SurfaceForm `json:"surfaceForms"` Types []string `json:"types"` Support int `json:"support"` }
A Concept is the JSON description of a concept in document.
type ConceptsParams ¶
type ConceptsParams struct { // Either URL or Text is required. URL string Text string // Valid languages are en, de, fr, es, it, pt and auto. // Default is en. Language string }
ConceptsParams is the set of parameters that defines a document whose concepts needs to be extracted.
type ConceptsResponse ¶
type ConceptsResponse struct { Text string `json:"text"` Language string `json:"language"` Concepts map[string]Concept `json:"concepts"` }
A ConceptsResponse is the JSON description of concept extraction response.
type DateTime ¶
DateTime embeds time.Time and acts as an alias for custom unmarshalling.
func (*DateTime) UnmarshalJSON ¶
Custom unmarshaller for time.Time which discards errors and will set the time to zero value in case parsing failed. Using time.Time.IsZero() is advised.
type ElsaParams ¶ added in v0.6.0
ElsaParams is the set of parameters that defines a document whose entities needs to be extracted.
type ElsaResponse ¶ added in v0.6.0
ElsaResponse is the JSON description of the elsa response.
type EntitiesParams ¶
EntitiesParams is the set of parameters that defines a document whose entities needs to be extracted.
type EntitiesResponse ¶
type EntitiesResponse struct { Text string `json:"text"` Entities map[string][]string `json:"entities"` }
A EntitiesResponse is the JSON description of entities extraction response.
type Entity ¶ added in v0.6.0
type Entity struct { Mentions []Mention `json:"mentions"` OverallSentiment Sentiment `json:"overall_sentiment"` Type string `json:"type"` Links []Link `json:"links"` }
Entity is the JSON description of an entity in response.
type Error ¶
type Error struct {
Message string `json:"error"`
}
An Error is the JSON response whenever an error occurs.
type ExtractParams ¶
type ExtractParams struct { // Either URL or HTML is required. URL string HTML string // Raw HTML of web page // Whether to extract the best image of the article. BestImage bool }
ExtractParams is the set of parameters that defines a web page whose data needs to be extracted.
type ExtractResponse ¶
type ExtractResponse struct { Title string `json:"title"` Article string `json:"article"` Image string `json:"image"` Author string `json:"author"` PublishDate DateTime `json:"publishDate"` Videos []string `json:"videos"` Feeds []string `json:"feeds"` Tags []string `json:"tags"` }
ExtractResponse is the JSON description of extract response.
type HashtagsParams ¶
type HashtagsParams struct { // Either URL or Text is required. // Default is en. Language string }
HashtagsParams is the set of parameters that defines a document whose hashtags need to be calculated.
type HashtagsResponse ¶
type HashtagsResponse struct {}
HashtagsResponse is the JSON description of a hashtags in a document.
type ImageTagsParams ¶
type ImageTagsParams struct {
URL string
}
ImageTagsParams defines the image whose tags needs to be calculated.
type ImageTagsResponse ¶
ImageTagsResponse is the JSON description of tag image response.
type LanguageParams ¶
LanguageParams is the set of parameters that defines a document whose language needs to be calculated.
type LanguageResponse ¶
type LanguageResponse struct { Text string `json:"text"` Language string `json:"lang"` Confidence float32 `json:"confidence"` }
LanguageResponse is the JSON description of language response.
type Link ¶ added in v0.6.0
type Link struct { URI string `json:"uri"` Provider string `json:"provider"` Types []string `json:"types"` Confidence float64 `json:"confidence"` }
Link is the JSON description of a Link entity in the response.
type Mention ¶ added in v0.6.0
type Mention struct { Offset int `json:"offset"` Confidence float64 `json:"confidence"` Text string `json:"text"` Sentiment Sentiment `json:sentiment` }
Mention is the JSON description of an entity mention in the response.
type RateLimits ¶
A RateLimits is the HTTP X-RateLimit-* headers of last response.
type Sentiment ¶ added in v0.6.0
Sentiment is the JSON description of sentiment values in the response
type SentimentParams ¶
type SentimentParams struct { // Either URL or Text is required. Text string URL string // Default is en. Language string // The analyze mode. // Valid option are tweet suitable for short text (default). // And document which is more suitable for longer bodies of text. Mode string }
SentimentParams is the set of parameters that defines a document whose sentiment needs analysis.
type SentimentResponse ¶
type SentimentResponse struct { Text string `json:"text"` Polarity string `json:"polarity"` PolarityConfidence float32 `json:"polarity_confidence"` Subjectivity string `json:"subjectivity"` SubjectivityConfidence float32 `json:"subjectivity_confidence"` }
SentimentResponse is the JSON description of sentiment analysis.
type SummarizeParams ¶
type SummarizeParams struct { // Either URL or a pair of Title and Text is required. URL string Text string Title string // Summarize mode // Valid options are default, and short. // short mode produces relatively shorter sentences. Mode string // Quantity of sentences in default mode. // Not applicable to short mode. NumberOfSentences int PercentageOfSentences int }
SummarizeParams is the set of parameters that defines a document whose needs to be summarized.
type SummarizeResponse ¶
SummarizeResponse is the JSON description of summarize response.
type SurfaceForm ¶
type SurfaceForm struct { String string `json:"string"` Score float32 `json:"score"` Offset int `json:"offset"` }
A SurfaceForm is the JSON description of a concept's surface form.