packages feed

amazonka-transcribe-2.0: gen/Amazonka/Transcribe/Types/Settings.hs

{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Transcribe.Types.Settings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Transcribe.Types.Settings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Transcribe.Types.VocabularyFilterMethod

-- | Allows additional optional settings in your request, including channel
-- identification, alternative transcriptions, and speaker partitioning.
-- You can use that to apply custom vocabularies to your transcription job.
--
-- /See:/ 'newSettings' smart constructor.
data Settings = Settings'
  { -- | Enables channel identification in multi-channel audio.
    --
    -- Channel identification transcribes the audio on each channel
    -- independently, then appends the output for each channel into one
    -- transcript.
    --
    -- You can\'t include both @ShowSpeakerLabels@ and @ChannelIdentification@
    -- in the same request. Including both parameters returns a
    -- @BadRequestException@.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/channel-id.html Transcribing multi-channel audio>.
    channelIdentification :: Prelude.Maybe Prelude.Bool,
    -- | Indicate the maximum number of alternative transcriptions you want
    -- Amazon Transcribe to include in your transcript.
    --
    -- If you select a number greater than the number of alternative
    -- transcriptions generated by Amazon Transcribe, only the actual number of
    -- alternative transcriptions are included.
    --
    -- If you include @MaxAlternatives@ in your request, you must also include
    -- @ShowAlternatives@ with a value of @true@.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/how-alternatives.html Alternative transcriptions>.
    maxAlternatives :: Prelude.Maybe Prelude.Natural,
    -- | Specify the maximum number of speakers you want to partition in your
    -- media.
    --
    -- Note that if your media contains more speakers than the specified
    -- number, multiple speakers are treated as a single speaker.
    --
    -- If you specify the @MaxSpeakerLabels@ field, you must set the
    -- @ShowSpeakerLabels@ field to true.
    maxSpeakerLabels :: Prelude.Maybe Prelude.Natural,
    -- | To include alternative transcriptions within your transcription output,
    -- include @ShowAlternatives@ in your transcription request.
    --
    -- If you have multi-channel audio and do not enable channel
    -- identification, your audio is transcribed in a continuous manner and
    -- your transcript does not separate the speech by channel.
    --
    -- If you include @ShowAlternatives@, you must also include
    -- @MaxAlternatives@, which is the maximum number of alternative
    -- transcriptions you want Amazon Transcribe to generate.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/how-alternatives.html Alternative transcriptions>.
    showAlternatives :: Prelude.Maybe Prelude.Bool,
    -- | Enables speaker partitioning (diarization) in your transcription output.
    -- Speaker partitioning labels the speech from individual speakers in your
    -- media file.
    --
    -- If you enable @ShowSpeakerLabels@ in your request, you must also include
    -- @MaxSpeakerLabels@.
    --
    -- You can\'t include both @ShowSpeakerLabels@ and @ChannelIdentification@
    -- in the same request. Including both parameters returns a
    -- @BadRequestException@.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/diarization.html Partitioning speakers (diarization)>.
    showSpeakerLabels :: Prelude.Maybe Prelude.Bool,
    -- | Specify how you want your custom vocabulary filter applied to your
    -- transcript.
    --
    -- To replace words with @***@, choose @mask@.
    --
    -- To delete words, choose @remove@.
    --
    -- To flag words without changing them, choose @tag@.
    vocabularyFilterMethod :: Prelude.Maybe VocabularyFilterMethod,
    -- | The name of the custom vocabulary filter you want to use in your
    -- transcription job request. This name is case sensitive, cannot contain
    -- spaces, and must be unique within an Amazon Web Services account.
    --
    -- Note that if you include @VocabularyFilterName@ in your request, you
    -- must also include @VocabularyFilterMethod@.
    vocabularyFilterName :: Prelude.Maybe Prelude.Text,
    -- | The name of the custom vocabulary you want to use in your transcription
    -- job request. This name is case sensitive, cannot contain spaces, and
    -- must be unique within an Amazon Web Services account.
    vocabularyName :: Prelude.Maybe Prelude.Text
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

-- |
-- Create a value of 'Settings' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'channelIdentification', 'settings_channelIdentification' - Enables channel identification in multi-channel audio.
--
-- Channel identification transcribes the audio on each channel
-- independently, then appends the output for each channel into one
-- transcript.
--
-- You can\'t include both @ShowSpeakerLabels@ and @ChannelIdentification@
-- in the same request. Including both parameters returns a
-- @BadRequestException@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/channel-id.html Transcribing multi-channel audio>.
--
-- 'maxAlternatives', 'settings_maxAlternatives' - Indicate the maximum number of alternative transcriptions you want
-- Amazon Transcribe to include in your transcript.
--
-- If you select a number greater than the number of alternative
-- transcriptions generated by Amazon Transcribe, only the actual number of
-- alternative transcriptions are included.
--
-- If you include @MaxAlternatives@ in your request, you must also include
-- @ShowAlternatives@ with a value of @true@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/how-alternatives.html Alternative transcriptions>.
--
-- 'maxSpeakerLabels', 'settings_maxSpeakerLabels' - Specify the maximum number of speakers you want to partition in your
-- media.
--
-- Note that if your media contains more speakers than the specified
-- number, multiple speakers are treated as a single speaker.
--
-- If you specify the @MaxSpeakerLabels@ field, you must set the
-- @ShowSpeakerLabels@ field to true.
--
-- 'showAlternatives', 'settings_showAlternatives' - To include alternative transcriptions within your transcription output,
-- include @ShowAlternatives@ in your transcription request.
--
-- If you have multi-channel audio and do not enable channel
-- identification, your audio is transcribed in a continuous manner and
-- your transcript does not separate the speech by channel.
--
-- If you include @ShowAlternatives@, you must also include
-- @MaxAlternatives@, which is the maximum number of alternative
-- transcriptions you want Amazon Transcribe to generate.
--
-- For more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/how-alternatives.html Alternative transcriptions>.
--
-- 'showSpeakerLabels', 'settings_showSpeakerLabels' - Enables speaker partitioning (diarization) in your transcription output.
-- Speaker partitioning labels the speech from individual speakers in your
-- media file.
--
-- If you enable @ShowSpeakerLabels@ in your request, you must also include
-- @MaxSpeakerLabels@.
--
-- You can\'t include both @ShowSpeakerLabels@ and @ChannelIdentification@
-- in the same request. Including both parameters returns a
-- @BadRequestException@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/diarization.html Partitioning speakers (diarization)>.
--
-- 'vocabularyFilterMethod', 'settings_vocabularyFilterMethod' - Specify how you want your custom vocabulary filter applied to your
-- transcript.
--
-- To replace words with @***@, choose @mask@.
--
-- To delete words, choose @remove@.
--
-- To flag words without changing them, choose @tag@.
--
-- 'vocabularyFilterName', 'settings_vocabularyFilterName' - The name of the custom vocabulary filter you want to use in your
-- transcription job request. This name is case sensitive, cannot contain
-- spaces, and must be unique within an Amazon Web Services account.
--
-- Note that if you include @VocabularyFilterName@ in your request, you
-- must also include @VocabularyFilterMethod@.
--
-- 'vocabularyName', 'settings_vocabularyName' - The name of the custom vocabulary you want to use in your transcription
-- job request. This name is case sensitive, cannot contain spaces, and
-- must be unique within an Amazon Web Services account.
newSettings ::
  Settings
newSettings =
  Settings'
    { channelIdentification = Prelude.Nothing,
      maxAlternatives = Prelude.Nothing,
      maxSpeakerLabels = Prelude.Nothing,
      showAlternatives = Prelude.Nothing,
      showSpeakerLabels = Prelude.Nothing,
      vocabularyFilterMethod = Prelude.Nothing,
      vocabularyFilterName = Prelude.Nothing,
      vocabularyName = Prelude.Nothing
    }

-- | Enables channel identification in multi-channel audio.
--
-- Channel identification transcribes the audio on each channel
-- independently, then appends the output for each channel into one
-- transcript.
--
-- You can\'t include both @ShowSpeakerLabels@ and @ChannelIdentification@
-- in the same request. Including both parameters returns a
-- @BadRequestException@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/channel-id.html Transcribing multi-channel audio>.
settings_channelIdentification :: Lens.Lens' Settings (Prelude.Maybe Prelude.Bool)
settings_channelIdentification = Lens.lens (\Settings' {channelIdentification} -> channelIdentification) (\s@Settings' {} a -> s {channelIdentification = a} :: Settings)

-- | Indicate the maximum number of alternative transcriptions you want
-- Amazon Transcribe to include in your transcript.
--
-- If you select a number greater than the number of alternative
-- transcriptions generated by Amazon Transcribe, only the actual number of
-- alternative transcriptions are included.
--
-- If you include @MaxAlternatives@ in your request, you must also include
-- @ShowAlternatives@ with a value of @true@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/how-alternatives.html Alternative transcriptions>.
settings_maxAlternatives :: Lens.Lens' Settings (Prelude.Maybe Prelude.Natural)
settings_maxAlternatives = Lens.lens (\Settings' {maxAlternatives} -> maxAlternatives) (\s@Settings' {} a -> s {maxAlternatives = a} :: Settings)

-- | Specify the maximum number of speakers you want to partition in your
-- media.
--
-- Note that if your media contains more speakers than the specified
-- number, multiple speakers are treated as a single speaker.
--
-- If you specify the @MaxSpeakerLabels@ field, you must set the
-- @ShowSpeakerLabels@ field to true.
settings_maxSpeakerLabels :: Lens.Lens' Settings (Prelude.Maybe Prelude.Natural)
settings_maxSpeakerLabels = Lens.lens (\Settings' {maxSpeakerLabels} -> maxSpeakerLabels) (\s@Settings' {} a -> s {maxSpeakerLabels = a} :: Settings)

-- | To include alternative transcriptions within your transcription output,
-- include @ShowAlternatives@ in your transcription request.
--
-- If you have multi-channel audio and do not enable channel
-- identification, your audio is transcribed in a continuous manner and
-- your transcript does not separate the speech by channel.
--
-- If you include @ShowAlternatives@, you must also include
-- @MaxAlternatives@, which is the maximum number of alternative
-- transcriptions you want Amazon Transcribe to generate.
--
-- For more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/how-alternatives.html Alternative transcriptions>.
settings_showAlternatives :: Lens.Lens' Settings (Prelude.Maybe Prelude.Bool)
settings_showAlternatives = Lens.lens (\Settings' {showAlternatives} -> showAlternatives) (\s@Settings' {} a -> s {showAlternatives = a} :: Settings)

-- | Enables speaker partitioning (diarization) in your transcription output.
-- Speaker partitioning labels the speech from individual speakers in your
-- media file.
--
-- If you enable @ShowSpeakerLabels@ in your request, you must also include
-- @MaxSpeakerLabels@.
--
-- You can\'t include both @ShowSpeakerLabels@ and @ChannelIdentification@
-- in the same request. Including both parameters returns a
-- @BadRequestException@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/diarization.html Partitioning speakers (diarization)>.
settings_showSpeakerLabels :: Lens.Lens' Settings (Prelude.Maybe Prelude.Bool)
settings_showSpeakerLabels = Lens.lens (\Settings' {showSpeakerLabels} -> showSpeakerLabels) (\s@Settings' {} a -> s {showSpeakerLabels = a} :: Settings)

-- | Specify how you want your custom vocabulary filter applied to your
-- transcript.
--
-- To replace words with @***@, choose @mask@.
--
-- To delete words, choose @remove@.
--
-- To flag words without changing them, choose @tag@.
settings_vocabularyFilterMethod :: Lens.Lens' Settings (Prelude.Maybe VocabularyFilterMethod)
settings_vocabularyFilterMethod = Lens.lens (\Settings' {vocabularyFilterMethod} -> vocabularyFilterMethod) (\s@Settings' {} a -> s {vocabularyFilterMethod = a} :: Settings)

-- | The name of the custom vocabulary filter you want to use in your
-- transcription job request. This name is case sensitive, cannot contain
-- spaces, and must be unique within an Amazon Web Services account.
--
-- Note that if you include @VocabularyFilterName@ in your request, you
-- must also include @VocabularyFilterMethod@.
settings_vocabularyFilterName :: Lens.Lens' Settings (Prelude.Maybe Prelude.Text)
settings_vocabularyFilterName = Lens.lens (\Settings' {vocabularyFilterName} -> vocabularyFilterName) (\s@Settings' {} a -> s {vocabularyFilterName = a} :: Settings)

-- | The name of the custom vocabulary you want to use in your transcription
-- job request. This name is case sensitive, cannot contain spaces, and
-- must be unique within an Amazon Web Services account.
settings_vocabularyName :: Lens.Lens' Settings (Prelude.Maybe Prelude.Text)
settings_vocabularyName = Lens.lens (\Settings' {vocabularyName} -> vocabularyName) (\s@Settings' {} a -> s {vocabularyName = a} :: Settings)

instance Data.FromJSON Settings where
  parseJSON =
    Data.withObject
      "Settings"
      ( \x ->
          Settings'
            Prelude.<$> (x Data..:? "ChannelIdentification")
            Prelude.<*> (x Data..:? "MaxAlternatives")
            Prelude.<*> (x Data..:? "MaxSpeakerLabels")
            Prelude.<*> (x Data..:? "ShowAlternatives")
            Prelude.<*> (x Data..:? "ShowSpeakerLabels")
            Prelude.<*> (x Data..:? "VocabularyFilterMethod")
            Prelude.<*> (x Data..:? "VocabularyFilterName")
            Prelude.<*> (x Data..:? "VocabularyName")
      )

instance Prelude.Hashable Settings where
  hashWithSalt _salt Settings' {..} =
    _salt
      `Prelude.hashWithSalt` channelIdentification
      `Prelude.hashWithSalt` maxAlternatives
      `Prelude.hashWithSalt` maxSpeakerLabels
      `Prelude.hashWithSalt` showAlternatives
      `Prelude.hashWithSalt` showSpeakerLabels
      `Prelude.hashWithSalt` vocabularyFilterMethod
      `Prelude.hashWithSalt` vocabularyFilterName
      `Prelude.hashWithSalt` vocabularyName

instance Prelude.NFData Settings where
  rnf Settings' {..} =
    Prelude.rnf channelIdentification
      `Prelude.seq` Prelude.rnf maxAlternatives
      `Prelude.seq` Prelude.rnf maxSpeakerLabels
      `Prelude.seq` Prelude.rnf showAlternatives
      `Prelude.seq` Prelude.rnf showSpeakerLabels
      `Prelude.seq` Prelude.rnf vocabularyFilterMethod
      `Prelude.seq` Prelude.rnf vocabularyFilterName
      `Prelude.seq` Prelude.rnf vocabularyName

instance Data.ToJSON Settings where
  toJSON Settings' {..} =
    Data.object
      ( Prelude.catMaybes
          [ ("ChannelIdentification" Data..=)
              Prelude.<$> channelIdentification,
            ("MaxAlternatives" Data..=)
              Prelude.<$> maxAlternatives,
            ("MaxSpeakerLabels" Data..=)
              Prelude.<$> maxSpeakerLabels,
            ("ShowAlternatives" Data..=)
              Prelude.<$> showAlternatives,
            ("ShowSpeakerLabels" Data..=)
              Prelude.<$> showSpeakerLabels,
            ("VocabularyFilterMethod" Data..=)
              Prelude.<$> vocabularyFilterMethod,
            ("VocabularyFilterName" Data..=)
              Prelude.<$> vocabularyFilterName,
            ("VocabularyName" Data..=)
              Prelude.<$> vocabularyName
          ]
      )