speech recognition options

  Available in REST API Version 2 and later.

Options that control aspects of speech recognition.

Used by actions get input, start transcription and connect with a translator.

language wrappers and examples

It has the following properties:

PropertyRequired/OptionalDefaultDescription
languageoptionalen-USA BCP 47 language code for the speech that is to be recognised. Use a language code from the Speech Recognition Languages page.
language outboundoptionallanguageThe code for the speech to be recognised on the outbound audio of the call. This property is ignored when used in the get input action or when used with transcription mode set to mixed or inbound.
word hintsoptional-An array of word hint objects to provide hints to the speech recogniser.
max alternativesoptional1The maximum number of alternative speech objects to return in each phrase. The valid range is 1 to 3.
enable profanity filteringoptionalfalseWhether to filter out any recognised profanity. Any such words will be replaced by asterisks when enabled.
speech model optionsoptional-A speech model options object to select and configure the model used.
speech model options outboundoptionalspeech model optionsA speech model options object to select and configure the model used on the outbound audio of the call. This property is ignored when used in the get input action or when used with transcription mode set to mixed or inbound.

  • Examples:


    • Set the maximum number of alternative speech objects to return in each phrase and enable the profanity filter:

          {
      		"max_alternatives" : 2,
      		"enable_profanity_filtering" : true
          }
      
    • Set the language and word hints:

          {
      		"language" : "en-GB",
      		"word_hints" :
      		[
      			{
      				"words" : 
      				[
      					"Northamptonshire", "Buckinghamshire", "Bedfordshire"
      				]
      			}
      		]
          }
      
  • SpeechRecognitionOptions Class
    Namespace: Aculab.Cloud.RestAPIWrapper
    Assembly: Aculab.Cloud.RestAPIWrapper.dll

    A class representing the speech recognition options that can be set when transcribing audio.

    • public class SpeechRecognitionOptions 
      {
          // Constructors
          public SpeechRecognitionOptions(string language = null);
      
          // Members
          public string Language;
          public string LanguageOutbound;
          public List<WordHint> WordHints;
          public bool ShouldSerializeWordHints();
          public int? MaxAlternatives;
          public bool? EnableProfanityFiltering;
          public SpeechModelOptions SpeechModelOptions;
          public SpeechModelOptions SpeechModelOptionsOutbound;
      }
      

      Examples:

      • Set the maximum number of alternative speech objects to return in each phrase and enable the profanity filter:

        var speechRecognitionOptions = new SpeechRecognitionOptions()
        {
            MaxAlternatives = 1,
            EnableProfanityFiltering = true
        };
        
        var getInputAction = new GetInput(new WebPageRequest("MyNextPage.aspx"), options: speechRecognitionOptions);
        
      • Set the language and word hints:

        var speechRecognitionOptions = new SpeechRecognitionOptions("en-GB");
        var wordHint = new WordHint("Northamptonshire");
        wordHint.Words.Add("Buckinghamshire");
        wordHint.Words.Add("Bedfordshire");
        speechRecognitionOptions.WordHints.Add(wordHint);
        
        var getInputAction = new GetInput(new WebPageRequest("MyNextPage.aspx"), options: speechRecognitionOptions);
        
    • public class SpeechRecognitionOptions 
      {
          // Constructors
          public SpeechRecognitionOptions(string language = null);
      
          // Members
          public string Language;
          public string LanguageOutbound;
          public List<WordHint> WordHints;
          public bool ShouldSerializeWordHints();
          public int? MaxAlternatives;
          public bool? EnableProfanityFiltering;
          public SpeechModelOptions SpeechModelOptions;
          public SpeechModelOptions SpeechModelOptionsOutbound;
      }
      

      Examples:

      • Set the maximum number of alternative speech objects to return in each phrase and enable the profanity filter:

        var speechRecognitionOptions = new SpeechRecognitionOptions()
        {
            MaxAlternatives = 1,
            EnableProfanityFiltering = true
        };
        
        var getInputAction = new GetInput(new WebPageRequest("MyNextPage.aspx"), options: speechRecognitionOptions);
        
      • Set the language and word hints:

        var speechRecognitionOptions = new SpeechRecognitionOptions("en-GB");
        var wordHint = new WordHint("Northamptonshire");
        wordHint.Words.Add("Buckinghamshire");
        wordHint.Words.Add("Bedfordshire");
        speechRecognitionOptions.WordHints.Add(wordHint);
        
        var getInputAction = new GetInput(new WebPageRequest("MyNextPage.aspx"), options: speechRecognitionOptions);
        
    • public class SpeechRecognitionOptions 
      {
          // Constructors
          public SpeechRecognitionOptions(string language = null);
      
          // Members
          public string Language;
          public string LanguageOutbound;
          public List<WordHint> WordHints;
          public bool ShouldSerializeWordHints();
          public int? MaxAlternatives;
          public bool? EnableProfanityFiltering;
          public SpeechModelOptions SpeechModelOptions;
          public SpeechModelOptions SpeechModelOptionsOutbound;
      }
      

      Examples:

      • Set the maximum number of alternative speech objects to return in each phrase and enable the profanity filter:

        var speechRecognitionOptions = new SpeechRecognitionOptions()
        {
            MaxAlternatives = 1,
            EnableProfanityFiltering = true
        };
        
        var getInputAction = new GetInput(new WebPageRequest("MyNextPage.aspx"), options: speechRecognitionOptions);
        
      • Set the language and word hints:

        var speechRecognitionOptions = new SpeechRecognitionOptions("en-GB");
        var wordHint = new WordHint("Northamptonshire");
        wordHint.Words.Add("Buckinghamshire");
        wordHint.Words.Add("Bedfordshire");
        speechRecognitionOptions.WordHints.Add(wordHint);
        
        var getInputAction = new GetInput(new WebPageRequest("MyNextPage.aspx"), options: speechRecognitionOptions);
        
  • SpeechRecognitionOptions Class
    Namespace: Aculab.Cloud.RestAPIWrapper
    Assembly: Aculab.Cloud.RestAPIWrapper.dll

    A class representing the speech recognition options that can be set when transcribing audio.

    • Public Class SpeechRecognitionOptions
          ' Constructors
          Public Sub New (Optional language As String = Nothing)
      
          ' Members
          Public Property Language As String
          Public Property LanguageOutbound As String
          Public Property WordHints As List(Of Wordhint)
          Public Function ShouldSerializeWordHints() As Bool
          Public Property MaxAlternatives As Integer?
          Public Property EnableProfanityFiltering As Bool?
          Public Property SpeechModelOptions As Speechmodeloptions
          Public Property SpeechModelOptionsOutbound As Speechmodeloptions
      End Class
      

      Examples:

      • Set the maximum number of alternative speech objects to return in each phrase and enable the profanity filter:

        Dim speechRecognitionOptions = New SpeechRecognitionOptions()
        speechRecognitionOptions.MaxAlternatives = 1
        speechRecognitionOptions.EnableProfanityFiltering = True
        
        Dim getInputAction = New GetInput(New WebPageRequest("MyNextPage.aspx"), options:=speechRecognitionOptions)
        
      • Set the language and word hints:

        Dim speechRecognitionOptions = New SpeechRecognitionOptions("en-GB")
        Dim hint = New WordHint("Northamptonshire")
        hint.Words.Add("Buckinghamshire")
        hint.Words.Add("Bedfordshire")
        speechRecognitionOptions.WordHints.Add(hint)
        
        Dim getInputAction = New GetInput(New WebPageRequest("MyNextPage.aspx"), options:=speechRecognitionOptions)
        
    • Public Class SpeechRecognitionOptions
          ' Constructors
          Public Sub New (Optional language As String = Nothing)
      
          ' Members
          Public Property Language As String
          Public Property LanguageOutbound As String
          Public Property WordHints As List(Of Wordhint)
          Public Function ShouldSerializeWordHints() As Bool
          Public Property MaxAlternatives As Integer?
          Public Property EnableProfanityFiltering As Bool?
          Public Property SpeechModelOptions As Speechmodeloptions
          Public Property SpeechModelOptionsOutbound As Speechmodeloptions
      End Class
      

      Examples:

      • Set the maximum number of alternative speech objects to return in each phrase and enable the profanity filter:

        Dim speechRecognitionOptions = New SpeechRecognitionOptions()
        speechRecognitionOptions.MaxAlternatives = 1
        speechRecognitionOptions.EnableProfanityFiltering = True
        
        Dim getInputAction = New GetInput(New WebPageRequest("MyNextPage.aspx"), options:=speechRecognitionOptions)
        
      • Set the language and word hints:

        Dim speechRecognitionOptions = New SpeechRecognitionOptions("en-GB")
        Dim hint = New WordHint("Northamptonshire")
        hint.Words.Add("Buckinghamshire")
        hint.Words.Add("Bedfordshire")
        speechRecognitionOptions.WordHints.Add(hint)
        
        Dim getInputAction = New GetInput(New WebPageRequest("MyNextPage.aspx"), options:=speechRecognitionOptions)
        
  • class SpeechRecognitionOptions extends JSONElement

    Represents the Speech Recognition Options support class.

    Class synopsis:

    // Constructors:
    public SpeechRecognitionOptions()
    
    // Members:
    public void setLanguage(String language)
    public void setLanguageOutbound(String language)
    public void setWordHints(List<WordHint> wordHints)
    public void setMaxAlternatives(int alternatives)
    public void setEnableProfanityFiltering(boolean enabled)
    public void setSpeechModelOptions(SpeechModelOptions speechModelOptions)
    public void setSpeechModelOptionsOutbound(SpeechModelOptions speechModelOptions)
    

    Examples:

    • Set the maximum number of alternative speech objects to return in each phrase and enable the profanity filter:

      SpeechRecognitionOptions speechRecogOpts = new SpeechRecognitionOptions();
      speechRecogOpts.setMaxAlternatives(2);
      speechRecogOpts.setEnableProfanityFiltering(true);
      
    • Set the language and word hints:

      List<WordHint> wordHints = new ArrayList<>();
      List<String> words = new ArrayList<>();
      words.add("Northamptonshire");
      words.add("Buckinghamshire");
      words.add("Bedfordshire");
      WordHint wordHint = new WordHint(words);
      wordHints.add(wordHint);
      
      SpeechRecognitionOptions speechRecogOpts = new SpeechRecognitionOptions();
      speechRecogOpts.setLanguage("en-GB");
      speechRecogOpts.setWordHints(wordHints);
      
  • class SpeechRecognitionOptions

    Represents the Speech Recognition Options support class.

    Class synopsis:

    # SpeechRecognitionOptions object:
    SpeechRecognitionOptions()
    
    # Instance methods:
    SpeechRecognitionOptions.set_language(language)
    SpeechRecognitionOptions.set_language_outbound(language_outbound)
    SpeechRecognitionOptions.set_word_hints(word_hints)
    SpeechRecognitionOptions.set_max_alternatives(max_alternatives)
    SpeechRecognitionOptions.set_enable_profanity_filtering(enable_profanity_filtering)
    SpeechRecognitionOptions.set_speech_model_options(speech_model_options)
    SpeechRecognitionOptions.set_speech_model_options_outbound(speech_model_options)
    

    Examples:

    • Set the maximum number of alternative speech objects to return in each phrase and enable the profanity filter:

      speech_recognition_opts = SpeechRecognitionOptions()
      speech_recognition_opts.set_max_alternatives(2)
      speech_recognition_opts.set_enable_profanity_filtering(True)
      
    • Set the language and word hints:

      word_hints = []
      word_hints.append(WordHint(["Northamptonshire", "Buckinghamshire", "Bedfordshire"]))
      
      speech_recognition_opts = SpeechRecognitionOptions()
      speech_recognition_opts.set_language("en-GB")
      speech_recognition_opts.set_word_hints(word_hints)
      
  • The SpeechRecognitionOptions class

    Introduction

    Represents the speech recognition options.

    Class synopsis

    class SpeechRecognitionOptions {
    
        /* methods */
        public __construct()
        public self setLanguage(string $lang)
        public self setLanguageOutbound(string $lang)
        public self setWordHints(WordHint|array[WordHint] $hints)
        public self addWordHint(WordHint $hint)
        public self setMaxAlternatives(int $alt)
        public self setEnableProfanityFiltering(boolean $enabled)
        public self setSpeechModelOptions(SpeechModelOptions $opts)
        public self setSpeechModelOptionsOutbound(SpeechModelOptions $opts)
    }
    

    Examples:

    • Set the maximum number of alternative speech objects to return in each phrase and enable the profanity filter:

      $speech_recognition_options = new \Aculab\TelephonyRestAPI\SpeechRecognitionOptions();
      $speech_recognition_options->setMaxAlternatives(2)
          ->setEnableProfanityFiltering(true);
      
    • Set the language and word hints:

      $speech_recognition_options = new \Aculab\TelephonyRestAPI\SpeechRecognitionOptions();
      
      
      $counties = new \Aculab\TelephonyRestAPI\WordHint("Northamptonshire");
      $counties->addWord("Buckinghamshire")
          ->addWord("Bedfordshire");
      
      $speech_recognition_options->setLanguage("en-GB")
          ->addWordHint( $counties );