Class: Twilio::REST::Intelligence::V2::TranscriptContext::OperatorResultInstance

Inherits:
Twilio::REST::InstanceResource show all
Defined in:
lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, transcript_sid: nil, operator_sid: nil) ⇒ OperatorResultInstance

Initialize the OperatorResultInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this OperatorResult resource.

  • sid (String)

    The SID of the Call resource to fetch.



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 408

def initialize(version, payload , transcript_sid: nil, operator_sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'operator_type' => payload['operator_type'],
        'name' => payload['name'],
        'operator_sid' => payload['operator_sid'],
        'extract_match' => payload['extract_match'],
        'match_probability' => payload['match_probability'],
        'normalized_result' => payload['normalized_result'],
        'utterance_results' => payload['utterance_results'],
        'utterance_match' => payload['utterance_match'],
        'predicted_label' => payload['predicted_label'],
        'predicted_probability' => payload['predicted_probability'],
        'label_probabilities' => payload['label_probabilities'],
        'extract_results' => payload['extract_results'],
        'text_generation_results' => payload['text_generation_results'],
        'json_results' => payload['json_results'],
        'transcript_sid' => payload['transcript_sid'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'transcript_sid' => transcript_sid  || @properties['transcript_sid']  ,'operator_sid' => operator_sid  || @properties['operator_sid']  , }
end

Instance Method Details

#contextOperatorResultContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



441
442
443
444
445
446
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 441

def context
    unless @instance_context
        @instance_context = OperatorResultContext.new(@version , @params['transcript_sid'], @params['operator_sid'])
    end
    @instance_context
end

#extract_matchBoolean

Returns Boolean to tell if extract Language Understanding Processing model matches results.

Returns:

  • (Boolean)

    Boolean to tell if extract Language Understanding Processing model matches results.



468
469
470
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 468

def extract_match
    @properties['extract_match']
end

#extract_resultsHash

Returns List of text extraction results. This might be available on classify-extract model outputs.

Returns:

  • (Hash)

    List of text extraction results. This might be available on classify-extract model outputs.



516
517
518
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 516

def extract_results
    @properties['extract_results']
end

#fetch(redacted: :unset) ⇒ OperatorResultInstance

Fetch the OperatorResultInstance

Parameters:

  • redacted (Boolean) (defaults to: :unset)

    Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True.

Returns:



548
549
550
551
552
553
554
555
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 548

def fetch(
  redacted: :unset
)

    context.fetch(
        redacted: redacted, 
    )
end

#inspectObject

Provide a detailed, user friendly representation



566
567
568
569
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 566

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Intelligence.V2.OperatorResultInstance #{values}>"
end

#json_resultsHash

Returns:

  • (Hash)


528
529
530
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 528

def json_results
    @properties['json_results']
end

#label_probabilitiesHash

Returns The labels probabilities. This might be available on conversation classify model outputs.

Returns:

  • (Hash)

    The labels probabilities. This might be available on conversation classify model outputs.



510
511
512
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 510

def label_probabilities
    @properties['label_probabilities']
end

#match_probabilityFloat

Returns Percentage of ‘matching’ class needed to consider a sentence matches.

Returns:

  • (Float)

    Percentage of ‘matching’ class needed to consider a sentence matches



474
475
476
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 474

def match_probability
    @properties['match_probability']
end

#nameString

Returns The name of the applied Language Understanding.

Returns:

  • (String)

    The name of the applied Language Understanding.



456
457
458
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 456

def name
    @properties['name']
end

#normalized_resultString

Returns Normalized output of extraction stage which matches Label.

Returns:

  • (String)

    Normalized output of extraction stage which matches Label.



480
481
482
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 480

def normalized_result
    @properties['normalized_result']
end

#operator_sidString

Returns A 34 character string that identifies this Language Understanding operator sid.

Returns:

  • (String)

    A 34 character string that identifies this Language Understanding operator sid.



462
463
464
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 462

def operator_sid
    @properties['operator_sid']
end

#operator_typeOperatorType

Returns:

  • (OperatorType)


450
451
452
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 450

def operator_type
    @properties['operator_type']
end

#predicted_labelString

Returns The ‘matching’ class. This might be available on conversation classify model outputs.

Returns:

  • (String)

    The ‘matching’ class. This might be available on conversation classify model outputs.



498
499
500
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 498

def predicted_label
    @properties['predicted_label']
end

#predicted_probabilityFloat

Returns Percentage of ‘matching’ class needed to consider a sentence matches.

Returns:

  • (Float)

    Percentage of ‘matching’ class needed to consider a sentence matches.



504
505
506
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 504

def predicted_probability
    @properties['predicted_probability']
end

#text_generation_resultsHash

Returns Output of a text generation operator for example Conversation Sumamary.

Returns:

  • (Hash)

    Output of a text generation operator for example Conversation Sumamary.



522
523
524
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 522

def text_generation_results
    @properties['text_generation_results']
end

#to_sObject

Provide a user friendly representation



559
560
561
562
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 559

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Intelligence.V2.OperatorResultInstance #{values}>"
end

#transcript_sidString

Returns A 34 character string that uniquely identifies this Transcript.

Returns:

  • (String)

    A 34 character string that uniquely identifies this Transcript.



534
535
536
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 534

def transcript_sid
    @properties['transcript_sid']
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



540
541
542
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 540

def url
    @properties['url']
end

#utterance_matchBoolean

Returns Boolean to tell if Utterance matches results.

Returns:

  • (Boolean)

    Boolean to tell if Utterance matches results.



492
493
494
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 492

def utterance_match
    @properties['utterance_match']
end

#utterance_resultsArray<Hash>

Returns List of mapped utterance object which matches sentences.

Returns:

  • (Array<Hash>)

    List of mapped utterance object which matches sentences.



486
487
488
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/operator_result.rb', line 486

def utterance_results
    @properties['utterance_results']
end