textanalytics

package
v12.1.1-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package textanalytics implements the Azure ARM Textanalytics service API version v2.0.

The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. No training data is needed to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserAgent

func UserAgent() string

UserAgent returns the UserAgent string to use when sending http.Requests.

func Version

func Version() string

Version returns the semantic version (see http://semver.org) of the client.

Types

type AzureRegions

type AzureRegions string

AzureRegions enumerates the values for azure regions.

const (
	// Australiaeast ...
	Australiaeast AzureRegions = "australiaeast"
	// Brazilsouth ...
	Brazilsouth AzureRegions = "brazilsouth"
	// Eastasia ...
	Eastasia AzureRegions = "eastasia"
	// Eastus ...
	Eastus AzureRegions = "eastus"
	// Eastus2 ...
	Eastus2 AzureRegions = "eastus2"
	// Northeurope ...
	Northeurope AzureRegions = "northeurope"
	// Southcentralus ...
	Southcentralus AzureRegions = "southcentralus"
	// Southeastasia ...
	Southeastasia AzureRegions = "southeastasia"
	// Westcentralus ...
	Westcentralus AzureRegions = "westcentralus"
	// Westeurope ...
	Westeurope AzureRegions = "westeurope"
	// Westus ...
	Westus AzureRegions = "westus"
	// Westus2 ...
	Westus2 AzureRegions = "westus2"
)

type BaseClient

type BaseClient struct {
	autorest.Client
	AzureRegion AzureRegions
}

BaseClient is the base client for Textanalytics.

func New

func New(azureRegion AzureRegions) BaseClient

New creates an instance of the BaseClient client.

func NewWithoutDefaults

func NewWithoutDefaults(azureRegion AzureRegions) BaseClient

NewWithoutDefaults creates an instance of the BaseClient client.

func (BaseClient) DetectLanguage

func (client BaseClient) DetectLanguage(ctx context.Context, input BatchInput) (result LanguageBatchResult, err error)

DetectLanguage scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported.

input is collection of documents to analyze.

func (BaseClient) DetectLanguagePreparer

func (client BaseClient) DetectLanguagePreparer(ctx context.Context, input BatchInput) (*http.Request, error)

DetectLanguagePreparer prepares the DetectLanguage request.

func (BaseClient) DetectLanguageResponder

func (client BaseClient) DetectLanguageResponder(resp *http.Response) (result LanguageBatchResult, err error)

DetectLanguageResponder handles the response to the DetectLanguage request. The method always closes the http.Response Body.

func (BaseClient) DetectLanguageSender

func (client BaseClient) DetectLanguageSender(req *http.Request) (*http.Response, error)

DetectLanguageSender sends the DetectLanguage request. The method will close the http.Response Body if it receives an error.

func (BaseClient) KeyPhrases

func (client BaseClient) KeyPhrases(ctx context.Context, input MultiLanguageBatchInput) (result KeyPhraseBatchResult, err error)

KeyPhrases we employ techniques from Microsoft Office's sophisticated Natural Language Processing toolkit. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction.

input is collection of documents to analyze. Documents can now contain a language field to indicate the text language

func (BaseClient) KeyPhrasesPreparer

func (client BaseClient) KeyPhrasesPreparer(ctx context.Context, input MultiLanguageBatchInput) (*http.Request, error)

KeyPhrasesPreparer prepares the KeyPhrases request.

func (BaseClient) KeyPhrasesResponder

func (client BaseClient) KeyPhrasesResponder(resp *http.Response) (result KeyPhraseBatchResult, err error)

KeyPhrasesResponder handles the response to the KeyPhrases request. The method always closes the http.Response Body.

func (BaseClient) KeyPhrasesSender

func (client BaseClient) KeyPhrasesSender(req *http.Request) (*http.Response, error)

KeyPhrasesSender sends the KeyPhrases request. The method will close the http.Response Body if it receives an error.

func (BaseClient) Sentiment

func (client BaseClient) Sentiment(ctx context.Context, input MultiLanguageBatchInput) (result SentimentBatchResult, err error)

Sentiment scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. Sentiment score is generated using classification techniques. The input features to the classifier include n-grams, features generated from part-of-speech tags, and word embeddings. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis.

input is collection of documents to analyze.

func (BaseClient) SentimentPreparer

func (client BaseClient) SentimentPreparer(ctx context.Context, input MultiLanguageBatchInput) (*http.Request, error)

SentimentPreparer prepares the Sentiment request.

func (BaseClient) SentimentResponder

func (client BaseClient) SentimentResponder(resp *http.Response) (result SentimentBatchResult, err error)

SentimentResponder handles the response to the Sentiment request. The method always closes the http.Response Body.

func (BaseClient) SentimentSender

func (client BaseClient) SentimentSender(req *http.Request) (*http.Response, error)

SentimentSender sends the Sentiment request. The method will close the http.Response Body if it receives an error.

type BatchInput

type BatchInput struct {
	Documents *[]Input `json:"documents,omitempty"`
}

BatchInput ...

type DetectedLanguage

type DetectedLanguage struct {
	// Name - Long name of a detected language (e.g. English, French).
	Name *string `json:"name,omitempty"`
	// Iso6391Name - A two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr).
	Iso6391Name *string `json:"iso6391Name,omitempty"`
	// Score - A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true.
	Score *float64 `json:"score,omitempty"`
}

DetectedLanguage ...

type ErrorRecord

type ErrorRecord struct {
	// ID - Input document unique identifier the error refers to.
	ID *string `json:"id,omitempty"`
	// Message - Error message.
	Message *string `json:"message,omitempty"`
}

ErrorRecord ...

type ErrorResponse

type ErrorResponse struct {
	Code       *string        `json:"code,omitempty"`
	Message    *string        `json:"message,omitempty"`
	Target     *string        `json:"target,omitempty"`
	InnerError *InternalError `json:"innerError,omitempty"`
}

ErrorResponse ...

type Input

type Input struct {
	// ID - Unique, non-empty document identifier.
	ID   *string `json:"id,omitempty"`
	Text *string `json:"text,omitempty"`
}

Input ...

type InternalError

type InternalError struct {
	Code       *string        `json:"code,omitempty"`
	Message    *string        `json:"message,omitempty"`
	InnerError *InternalError `json:"innerError,omitempty"`
}

InternalError ...

type KeyPhraseBatchResult

type KeyPhraseBatchResult struct {
	autorest.Response `json:"-"`
	Documents         *[]KeyPhraseBatchResultItem `json:"documents,omitempty"`
	Errors            *[]ErrorRecord              `json:"errors,omitempty"`
}

KeyPhraseBatchResult ...

type KeyPhraseBatchResultItem

type KeyPhraseBatchResultItem struct {
	// KeyPhrases - A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document.
	KeyPhrases *[]string `json:"keyPhrases,omitempty"`
	// ID - Unique document identifier.
	ID *string `json:"id,omitempty"`
}

KeyPhraseBatchResultItem ...

type LanguageBatchResult

type LanguageBatchResult struct {
	autorest.Response `json:"-"`
	Documents         *[]LanguageBatchResultItem `json:"documents,omitempty"`
	Errors            *[]ErrorRecord             `json:"errors,omitempty"`
}

LanguageBatchResult ...

type LanguageBatchResultItem

type LanguageBatchResultItem struct {
	// ID - Unique document identifier.
	ID *string `json:"id,omitempty"`
	// DetectedLanguages - A list of extracted languages.
	DetectedLanguages *[]DetectedLanguage `json:"detectedLanguages,omitempty"`
}

LanguageBatchResultItem ...

type MultiLanguageBatchInput

type MultiLanguageBatchInput struct {
	Documents *[]MultiLanguageInput `json:"documents,omitempty"`
}

MultiLanguageBatchInput ...

type MultiLanguageInput

type MultiLanguageInput struct {
	// Language - This is the 2 letter ISO 639-1 representation of a language. For example, use "en" for English; "es" for Spanish etc.,
	Language *string `json:"language,omitempty"`
	// ID - Unique, non-empty document identifier.
	ID   *string `json:"id,omitempty"`
	Text *string `json:"text,omitempty"`
}

MultiLanguageInput ...

type SentimentBatchResult

type SentimentBatchResult struct {
	autorest.Response `json:"-"`
	Documents         *[]SentimentBatchResultItem `json:"documents,omitempty"`
	Errors            *[]ErrorRecord              `json:"errors,omitempty"`
}

SentimentBatchResult ...

type SentimentBatchResultItem

type SentimentBatchResultItem struct {
	// Score - A decimal number between 0 and 1 denoting the sentiment of the document. A score above 0.7 usually refers to a positive document while a score below 0.3 normally has a negative connotation. Mid values refer to neutral text.
	Score *float64 `json:"score,omitempty"`
	// ID - Unique document identifier.
	ID *string `json:"id,omitempty"`
}

SentimentBatchResultItem ...

Jump to

Keyboard shortcuts

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