Documentation ¶
Index ¶
- Constants
- func ParseJobID(jobLocation string) (string, error)
- type AbstractiveSummarizationResult
- type AbstractiveSummarizationTaskParameters
- type AbstractiveSummary
- type AbstractiveSummaryDocumentResult
- type Client
- type DetectedLanguage
- type DocumentError
- type DocumentWarning
- type EntitiesResult
- type EntitiesTaskParameters
- type Entity
- type EntityRecognizedDocument
- type ErrorInformation
- type ErrorResponse
- type ExtractedSummaryDocumentResult
- type ExtractedSummarySentence
- type ExtractiveSummarizationResult
- type ExtractiveSummarizationTaskParameters
- type InputError
- type JobStatus
- type JobStatusResponse
- type KeyPhraseResult
- type KeyPhraseTaskParameters
- type KeyPhrasesExtractedDocument
- type LROBuilder
- func (b *LROBuilder) AddAbstractiveSummarizationTask(taskName string, parameters AbstractiveSummarizationTaskParameters)
- func (b *LROBuilder) AddEntityRecognitionTask(taskName string, parameters EntitiesTaskParameters)
- func (b *LROBuilder) AddExtractiveSummarizationTask(taskName string, parameters ExtractiveSummarizationTaskParameters)
- func (b *LROBuilder) AddKeyPhraseExtractionTask(taskName string, parameters KeyPhraseTaskParameters)
- func (b *LROBuilder) AddSentimentAnalysisTask(taskName string, parameters SentimentAnalysisTaskParameters)
- func (b *LROBuilder) Build() (*SubmitJobRequestBody, error)
- type LROKind
- type LROResult
- type LanguageDetectionAnalysisInput
- type LanguageDetectionDocumentResult
- type LanguageDetectionResult
- type LanguageDetectionTaskParameters
- type LanguageInput
- type MultiLanguageAnalysisInput
- type MultiLanguageInput
- type Option
- type RequestBody
- type SentenceSentiment
- type Sentiment
- type SentimentAnalysisTaskParameters
- type SentimentAnalyzedDocument
- type SentimentConfidenceScores
- type SentimentResponse
- type SubmitJobRequestBody
- type SummaryContext
- type TaskError
- type TaskKind
- type TaskRequest
- type TaskResponse
- type Tasks
Examples ¶
Constants ¶
View Source
const APIVersion = "2023-04-01"
View Source
const AnalyzeTextAPIPath = "/language/:analyze-text"
View Source
const JobStatusAPIPath = "/language/analyze-text/jobs/{jobId}"
View Source
const SubmitJobAPIPath = "/language/analyze-text/jobs"
Variables ¶
This section is empty.
Functions ¶
func ParseJobID ¶
Types ¶
type AbstractiveSummarizationResult ¶
type AbstractiveSummarizationResult struct { // Documents Response by document Documents []AbstractiveSummaryDocumentResult `json:"documents"` // Errors Errors by document id. Errors []DocumentError `json:"errors"` // ModelVersion This field indicates which model is used for scoring. ModelVersion string `json:"modelVersion"` }
type AbstractiveSummarizationTaskParameters ¶
type AbstractiveSummarizationTaskParameters struct { LoggingOptOut bool `json:"loggingOptOut,omitempty"` ModelVersion string `json:"modelVersion,omitempty"` SentenceCount int `json:"sentenceCount,omitempty"` // StringIndexType Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. StringIndexType string `json:"stringIndexType,omitempty"` }
type AbstractiveSummary ¶
type AbstractiveSummary struct { // Contexts The context list of the summary. Contexts []SummaryContext `json:"contexts"` // Text The text of the summary. Text string `json:"text"` }
type AbstractiveSummaryDocumentResult ¶
type AbstractiveSummaryDocumentResult struct { // ID Unique, non-empty document identifier. ID string `json:"id"` // Summaries A list of abstractive summaries. Summaries []AbstractiveSummary `json:"summaries"` // Warnings Warnings encountered while processing document. Warnings []DocumentWarning `json:"warnings"` }
type Client ¶
type Client interface { AnalyzeTextLanguageDetection(ctx context.Context, input LanguageDetectionAnalysisInput, parameters LanguageDetectionTaskParameters) (*LanguageDetectionResult, error) AnalyzeTextEntityRecognition(ctx context.Context, input MultiLanguageAnalysisInput, parameters EntitiesTaskParameters) (*EntitiesResult, error) AnalyzeTextKeyPhraseExtraction(ctx context.Context, input MultiLanguageAnalysisInput, parameters KeyPhraseTaskParameters) (*KeyPhraseResult, error) AnalyzeTextSentimentAnalysis(ctx context.Context, input MultiLanguageAnalysisInput, parameters SentimentAnalysisTaskParameters) (*SentimentResponse, error) SubmitTextAnalyticsJob(ctx context.Context, input SubmitJobRequestBody) (string, error) GetTextAnalyticsJobResult(ctx context.Context, jobID string) (*JobStatusResponse, error) }
func NewClient ¶
Example ¶
package main import ( "time" azuretextanalysis "github.com/kde713/azurelangai-go/textanalysis/v20230401" ) var azureTextAnalysisClient azuretextanalysis.Client func main() { // Get your endpoint and key from the Azure portal. endpoint := "https://<this-is-example>.cognitiveservices.azure.com/" key := "<this-is-example>" // Create a client. azureTextAnalysisClient = azuretextanalysis.NewClient( endpoint, key, azuretextanalysis.WithRetryCount(3, 5*time.Second, 20*time.Second), ) }
Output:
type DetectedLanguage ¶
type DetectedLanguage struct { // ConfidenceScore A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. ConfidenceScore float64 `json:"confidenceScore"` // ISO6391Name A two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr). ISO6391Name string `json:"iso6391Name"` // Name Long name of a detected language (e.g. English, French). Name string `json:"name"` }
type DocumentError ¶
type DocumentError struct { // Error Error encountered. Error ErrorInformation `json:"error"` // ID The ID of the input document. ID string `json:"id"` }
type DocumentWarning ¶
type EntitiesResult ¶
type EntitiesResult struct { // Documents Response by document Documents []EntityRecognizedDocument `json:"documents"` // Errors Errors by document id. Errors []DocumentError `json:"errors"` // ModelVersion This field indicates which model is used for scoring. ModelVersion string `json:"modelVersion"` }
type EntitiesTaskParameters ¶
type EntitiesTaskParameters struct { LoggingOptOut bool `json:"loggingOptOut,omitempty"` ModelVersion string `json:"modelVersion,omitempty"` // StringIndexType Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. StringIndexType string `json:"stringIndexType,omitempty"` }
type Entity ¶
type Entity struct { // Category Entity type. Category string `json:"category"` // ConfidenceScore Confidence score between 0 and 1 of the extracted entity. ConfidenceScore float64 `json:"confidenceScore"` // Length Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. Length int `json:"length"` // Offset Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. Offset int `json:"offset"` // SubCategory (Optional) Entity sub type. SubCategory string `json:"subcategory"` // Text Entity text as appears in the request. Text string `json:"text"` }
type EntityRecognizedDocument ¶
type EntityRecognizedDocument struct { // Entities Recognized entities in the document. Entities []Entity `json:"entities"` // ID Unique, non-empty document identifier. ID string `json:"id"` // Warnings Warnings encountered while processing document. Warnings []DocumentWarning `json:"warnings"` }
type ErrorInformation ¶
type ErrorResponse ¶
type ErrorResponse struct { // Error The error object. Error ErrorInformation `json:"error"` }
type ExtractedSummaryDocumentResult ¶
type ExtractedSummaryDocumentResult struct { // ID Unique, non-empty document identifier. ID string `json:"id"` // Sentences A ranked list of sentences representing the extracted summary. Sentences []ExtractedSummarySentence `json:"sentences"` // Warnings Warnings encountered while processing document. Warnings []DocumentWarning `json:"warnings"` }
type ExtractedSummarySentence ¶
type ExtractedSummarySentence struct { // Length The length of the sentence. Length int `json:"length"` // Offset The sentence offset from the start of the document, based on the value of the parameter StringIndexType. Offset int `json:"offset"` // RankScore A double value representing the relevance of the sentence within the summary. Higher values indicate higher importance. RankScore float64 `json:"rankScore"` // Text The extracted sentence text. Text string `json:"text"` }
type ExtractiveSummarizationResult ¶
type ExtractiveSummarizationResult struct { // Documents Response by document Documents []ExtractedSummaryDocumentResult `json:"documents"` // Errors Errors by document id. Errors []DocumentError `json:"errors"` // ModelVersion This field indicates which model is used for scoring. ModelVersion string `json:"modelVersion"` }
type ExtractiveSummarizationTaskParameters ¶
type ExtractiveSummarizationTaskParameters struct { LoggingOptOut bool `json:"loggingOptOut,omitempty"` ModelVersion string `json:"modelVersion,omitempty"` SentenceCount int `json:"sentenceCount,omitempty"` // SortBy The sorting criteria to use for the results of Extractive Summarization. // "Offset" (Default): Indicates that results should be sorted in order of appearance in the text. // "Rank": Indicates that results should be sorted in order of importance (i.e. rank score) according to the model. SortBy string `json:"sortBy,omitempty"` // StringIndexType Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. StringIndexType string `json:"stringIndexType,omitempty"` }
type InputError ¶
type InputError struct { // Error Error encountered. Error ErrorInformation `json:"error"` // ID The ID of the input. ID string `json:"id"` }
type JobStatus ¶
type JobStatus string
const ( StatusCancelled JobStatus = "cancelled" StatusCancelling JobStatus = "cancelling" StatusFailed JobStatus = "failed" StatusNotStarted JobStatus = "notStarted" StatusPartiallyCompleted JobStatus = "partiallyCompleted" StatusRunning JobStatus = "running" StatusSucceeded JobStatus = "succeeded" )
type JobStatusResponse ¶
type JobStatusResponse struct { CreatedDateTime string `json:"createdDateTime"` DisplayName string `json:"displayName"` Errors []ErrorInformation `json:"errors"` ExpirationDateTime string `json:"expirationDateTime"` JobID string `json:"jobId"` LastUpdateDateTime string `json:"lastUpdateDateTime"` NextLink string `json:"nextLink"` Status JobStatus `json:"status"` Tasks Tasks `json:"tasks"` }
type KeyPhraseResult ¶
type KeyPhraseResult struct { // Documents Response by document Documents []KeyPhrasesExtractedDocument `json:"documents"` // Errors Errors by document id. Errors []DocumentError `json:"errors"` // ModelVersion This field indicates which model is used for scoring. ModelVersion string `json:"modelVersion"` }
type KeyPhraseTaskParameters ¶
type KeyPhrasesExtractedDocument ¶
type KeyPhrasesExtractedDocument struct { // ID Unique, non-empty document identifier. ID string `json:"id"` // Warnings Warnings encountered while processing document. Warnings []DocumentWarning `json:"warnings"` KeyPhrases []string `json:"keyPhrases"` }
type LROBuilder ¶
type LROBuilder struct {
// contains filtered or unexported fields
}
func NewJobBuilder ¶
func NewJobBuilder(displayName string, input MultiLanguageAnalysisInput) *LROBuilder
func (*LROBuilder) AddAbstractiveSummarizationTask ¶
func (b *LROBuilder) AddAbstractiveSummarizationTask(taskName string, parameters AbstractiveSummarizationTaskParameters)
func (*LROBuilder) AddEntityRecognitionTask ¶
func (b *LROBuilder) AddEntityRecognitionTask(taskName string, parameters EntitiesTaskParameters)
func (*LROBuilder) AddExtractiveSummarizationTask ¶
func (b *LROBuilder) AddExtractiveSummarizationTask(taskName string, parameters ExtractiveSummarizationTaskParameters)
func (*LROBuilder) AddKeyPhraseExtractionTask ¶
func (b *LROBuilder) AddKeyPhraseExtractionTask(taskName string, parameters KeyPhraseTaskParameters)
func (*LROBuilder) AddSentimentAnalysisTask ¶
func (b *LROBuilder) AddSentimentAnalysisTask(taskName string, parameters SentimentAnalysisTaskParameters)
func (*LROBuilder) Build ¶
func (b *LROBuilder) Build() (*SubmitJobRequestBody, error)
type LROKind ¶
type LROKind string
const ( LROKindEntityRecognition LROKind = "EntityRecognitionLROResults" LROKindKeyPhraseExtraction LROKind = "KeyPhraseExtractionLROResults" LROKindSentimentAnalysis LROKind = "SentimentAnalysisLROResults" LROKindExtractiveSummarization LROKind = "ExtractiveSummarizationLROResults" LROKindAbstractiveSummarization LROKind = "AbstractiveSummarizationLROResults" )
type LROResult ¶
type LROResult struct { // Kind Enumeration of supported Text Analysis long-running operation task results. Kind LROKind LastUpdateDateTime string Results interface{} Status JobStatus TaskName string }
func (*LROResult) UnmarshalJSON ¶
type LanguageDetectionAnalysisInput ¶
type LanguageDetectionAnalysisInput struct {
Documents []LanguageInput `json:"documents"`
}
type LanguageDetectionDocumentResult ¶
type LanguageDetectionDocumentResult struct { // DetectedLanguage Detected Language. DetectedLanguage DetectedLanguage `json:"detectedLanguage"` // ID Unique, non-empty document identifier. ID string `json:"id"` // Warnings Warnings encountered while processing document. Warnings []DocumentWarning `json:"warnings"` }
type LanguageDetectionResult ¶
type LanguageDetectionResult struct { // Documents Response by document Documents []LanguageDetectionDocumentResult `json:"documents"` // Errors Errors by document id. Errors []InputError `json:"errors"` // ModelVersion This field indicates which model is used for scoring. ModelVersion string `json:"modelVersion"` }
type LanguageInput ¶
type MultiLanguageAnalysisInput ¶
type MultiLanguageAnalysisInput struct { // Documents Contains an input document to be analyzed by the service. Documents []MultiLanguageInput `json:"documents"` }
type MultiLanguageInput ¶
type MultiLanguageInput struct { // ID A unique, non-empty document identifier. ID string `json:"id"` // Language (Optional) This is the 2 letter ISO 639-1 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. Language string `json:"language,omitempty"` // Text The input text to process. Text string `json:"text"` }
type RequestBody ¶
type RequestBody[AnalysisInput any, Parameters any] struct { // Kind Enumeration of supported Text Analysis tasks. Kind TaskKind `json:"kind"` AnalysisInput AnalysisInput `json:"analysisInput"` // Parameters Supported parameters for requesting analysis task. Parameters Parameters `json:"parameters"` }
type SentenceSentiment ¶
type SentenceSentiment struct { Sentiment Sentiment `json:"sentiment"` ConfidenceScores SentimentConfidenceScores `json:"confidenceScores"` Offset int `json:"offset"` Length int `json:"length"` Text string `json:"text"` }
type SentimentAnalysisTaskParameters ¶
type SentimentAnalysisTaskParameters struct { LoggingOptOut bool `json:"loggingOptOut,omitempty"` ModelVersion string `json:"modelVersion,omitempty"` OpinionMining bool `json:"opinionMining,omitempty"` // StringIndexType Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. StringIndexType string `json:"stringIndexType,omitempty"` }
type SentimentAnalyzedDocument ¶
type SentimentAnalyzedDocument struct { // ID Unique, non-empty document identifier. ID string `json:"id"` Sentiment Sentiment `json:"sentiment"` ConfidenceScores SentimentConfidenceScores `json:"confidenceScores"` Sentences []SentenceSentiment `json:"sentences"` Warnings []DocumentWarning `json:"warnings"` }
type SentimentResponse ¶
type SentimentResponse struct { // Documents Response by document Documents []SentimentAnalyzedDocument `json:"documents"` // Errors Errors by document id. Errors []DocumentError `json:"errors"` // ModelVersion This field indicates which model is used for scoring. ModelVersion string `json:"modelVersion"` }
type SubmitJobRequestBody ¶
type SubmitJobRequestBody struct { AnalysisInput MultiLanguageAnalysisInput `json:"analysisInput"` Tasks []TaskRequest `json:"tasks"` DisplayName string `json:"displayName"` }
type SummaryContext ¶
type SummaryContext struct { // Length The length of the context. Use of different 'stringIndexType' values can affect the length returned. Length int `json:"length"` // Offset Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. Offset int `json:"offset"` }
type TaskError ¶
type TaskError struct {
Information ErrorInformation
}
type TaskKind ¶
type TaskKind string
const ( TaskKindLanguageDetection TaskKind = "LanguageDetection" TaskKindEntityRecognition TaskKind = "EntityRecognition" TaskKindKeyPhraseExtraction TaskKind = "KeyPhraseExtraction" TaskKindSentimentAnalysis TaskKind = "SentimentAnalysis" TaskKindExtractiveSummarization TaskKind = "ExtractiveSummarization" TaskKindAbstractiveSummarization TaskKind = "AbstractiveSummarization" )
type TaskRequest ¶
type TaskResponse ¶
Click to show internal directories.
Click to hide internal directories.