
    
                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddl	mZ ej                   ej                  ej                  j                         G d	 d
ej                                       Zy)z9Cloud Speech-to-text recognizers run short audio command.    )absolute_import)division)unicode_literals)client)base)flag_validations)flags_v2c                   ,    e Zd ZdZd Zed        Zd Zy)RunShortzIGet transcripts of short (less than 60 seconds) audio from an audio file.c                 X    t        j                  |       t        j                  |       y)zValidates run short flags.N)r   ValidateDecodingConfigValidateAudioSource)selfargss     .lib/surface/ml/speech/recognizers/run_short.pyValidateRunShortFlagszRunShort.ValidateRunShortFlags   s    ++D1((.    c                 .    t        j                  |        y)z Register flags for this command.N)r	    AddRecognizeRequestFlagsToParser)parsers    r   ArgszRunShort.Args$   s     --f5r   c                    |j                   j                  j                         }t        j                         }| j                  |       g }|j                  |j                  |j                  |      \  }}|j                  ||d|      \  }}|j                  ||      \  |_        }|j                  s|j                  r|j                  ||      \  |_        }|j!                  ||j"                  ||      S )NT)default_to_auto_decoding_configupdate_mask)r   )CONCEPTS
recognizerParser   SpeechV2Clientr   InitializeRecognitionConfigmodellanguage_codes InitializeDecodingConfigFromArgsInitializeASRFeaturesFromArgsfeatureshint_phraseshint_phrase_sets"InitializeAdaptationConfigFromArgs
adaptationr   audio)r   r   resourcespeech_clientrecognition_config_update_maskrecognition_configs         r   RunzRunShort.Run)   s   }}''--/H))+Mt$%'" 	11JJ++-K	
 76 	66,06	 	7 	
 76 	33< 	4 	
 @!? D11

:
: > ;  D#%C !!

&	 r   N)__name__
__module____qualname____doc__r   staticmethodr   r.    r   r   r   r      s&     R/
 6 6)r   r   N)r2   
__future__r   r   r    googlecloudsdk.api_lib.ml.speechr   googlecloudsdk.callioper   $googlecloudsdk.command_lib.ml.speechr   r	   UniverseCompatibleReleaseTracksReleaseTrackALPHACommandr   r4   r   r   <module>r>      sf    @ &  ' 3 ( A 9 D%%++,6t|| 6 - 6r   