{-# 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.Comprehend.Types.EntityRecognizerMetadata
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Comprehend.Types.EntityRecognizerMetadata where

import Amazonka.Comprehend.Types.EntityRecognizerEvaluationMetrics
import Amazonka.Comprehend.Types.EntityRecognizerMetadataEntityTypesListItem
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Detailed information about an entity recognizer.
--
-- /See:/ 'newEntityRecognizerMetadata' smart constructor.
data EntityRecognizerMetadata = EntityRecognizerMetadata'
  { -- | Entity types from the metadata of an entity recognizer.
    EntityRecognizerMetadata
-> Maybe [EntityRecognizerMetadataEntityTypesListItem]
entityTypes :: Prelude.Maybe [EntityRecognizerMetadataEntityTypesListItem],
    -- | Detailed information about the accuracy of an entity recognizer.
    EntityRecognizerMetadata -> Maybe EntityRecognizerEvaluationMetrics
evaluationMetrics :: Prelude.Maybe EntityRecognizerEvaluationMetrics,
    -- | The number of documents in the input data that were used to train the
    -- entity recognizer. Typically this is 80 to 90 percent of the input
    -- documents.
    EntityRecognizerMetadata -> Maybe Int
numberOfTrainedDocuments :: Prelude.Maybe Prelude.Int,
    -- | The number of documents in the input data that were used to test the
    -- entity recognizer. Typically this is 10 to 20 percent of the input
    -- documents.
    EntityRecognizerMetadata -> Maybe Int
numberOfTestDocuments :: Prelude.Maybe Prelude.Int
  }
  deriving (EntityRecognizerMetadata -> EntityRecognizerMetadata -> Bool
(EntityRecognizerMetadata -> EntityRecognizerMetadata -> Bool)
-> (EntityRecognizerMetadata -> EntityRecognizerMetadata -> Bool)
-> Eq EntityRecognizerMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EntityRecognizerMetadata -> EntityRecognizerMetadata -> Bool
$c/= :: EntityRecognizerMetadata -> EntityRecognizerMetadata -> Bool
== :: EntityRecognizerMetadata -> EntityRecognizerMetadata -> Bool
$c== :: EntityRecognizerMetadata -> EntityRecognizerMetadata -> Bool
Prelude.Eq, Int -> EntityRecognizerMetadata -> ShowS
[EntityRecognizerMetadata] -> ShowS
EntityRecognizerMetadata -> String
(Int -> EntityRecognizerMetadata -> ShowS)
-> (EntityRecognizerMetadata -> String)
-> ([EntityRecognizerMetadata] -> ShowS)
-> Show EntityRecognizerMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EntityRecognizerMetadata] -> ShowS
$cshowList :: [EntityRecognizerMetadata] -> ShowS
show :: EntityRecognizerMetadata -> String
$cshow :: EntityRecognizerMetadata -> String
showsPrec :: Int -> EntityRecognizerMetadata -> ShowS
$cshowsPrec :: Int -> EntityRecognizerMetadata -> ShowS
Prelude.Show, (forall x.
 EntityRecognizerMetadata -> Rep EntityRecognizerMetadata x)
-> (forall x.
    Rep EntityRecognizerMetadata x -> EntityRecognizerMetadata)
-> Generic EntityRecognizerMetadata
forall x.
Rep EntityRecognizerMetadata x -> EntityRecognizerMetadata
forall x.
EntityRecognizerMetadata -> Rep EntityRecognizerMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EntityRecognizerMetadata x -> EntityRecognizerMetadata
$cfrom :: forall x.
EntityRecognizerMetadata -> Rep EntityRecognizerMetadata x
Prelude.Generic)

-- |
-- Create a value of 'EntityRecognizerMetadata' 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:
--
-- 'entityTypes', 'entityRecognizerMetadata_entityTypes' - Entity types from the metadata of an entity recognizer.
--
-- 'evaluationMetrics', 'entityRecognizerMetadata_evaluationMetrics' - Detailed information about the accuracy of an entity recognizer.
--
-- 'numberOfTrainedDocuments', 'entityRecognizerMetadata_numberOfTrainedDocuments' - The number of documents in the input data that were used to train the
-- entity recognizer. Typically this is 80 to 90 percent of the input
-- documents.
--
-- 'numberOfTestDocuments', 'entityRecognizerMetadata_numberOfTestDocuments' - The number of documents in the input data that were used to test the
-- entity recognizer. Typically this is 10 to 20 percent of the input
-- documents.
newEntityRecognizerMetadata ::
  EntityRecognizerMetadata
newEntityRecognizerMetadata :: EntityRecognizerMetadata
newEntityRecognizerMetadata =
  EntityRecognizerMetadata' :: Maybe [EntityRecognizerMetadataEntityTypesListItem]
-> Maybe EntityRecognizerEvaluationMetrics
-> Maybe Int
-> Maybe Int
-> EntityRecognizerMetadata
EntityRecognizerMetadata'
    { $sel:entityTypes:EntityRecognizerMetadata' :: Maybe [EntityRecognizerMetadataEntityTypesListItem]
entityTypes =
        Maybe [EntityRecognizerMetadataEntityTypesListItem]
forall a. Maybe a
Prelude.Nothing,
      $sel:evaluationMetrics:EntityRecognizerMetadata' :: Maybe EntityRecognizerEvaluationMetrics
evaluationMetrics = Maybe EntityRecognizerEvaluationMetrics
forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfTrainedDocuments:EntityRecognizerMetadata' :: Maybe Int
numberOfTrainedDocuments = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfTestDocuments:EntityRecognizerMetadata' :: Maybe Int
numberOfTestDocuments = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Entity types from the metadata of an entity recognizer.
entityRecognizerMetadata_entityTypes :: Lens.Lens' EntityRecognizerMetadata (Prelude.Maybe [EntityRecognizerMetadataEntityTypesListItem])
entityRecognizerMetadata_entityTypes :: (Maybe [EntityRecognizerMetadataEntityTypesListItem]
 -> f (Maybe [EntityRecognizerMetadataEntityTypesListItem]))
-> EntityRecognizerMetadata -> f EntityRecognizerMetadata
entityRecognizerMetadata_entityTypes = (EntityRecognizerMetadata
 -> Maybe [EntityRecognizerMetadataEntityTypesListItem])
-> (EntityRecognizerMetadata
    -> Maybe [EntityRecognizerMetadataEntityTypesListItem]
    -> EntityRecognizerMetadata)
-> Lens
     EntityRecognizerMetadata
     EntityRecognizerMetadata
     (Maybe [EntityRecognizerMetadataEntityTypesListItem])
     (Maybe [EntityRecognizerMetadataEntityTypesListItem])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntityRecognizerMetadata' {Maybe [EntityRecognizerMetadataEntityTypesListItem]
entityTypes :: Maybe [EntityRecognizerMetadataEntityTypesListItem]
$sel:entityTypes:EntityRecognizerMetadata' :: EntityRecognizerMetadata
-> Maybe [EntityRecognizerMetadataEntityTypesListItem]
entityTypes} -> Maybe [EntityRecognizerMetadataEntityTypesListItem]
entityTypes) (\s :: EntityRecognizerMetadata
s@EntityRecognizerMetadata' {} Maybe [EntityRecognizerMetadataEntityTypesListItem]
a -> EntityRecognizerMetadata
s {$sel:entityTypes:EntityRecognizerMetadata' :: Maybe [EntityRecognizerMetadataEntityTypesListItem]
entityTypes = Maybe [EntityRecognizerMetadataEntityTypesListItem]
a} :: EntityRecognizerMetadata) ((Maybe [EntityRecognizerMetadataEntityTypesListItem]
  -> f (Maybe [EntityRecognizerMetadataEntityTypesListItem]))
 -> EntityRecognizerMetadata -> f EntityRecognizerMetadata)
-> ((Maybe [EntityRecognizerMetadataEntityTypesListItem]
     -> f (Maybe [EntityRecognizerMetadataEntityTypesListItem]))
    -> Maybe [EntityRecognizerMetadataEntityTypesListItem]
    -> f (Maybe [EntityRecognizerMetadataEntityTypesListItem]))
-> (Maybe [EntityRecognizerMetadataEntityTypesListItem]
    -> f (Maybe [EntityRecognizerMetadataEntityTypesListItem]))
-> EntityRecognizerMetadata
-> f EntityRecognizerMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EntityRecognizerMetadataEntityTypesListItem]
  [EntityRecognizerMetadataEntityTypesListItem]
  [EntityRecognizerMetadataEntityTypesListItem]
  [EntityRecognizerMetadataEntityTypesListItem]
-> Iso
     (Maybe [EntityRecognizerMetadataEntityTypesListItem])
     (Maybe [EntityRecognizerMetadataEntityTypesListItem])
     (Maybe [EntityRecognizerMetadataEntityTypesListItem])
     (Maybe [EntityRecognizerMetadataEntityTypesListItem])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [EntityRecognizerMetadataEntityTypesListItem]
  [EntityRecognizerMetadataEntityTypesListItem]
  [EntityRecognizerMetadataEntityTypesListItem]
  [EntityRecognizerMetadataEntityTypesListItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Detailed information about the accuracy of an entity recognizer.
entityRecognizerMetadata_evaluationMetrics :: Lens.Lens' EntityRecognizerMetadata (Prelude.Maybe EntityRecognizerEvaluationMetrics)
entityRecognizerMetadata_evaluationMetrics :: (Maybe EntityRecognizerEvaluationMetrics
 -> f (Maybe EntityRecognizerEvaluationMetrics))
-> EntityRecognizerMetadata -> f EntityRecognizerMetadata
entityRecognizerMetadata_evaluationMetrics = (EntityRecognizerMetadata
 -> Maybe EntityRecognizerEvaluationMetrics)
-> (EntityRecognizerMetadata
    -> Maybe EntityRecognizerEvaluationMetrics
    -> EntityRecognizerMetadata)
-> Lens
     EntityRecognizerMetadata
     EntityRecognizerMetadata
     (Maybe EntityRecognizerEvaluationMetrics)
     (Maybe EntityRecognizerEvaluationMetrics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntityRecognizerMetadata' {Maybe EntityRecognizerEvaluationMetrics
evaluationMetrics :: Maybe EntityRecognizerEvaluationMetrics
$sel:evaluationMetrics:EntityRecognizerMetadata' :: EntityRecognizerMetadata -> Maybe EntityRecognizerEvaluationMetrics
evaluationMetrics} -> Maybe EntityRecognizerEvaluationMetrics
evaluationMetrics) (\s :: EntityRecognizerMetadata
s@EntityRecognizerMetadata' {} Maybe EntityRecognizerEvaluationMetrics
a -> EntityRecognizerMetadata
s {$sel:evaluationMetrics:EntityRecognizerMetadata' :: Maybe EntityRecognizerEvaluationMetrics
evaluationMetrics = Maybe EntityRecognizerEvaluationMetrics
a} :: EntityRecognizerMetadata)

-- | The number of documents in the input data that were used to train the
-- entity recognizer. Typically this is 80 to 90 percent of the input
-- documents.
entityRecognizerMetadata_numberOfTrainedDocuments :: Lens.Lens' EntityRecognizerMetadata (Prelude.Maybe Prelude.Int)
entityRecognizerMetadata_numberOfTrainedDocuments :: (Maybe Int -> f (Maybe Int))
-> EntityRecognizerMetadata -> f EntityRecognizerMetadata
entityRecognizerMetadata_numberOfTrainedDocuments = (EntityRecognizerMetadata -> Maybe Int)
-> (EntityRecognizerMetadata
    -> Maybe Int -> EntityRecognizerMetadata)
-> Lens
     EntityRecognizerMetadata
     EntityRecognizerMetadata
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntityRecognizerMetadata' {Maybe Int
numberOfTrainedDocuments :: Maybe Int
$sel:numberOfTrainedDocuments:EntityRecognizerMetadata' :: EntityRecognizerMetadata -> Maybe Int
numberOfTrainedDocuments} -> Maybe Int
numberOfTrainedDocuments) (\s :: EntityRecognizerMetadata
s@EntityRecognizerMetadata' {} Maybe Int
a -> EntityRecognizerMetadata
s {$sel:numberOfTrainedDocuments:EntityRecognizerMetadata' :: Maybe Int
numberOfTrainedDocuments = Maybe Int
a} :: EntityRecognizerMetadata)

-- | The number of documents in the input data that were used to test the
-- entity recognizer. Typically this is 10 to 20 percent of the input
-- documents.
entityRecognizerMetadata_numberOfTestDocuments :: Lens.Lens' EntityRecognizerMetadata (Prelude.Maybe Prelude.Int)
entityRecognizerMetadata_numberOfTestDocuments :: (Maybe Int -> f (Maybe Int))
-> EntityRecognizerMetadata -> f EntityRecognizerMetadata
entityRecognizerMetadata_numberOfTestDocuments = (EntityRecognizerMetadata -> Maybe Int)
-> (EntityRecognizerMetadata
    -> Maybe Int -> EntityRecognizerMetadata)
-> Lens
     EntityRecognizerMetadata
     EntityRecognizerMetadata
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntityRecognizerMetadata' {Maybe Int
numberOfTestDocuments :: Maybe Int
$sel:numberOfTestDocuments:EntityRecognizerMetadata' :: EntityRecognizerMetadata -> Maybe Int
numberOfTestDocuments} -> Maybe Int
numberOfTestDocuments) (\s :: EntityRecognizerMetadata
s@EntityRecognizerMetadata' {} Maybe Int
a -> EntityRecognizerMetadata
s {$sel:numberOfTestDocuments:EntityRecognizerMetadata' :: Maybe Int
numberOfTestDocuments = Maybe Int
a} :: EntityRecognizerMetadata)

instance Core.FromJSON EntityRecognizerMetadata where
  parseJSON :: Value -> Parser EntityRecognizerMetadata
parseJSON =
    String
-> (Object -> Parser EntityRecognizerMetadata)
-> Value
-> Parser EntityRecognizerMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EntityRecognizerMetadata"
      ( \Object
x ->
          Maybe [EntityRecognizerMetadataEntityTypesListItem]
-> Maybe EntityRecognizerEvaluationMetrics
-> Maybe Int
-> Maybe Int
-> EntityRecognizerMetadata
EntityRecognizerMetadata'
            (Maybe [EntityRecognizerMetadataEntityTypesListItem]
 -> Maybe EntityRecognizerEvaluationMetrics
 -> Maybe Int
 -> Maybe Int
 -> EntityRecognizerMetadata)
-> Parser (Maybe [EntityRecognizerMetadataEntityTypesListItem])
-> Parser
     (Maybe EntityRecognizerEvaluationMetrics
      -> Maybe Int -> Maybe Int -> EntityRecognizerMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser
     (Maybe (Maybe [EntityRecognizerMetadataEntityTypesListItem]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EntityTypes" Parser
  (Maybe (Maybe [EntityRecognizerMetadataEntityTypesListItem]))
-> Maybe [EntityRecognizerMetadataEntityTypesListItem]
-> Parser (Maybe [EntityRecognizerMetadataEntityTypesListItem])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [EntityRecognizerMetadataEntityTypesListItem]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe EntityRecognizerEvaluationMetrics
   -> Maybe Int -> Maybe Int -> EntityRecognizerMetadata)
-> Parser (Maybe EntityRecognizerEvaluationMetrics)
-> Parser (Maybe Int -> Maybe Int -> EntityRecognizerMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EntityRecognizerEvaluationMetrics)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EvaluationMetrics")
            Parser (Maybe Int -> Maybe Int -> EntityRecognizerMetadata)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> EntityRecognizerMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NumberOfTrainedDocuments")
            Parser (Maybe Int -> EntityRecognizerMetadata)
-> Parser (Maybe Int) -> Parser EntityRecognizerMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NumberOfTestDocuments")
      )

instance Prelude.Hashable EntityRecognizerMetadata

instance Prelude.NFData EntityRecognizerMetadata