...

Source file src/github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v3.0/luis/runtime/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v3.0/luis/runtime

     1  package runtime
     2  
     3  // Copyright (c) Microsoft Corporation. All rights reserved.
     4  // Licensed under the MIT License. See License.txt in the project root for license information.
     5  //
     6  // Code generated by Microsoft (R) AutoRest Code Generator.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  import (
    10  	"encoding/json"
    11  	"github.com/Azure/go-autorest/autorest"
    12  	"github.com/Azure/go-autorest/autorest/date"
    13  )
    14  
    15  // The package's fully qualified name.
    16  const fqdn = "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v3.0/luis/runtime"
    17  
    18  // DynamicList defines an extension for a list entity.
    19  type DynamicList struct {
    20  	// ListEntityName - The name of the list entity to extend.
    21  	ListEntityName *string `json:"listEntityName,omitempty"`
    22  	// RequestLists - The lists to append on the extended list entity.
    23  	RequestLists *[]RequestList `json:"requestLists,omitempty"`
    24  }
    25  
    26  // Error represents the error that occurred.
    27  type Error struct {
    28  	Error *ErrorBody `json:"error,omitempty"`
    29  }
    30  
    31  // ErrorBody represents the definition of the error that occurred.
    32  type ErrorBody struct {
    33  	// Code - The error code.
    34  	Code *string `json:"code,omitempty"`
    35  	// Message - The error message.
    36  	Message *string `json:"message,omitempty"`
    37  }
    38  
    39  // ExternalEntity defines a user predicted entity that extends an already existing one.
    40  type ExternalEntity struct {
    41  	// EntityName - The name of the entity to extend.
    42  	EntityName *string `json:"entityName,omitempty"`
    43  	// StartIndex - The start character index of the predicted entity.
    44  	StartIndex *int32 `json:"startIndex,omitempty"`
    45  	// EntityLength - The length of the predicted entity.
    46  	EntityLength *int32 `json:"entityLength,omitempty"`
    47  	// Resolution - A user supplied custom resolution to return as the entity's prediction.
    48  	Resolution interface{} `json:"resolution,omitempty"`
    49  	// Score - A user supplied score to return as the entity's prediction score.
    50  	Score *float64 `json:"score,omitempty"`
    51  }
    52  
    53  // Intent represents an intent prediction.
    54  type Intent struct {
    55  	// Score - The score of the fired intent.
    56  	Score *float64 `json:"score,omitempty"`
    57  	// ChildApp - The prediction of the dispatched application.
    58  	ChildApp *Prediction `json:"childApp,omitempty"`
    59  }
    60  
    61  // Prediction represents the prediction of a query.
    62  type Prediction struct {
    63  	// AlteredQuery - The query after spell checking. Only set if spell check was enabled and a spelling mistake was found.
    64  	AlteredQuery *string `json:"alteredQuery,omitempty"`
    65  	// TopIntent - The name of the top scoring intent.
    66  	TopIntent *string `json:"topIntent,omitempty"`
    67  	// Intents - A dictionary representing the intents that fired.
    68  	Intents map[string]*Intent `json:"intents"`
    69  	// Entities - A dictionary representing the entities that fired.
    70  	Entities map[string]interface{} `json:"entities"`
    71  	// Sentiment - The result of the sentiment analysis.
    72  	Sentiment *Sentiment `json:"sentiment,omitempty"`
    73  }
    74  
    75  // MarshalJSON is the custom marshaler for Prediction.
    76  func (p Prediction) MarshalJSON() ([]byte, error) {
    77  	objectMap := make(map[string]interface{})
    78  	if p.AlteredQuery != nil {
    79  		objectMap["alteredQuery"] = p.AlteredQuery
    80  	}
    81  	if p.TopIntent != nil {
    82  		objectMap["topIntent"] = p.TopIntent
    83  	}
    84  	if p.Intents != nil {
    85  		objectMap["intents"] = p.Intents
    86  	}
    87  	if p.Entities != nil {
    88  		objectMap["entities"] = p.Entities
    89  	}
    90  	if p.Sentiment != nil {
    91  		objectMap["sentiment"] = p.Sentiment
    92  	}
    93  	return json.Marshal(objectMap)
    94  }
    95  
    96  // PredictionRequest represents the prediction request parameters.
    97  type PredictionRequest struct {
    98  	// Query - The query to predict.
    99  	Query *string `json:"query,omitempty"`
   100  	// Options - The custom options defined for this request.
   101  	Options *PredictionRequestOptions `json:"options,omitempty"`
   102  	// ExternalEntities - The externally predicted entities for this request.
   103  	ExternalEntities *[]ExternalEntity `json:"externalEntities,omitempty"`
   104  	// DynamicLists - The dynamically created list entities for this request.
   105  	DynamicLists *[]DynamicList `json:"dynamicLists,omitempty"`
   106  }
   107  
   108  // PredictionRequestOptions the custom options for the prediction request.
   109  type PredictionRequestOptions struct {
   110  	// DatetimeReference - The reference DateTime used for predicting datetime entities.
   111  	DatetimeReference *date.Time `json:"datetimeReference,omitempty"`
   112  	// PreferExternalEntities - Whether to make the external entities resolution override the predictions if an overlap occurs.
   113  	PreferExternalEntities *bool `json:"preferExternalEntities,omitempty"`
   114  }
   115  
   116  // PredictionResponse represents the prediction response.
   117  type PredictionResponse struct {
   118  	autorest.Response `json:"-"`
   119  	// Query - The query used in the prediction.
   120  	Query *string `json:"query,omitempty"`
   121  	// Prediction - The prediction of the requested query.
   122  	Prediction *Prediction `json:"prediction,omitempty"`
   123  }
   124  
   125  // RequestList defines a sub-list to append to an existing list entity.
   126  type RequestList struct {
   127  	// Name - The name of the sub-list.
   128  	Name *string `json:"name,omitempty"`
   129  	// CanonicalForm - The canonical form of the sub-list.
   130  	CanonicalForm *string `json:"canonicalForm,omitempty"`
   131  	// Synonyms - The synonyms of the canonical form.
   132  	Synonyms *[]string `json:"synonyms,omitempty"`
   133  }
   134  
   135  // Sentiment the result of the sentiment analysis.
   136  type Sentiment struct {
   137  	// Label - The label of the sentiment analysis result.
   138  	Label *string `json:"label,omitempty"`
   139  	// Score - The sentiment score of the query.
   140  	Score *float64 `json:"score,omitempty"`
   141  }
   142  

View as plain text