
    ,                         S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SS	KJr  SS
KJr  SrSrSrSrSrSrSrSrS rS rS r SS jrSS jrS rSS jrS rSS jrg)zFlags for speech commands.    )absolute_import)division)unicode_literals)arg_parsers)base)concepts)	yaml_data)concept_parsers)presentation_specs            i  i@  c                    [         R                  R                  S5      n[        R                  R                  UR                  5       SS9n[        R                  " SUSSS9n[        R                  " U/5      R                  U 5      $ )z0Sets up an argument for the recognizer resource.zml.speech.recognizerv2)api_version
recognizerTzrecognizer.nameconcept_specrequired
group_helpr	   ResourceYAMLDataFromPathr   ResourceSpecFromYamlGetDatar   ResourcePresentationSpecr
   ConceptParserAddToParser)parserresource_dataresource_specpresentation_specs       4lib/googlecloudsdk/command_lib/ml/speech/flags_v2.pyAddRecognizerArgToParserr'   &   s    ,,556LM-''004 1 - )AA 	 
	&	&(9':	;	G	G	OO    c                    [         R                  R                  S5      n[        R                  R                  UR                  5       5      n[        R                  " SUSSS9n[        R                  " U/5      R                  U 5      $ )zParses location flag.ml.speech.locationz
--locationT	location.r   r   r"   location_datar$   r%   s       r&   AddLocationArgToParserr.   5   sw    ,,556JK-''001F1F1HI-(AA 	 
	&	&(9':	;	G	G	OOr(   c                    [         R                  R                  S5      n[        R                  R                  UR                  5       5      n[        R                  " SUSSS9n[        R                  " U/5      R                  U 5      $ )z&Parses location when there is no flag.r*   locationTr+   r   r   r,   s       r&    AddLocationPositionalArgToParserr1   B   sw    ,,556JK-''001F1F1HI-(AA 	 
	&	&(9':	;	G	G	OOr(   c                     [        U 5        [        U 5        U R                  SSS9  [        XS9  [	        X5        [        U 5        g)z Parses all flags for v2 STT API.z--display-namez:      Name of this recognizer as it appears in UIs.
      help)r   N)r'   AddAsyncFlagToParseradd_argument'AddBaseRecognizerAttributeFlagsToParserAddFeatureFlagsToParserAddDecodingConfigFlagsToParser)r"   "require_base_recognizer_attributesuse_store_trues      r&   AddAllFlagsToParserr<   O   sN     6"v
   * &1 (r(   c                    [        U 5        U R                  SSSS9  [        U 5        [        U 5        [	        U 5        U R                  SS[
        R                  " 5       SS9  U R                  S	S
[
        R                  " 5       SS9  U R                  S[
        R                  " SS5      SS9  U(       a  [        U 5        gg)z6Parses all flags for v2 STT API for command run-batch.z--audioTzLocation of the audio file to transcribe. Must be a audio data bytes, local file, or Google Cloud Storage URL (in the format gs://bucket/object).r   r4   z--hint-phrasesPHRASEa          A list of strings containing word and phrase "hints" so that the '
        'speech recognition is more likely to recognize them. This can be '
        'used to improve the accuracy for specific words and phrases, '
        'for example, if specific commands are typically spoken by '
        'the user. This can also be used to add additional words to the '
        'vocabulary of the recognizer. '
        'See https://cloud.google.com/speech/limits#content.
      )metavartyper4   z--hint-phrase-sets
PHRASE_SETzQ        A list of phrase set resource names to use for speech recognition.
      z--hint-boostr      zj        Boost value for the phrases passed to --phrases.
        Can have a value between 1 and 20.
      rA   r4   N)	r'   r6   r8   r9   r7   r   ArgListBoundedFloatr5   )r"   add_async_flags     r&    AddRecognizeRequestFlagsToParserrH   b   s    6"0	   &! ()&1 
	   	 
	   	##Ar*
     r(   c                     [         R                  R                  U 5        [         R                  R                  U S5        g)zAdds async flag to parser.FN)r   
ASYNC_FLAGr!   
SetDefault)r"   s    r&   r5   r5      s(    //f%//VU+r(   c                 r    U R                  SUSS9  U R                  SSU[        R                  " 5       SS9  g)	z/Adds base recognizer attribute flags to parser.z--modela            Which model to use for recognition requests.
          Select the model best suited to your domain to get best results.
          Guidance for choosing which model to use can be found in the
          [Transcription Models Documentation](https://cloud.google.com/speech-to-text/v2/docs/transcription-model)
          and the models supported in each region can be found in the
          [Table Of Supported Models](https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages).
          r>   z--language-codesLANGUAGE_CODEz          Language code is one of `en-US`, `en-GB`, `fr-FR`.
          Check [documentation](https://cloud.google.com/speech-to-text/docs/multiple-languages)
          for using more than one language code.
          )r@   r   rA   r4   N)r6   r   rE   )r"   r   s     r&   r7   r7      sO       	   
r(   c                 b   U R                  SS9nUR                  SSS9  SR                  [        [        5      nUR                  S[
        R                  " [        [        5      US9  SR                  [        [        5      nUR                  S	[
        R                  " [        [        5      US9  g
)z%Adds decoding config flags to parser.zEncoding formatr3   z
--encodinga            Encoding format of the provided audio.
          For headerless formats, must be set to `LINEAR16`, `MULAW,` or `ALAW`.
          For other formats, set to `AUTO`. Overrides the recognizer
          configuration if present, else uses recognizer encoding.
          zSample rate in Hertz of the audio data sent for recognition. Required if --encoding flag is specified and is not AUTO. Must be set to a value between {} and {}.z--sample-raterD   zNumber of channels present in the audio data sent for recognition. Required if --encoding flag is specified and is not AUTO. Must be set to a value between {} and {}.z--audio-channel-countN)		add_groupr6   formatSAMPLE_RATE_MIN_VALUESAMPLE_RATE_MAX_VALUEr   
BoundedIntAUDIO_CHANNEL_COUNT_MIN_VALUEAUDIO_CHANNEL_COUNT_MAX_VALUE)r"   decoding_config_groupsample_rate_helpaudio_channel_count_helps       r&   r9   r9      s     **0A*B$$ % 228&
!63  $$!!"79NO % 228&
')F3  $$!!
')F $ % r(   c                 $   U R                  SS9nUR                  SS9nUR                  SU(       a  SO[        R                  SS9  UR                  SU(       a  SO[        R                  S	S9  UR                  S
U(       a  SO[        R                  SS9  UR                  SU(       a  SO[        R                  SS9  UR                  SU(       a  SO[        R                  SS9  UR                  SU(       a  SO[        R                  SS9  SR	                  [
        [        5      nSR	                  [
        [        5      nUR                  SS[        R                  " [
        [        5      US9  UR                  SS[        R                  " [
        [        5      US9  UR                  SU(       a  SO[        R                  SS9  SR	                  [        [        5      nUR                  S[        R                  " [        [        5      US9  g)zAdds feature flags to parser.zASR Featuresr3   zSpeaker Diarizationz--profanity-filter
store_truez8      If set, the server will censor profanities.
      )actionr4   z--enable-word-time-offsetszR      If set, the top result includes a list of words and their timestamps.
      z--enable-word-confidencezf      If set, the top result includes a list of words and the confidence for
      those words.
      z--enable-automatic-punctuationzG      If set, adds punctuation to recognition result hypotheses.
      z--enable-spoken-punctuationz_      If set, replaces spoken punctuation with the corresponding symbols in the request.
      z--enable-spoken-emojisz2      If set, adds spoken emoji formatting.
      zMinimum number of speakers in the conversation. Must be less than or equal to --max-speaker-count. Must be set to a value between {} and {}.zMaximum number of speakers in the conversation. Must be greater than or equal to --min-speaker-count. Must be set to a value between {} and {}.z--min-speaker-countT)r   rA   r4   z--max-speaker-countz--separate-channel-recognitionz        Mode for recognizing multi-channel audio using Separate Channel Recognition.
        When set, the service will recognize each channel independently.
        zbMaximum number of recognition hypotheses to be returned. Must be set to a value between {} and {}.z--max-alternativesrD   N)
rO   r6   r   StoreTrueFalseActionrP   SPEAKER_COUNT_MIN_VALUESPEAKER_COUNT_MAX_VALUErS   ALTERNATIVES_MIN_VALUEALTERNATIVES_MAX_VALUE)r"   r;   features_groupspeaker_diarization_groupmin_speaker_count_helpmax_speaker_count_helpmax_alternatives_helps          r&   r8   r8      sU   ###8.,66  7  	 ++
   "	 ++
    	 ++
  	 &	 ++
   #	 ++
   	 ++
  Qv%'>? Qv%'>? 
 ((!!
!#: " )  ((!!
!#: " )  &	 ++  	$$*F
 "8%  !!
 "8 !  r(   N)FF)F) __doc__
__future__r   r   r   googlecloudsdk.callioper   r    googlecloudsdk.calliope.conceptsr   $googlecloudsdk.command_lib.util.apisr	   (googlecloudsdk.command_lib.util.conceptsr
   r   r^   r]   r`   r_   rU   rT   rR   rQ   r'   r.   r1   r<   rH   r5   r7   r9   r8    r(   r&   <module>rm      s    ! &  ' / ( 5 : D G      !  !   P
P
P FK)&/!d,6%Pmr(   