...
1 package runtime
2
3
4
5
6
7
8
9 import (
10 "encoding/json"
11 "github.com/Azure/go-autorest/autorest"
12 "github.com/Azure/go-autorest/autorest/date"
13 )
14
15
16 const fqdn = "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v3.0/luis/runtime"
17
18
19 type DynamicList struct {
20
21 ListEntityName *string `json:"listEntityName,omitempty"`
22
23 RequestLists *[]RequestList `json:"requestLists,omitempty"`
24 }
25
26
27 type Error struct {
28 Error *ErrorBody `json:"error,omitempty"`
29 }
30
31
32 type ErrorBody struct {
33
34 Code *string `json:"code,omitempty"`
35
36 Message *string `json:"message,omitempty"`
37 }
38
39
40 type ExternalEntity struct {
41
42 EntityName *string `json:"entityName,omitempty"`
43
44 StartIndex *int32 `json:"startIndex,omitempty"`
45
46 EntityLength *int32 `json:"entityLength,omitempty"`
47
48 Resolution interface{} `json:"resolution,omitempty"`
49
50 Score *float64 `json:"score,omitempty"`
51 }
52
53
54 type Intent struct {
55
56 Score *float64 `json:"score,omitempty"`
57
58 ChildApp *Prediction `json:"childApp,omitempty"`
59 }
60
61
62 type Prediction struct {
63
64 AlteredQuery *string `json:"alteredQuery,omitempty"`
65
66 TopIntent *string `json:"topIntent,omitempty"`
67
68 Intents map[string]*Intent `json:"intents"`
69
70 Entities map[string]interface{} `json:"entities"`
71
72 Sentiment *Sentiment `json:"sentiment,omitempty"`
73 }
74
75
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
97 type PredictionRequest struct {
98
99 Query *string `json:"query,omitempty"`
100
101 Options *PredictionRequestOptions `json:"options,omitempty"`
102
103 ExternalEntities *[]ExternalEntity `json:"externalEntities,omitempty"`
104
105 DynamicLists *[]DynamicList `json:"dynamicLists,omitempty"`
106 }
107
108
109 type PredictionRequestOptions struct {
110
111 DatetimeReference *date.Time `json:"datetimeReference,omitempty"`
112
113 PreferExternalEntities *bool `json:"preferExternalEntities,omitempty"`
114 }
115
116
117 type PredictionResponse struct {
118 autorest.Response `json:"-"`
119
120 Query *string `json:"query,omitempty"`
121
122 Prediction *Prediction `json:"prediction,omitempty"`
123 }
124
125
126 type RequestList struct {
127
128 Name *string `json:"name,omitempty"`
129
130 CanonicalForm *string `json:"canonicalForm,omitempty"`
131
132 Synonyms *[]string `json:"synonyms,omitempty"`
133 }
134
135
136 type Sentiment struct {
137
138 Label *string `json:"label,omitempty"`
139
140 Score *float64 `json:"score,omitempty"`
141 }
142
View as plain text