github.com/twilio/twilio-go@v1.20.1/rest/intelligence/v2/model_intelligence_v2_operator_result.go (about)

     1  /*
     2   * This code was generated by
     3   * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
     4   *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
     5   *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
     6   *
     7   * Twilio - Intelligence
     8   * This is the public Twilio REST API.
     9   *
    10   * NOTE: This class is auto generated by OpenAPI Generator.
    11   * https://openapi-generator.tech
    12   * Do not edit the class manually.
    13   */
    14  
    15  package openapi
    16  
    17  import (
    18  	"encoding/json"
    19  
    20  	"github.com/twilio/twilio-go/client"
    21  )
    22  
    23  // IntelligenceV2OperatorResult struct for IntelligenceV2OperatorResult
    24  type IntelligenceV2OperatorResult struct {
    25  	OperatorType *string `json:"operator_type,omitempty"`
    26  	// The name of the applied Language Understanding.
    27  	Name *string `json:"name,omitempty"`
    28  	// A 34 character string that identifies this Language Understanding operator sid.
    29  	OperatorSid *string `json:"operator_sid,omitempty"`
    30  	// Boolean to tell if extract Language Understanding Processing model matches results.
    31  	ExtractMatch *bool `json:"extract_match,omitempty"`
    32  	// Percentage of 'matching' class needed to consider a sentence matches
    33  	MatchProbability *float32 `json:"match_probability,omitempty"`
    34  	// Normalized output of extraction stage which matches Label.
    35  	NormalizedResult *string `json:"normalized_result,omitempty"`
    36  	// List of mapped utterance object which matches sentences.
    37  	UtteranceResults *[]interface{} `json:"utterance_results,omitempty"`
    38  	// Boolean to tell if Utterance matches results.
    39  	UtteranceMatch *bool `json:"utterance_match,omitempty"`
    40  	// The 'matching' class. This might be available on conversation classify model outputs.
    41  	PredictedLabel *string `json:"predicted_label,omitempty"`
    42  	// Percentage of 'matching' class needed to consider a sentence matches.
    43  	PredictedProbability *float32 `json:"predicted_probability,omitempty"`
    44  	// The labels probabilities. This might be available on conversation classify model outputs.
    45  	LabelProbabilities *interface{} `json:"label_probabilities,omitempty"`
    46  	// List of text extraction results. This might be available on classify-extract model outputs.
    47  	ExtractResults *interface{} `json:"extract_results,omitempty"`
    48  	// Output of a text generation operator for example Conversation Sumamary.
    49  	TextGenerationResults *interface{} `json:"text_generation_results,omitempty"`
    50  	// A 34 character string that uniquely identifies this Transcript.
    51  	TranscriptSid *string `json:"transcript_sid,omitempty"`
    52  	// The URL of this resource.
    53  	Url *string `json:"url,omitempty"`
    54  }
    55  
    56  func (response *IntelligenceV2OperatorResult) UnmarshalJSON(bytes []byte) (err error) {
    57  	raw := struct {
    58  		OperatorType          *string        `json:"operator_type"`
    59  		Name                  *string        `json:"name"`
    60  		OperatorSid           *string        `json:"operator_sid"`
    61  		ExtractMatch          *bool          `json:"extract_match"`
    62  		MatchProbability      *interface{}   `json:"match_probability"`
    63  		NormalizedResult      *string        `json:"normalized_result"`
    64  		UtteranceResults      *[]interface{} `json:"utterance_results"`
    65  		UtteranceMatch        *bool          `json:"utterance_match"`
    66  		PredictedLabel        *string        `json:"predicted_label"`
    67  		PredictedProbability  *interface{}   `json:"predicted_probability"`
    68  		LabelProbabilities    *interface{}   `json:"label_probabilities"`
    69  		ExtractResults        *interface{}   `json:"extract_results"`
    70  		TextGenerationResults *interface{}   `json:"text_generation_results"`
    71  		TranscriptSid         *string        `json:"transcript_sid"`
    72  		Url                   *string        `json:"url"`
    73  	}{}
    74  
    75  	if err = json.Unmarshal(bytes, &raw); err != nil {
    76  		return err
    77  	}
    78  
    79  	*response = IntelligenceV2OperatorResult{
    80  		OperatorType:          raw.OperatorType,
    81  		Name:                  raw.Name,
    82  		OperatorSid:           raw.OperatorSid,
    83  		ExtractMatch:          raw.ExtractMatch,
    84  		NormalizedResult:      raw.NormalizedResult,
    85  		UtteranceResults:      raw.UtteranceResults,
    86  		UtteranceMatch:        raw.UtteranceMatch,
    87  		PredictedLabel:        raw.PredictedLabel,
    88  		LabelProbabilities:    raw.LabelProbabilities,
    89  		ExtractResults:        raw.ExtractResults,
    90  		TextGenerationResults: raw.TextGenerationResults,
    91  		TranscriptSid:         raw.TranscriptSid,
    92  		Url:                   raw.Url,
    93  	}
    94  
    95  	responseMatchProbability, err := client.UnmarshalFloat32(raw.MatchProbability)
    96  	if err != nil {
    97  		return err
    98  	}
    99  	response.MatchProbability = responseMatchProbability
   100  
   101  	responsePredictedProbability, err := client.UnmarshalFloat32(raw.PredictedProbability)
   102  	if err != nil {
   103  		return err
   104  	}
   105  	response.PredictedProbability = responsePredictedProbability
   106  
   107  	return
   108  }