{-# 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 #-}
module Amazonka.Comprehend.Types.Entity where
import Amazonka.Comprehend.Types.EntityType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Entity = Entity'
{
Entity -> Maybe Int
beginOffset :: Prelude.Maybe Prelude.Int,
Entity -> Maybe Text
text :: Prelude.Maybe Prelude.Text,
Entity -> Maybe Double
score :: Prelude.Maybe Prelude.Double,
Entity -> Maybe Int
endOffset :: Prelude.Maybe Prelude.Int,
Entity -> Maybe EntityType
type' :: Prelude.Maybe EntityType
}
deriving (Entity -> Entity -> Bool
(Entity -> Entity -> Bool)
-> (Entity -> Entity -> Bool) -> Eq Entity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Entity -> Entity -> Bool
$c/= :: Entity -> Entity -> Bool
== :: Entity -> Entity -> Bool
$c== :: Entity -> Entity -> Bool
Prelude.Eq, ReadPrec [Entity]
ReadPrec Entity
Int -> ReadS Entity
ReadS [Entity]
(Int -> ReadS Entity)
-> ReadS [Entity]
-> ReadPrec Entity
-> ReadPrec [Entity]
-> Read Entity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Entity]
$creadListPrec :: ReadPrec [Entity]
readPrec :: ReadPrec Entity
$creadPrec :: ReadPrec Entity
readList :: ReadS [Entity]
$creadList :: ReadS [Entity]
readsPrec :: Int -> ReadS Entity
$creadsPrec :: Int -> ReadS Entity
Prelude.Read, Int -> Entity -> ShowS
[Entity] -> ShowS
Entity -> String
(Int -> Entity -> ShowS)
-> (Entity -> String) -> ([Entity] -> ShowS) -> Show Entity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Entity] -> ShowS
$cshowList :: [Entity] -> ShowS
show :: Entity -> String
$cshow :: Entity -> String
showsPrec :: Int -> Entity -> ShowS
$cshowsPrec :: Int -> Entity -> ShowS
Prelude.Show, (forall x. Entity -> Rep Entity x)
-> (forall x. Rep Entity x -> Entity) -> Generic Entity
forall x. Rep Entity x -> Entity
forall x. Entity -> Rep Entity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Entity x -> Entity
$cfrom :: forall x. Entity -> Rep Entity x
Prelude.Generic)
newEntity ::
Entity
newEntity :: Entity
newEntity =
Entity' :: Maybe Int
-> Maybe Text
-> Maybe Double
-> Maybe Int
-> Maybe EntityType
-> Entity
Entity'
{ $sel:beginOffset:Entity' :: Maybe Int
beginOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:text:Entity' :: Maybe Text
text = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:score:Entity' :: Maybe Double
score = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:endOffset:Entity' :: Maybe Int
endOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:type':Entity' :: Maybe EntityType
type' = Maybe EntityType
forall a. Maybe a
Prelude.Nothing
}
entity_beginOffset :: Lens.Lens' Entity (Prelude.Maybe Prelude.Int)
entity_beginOffset :: (Maybe Int -> f (Maybe Int)) -> Entity -> f Entity
entity_beginOffset = (Entity -> Maybe Int)
-> (Entity -> Maybe Int -> Entity)
-> Lens Entity Entity (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entity' {Maybe Int
beginOffset :: Maybe Int
$sel:beginOffset:Entity' :: Entity -> Maybe Int
beginOffset} -> Maybe Int
beginOffset) (\s :: Entity
s@Entity' {} Maybe Int
a -> Entity
s {$sel:beginOffset:Entity' :: Maybe Int
beginOffset = Maybe Int
a} :: Entity)
entity_text :: Lens.Lens' Entity (Prelude.Maybe Prelude.Text)
entity_text :: (Maybe Text -> f (Maybe Text)) -> Entity -> f Entity
entity_text = (Entity -> Maybe Text)
-> (Entity -> Maybe Text -> Entity)
-> Lens Entity Entity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entity' {Maybe Text
text :: Maybe Text
$sel:text:Entity' :: Entity -> Maybe Text
text} -> Maybe Text
text) (\s :: Entity
s@Entity' {} Maybe Text
a -> Entity
s {$sel:text:Entity' :: Maybe Text
text = Maybe Text
a} :: Entity)
entity_score :: Lens.Lens' Entity (Prelude.Maybe Prelude.Double)
entity_score :: (Maybe Double -> f (Maybe Double)) -> Entity -> f Entity
entity_score = (Entity -> Maybe Double)
-> (Entity -> Maybe Double -> Entity)
-> Lens Entity Entity (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entity' {Maybe Double
score :: Maybe Double
$sel:score:Entity' :: Entity -> Maybe Double
score} -> Maybe Double
score) (\s :: Entity
s@Entity' {} Maybe Double
a -> Entity
s {$sel:score:Entity' :: Maybe Double
score = Maybe Double
a} :: Entity)
entity_endOffset :: Lens.Lens' Entity (Prelude.Maybe Prelude.Int)
entity_endOffset :: (Maybe Int -> f (Maybe Int)) -> Entity -> f Entity
entity_endOffset = (Entity -> Maybe Int)
-> (Entity -> Maybe Int -> Entity)
-> Lens Entity Entity (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entity' {Maybe Int
endOffset :: Maybe Int
$sel:endOffset:Entity' :: Entity -> Maybe Int
endOffset} -> Maybe Int
endOffset) (\s :: Entity
s@Entity' {} Maybe Int
a -> Entity
s {$sel:endOffset:Entity' :: Maybe Int
endOffset = Maybe Int
a} :: Entity)
entity_type :: Lens.Lens' Entity (Prelude.Maybe EntityType)
entity_type :: (Maybe EntityType -> f (Maybe EntityType)) -> Entity -> f Entity
entity_type = (Entity -> Maybe EntityType)
-> (Entity -> Maybe EntityType -> Entity)
-> Lens Entity Entity (Maybe EntityType) (Maybe EntityType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entity' {Maybe EntityType
type' :: Maybe EntityType
$sel:type':Entity' :: Entity -> Maybe EntityType
type'} -> Maybe EntityType
type') (\s :: Entity
s@Entity' {} Maybe EntityType
a -> Entity
s {$sel:type':Entity' :: Maybe EntityType
type' = Maybe EntityType
a} :: Entity)
instance Core.FromJSON Entity where
parseJSON :: Value -> Parser Entity
parseJSON =
String -> (Object -> Parser Entity) -> Value -> Parser Entity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Entity"
( \Object
x ->
Maybe Int
-> Maybe Text
-> Maybe Double
-> Maybe Int
-> Maybe EntityType
-> Entity
Entity'
(Maybe Int
-> Maybe Text
-> Maybe Double
-> Maybe Int
-> Maybe EntityType
-> Entity)
-> Parser (Maybe Int)
-> Parser
(Maybe Text
-> Maybe Double -> Maybe Int -> Maybe EntityType -> Entity)
forall (f :: * -> *) a b. Functor 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
"BeginOffset")
Parser
(Maybe Text
-> Maybe Double -> Maybe Int -> Maybe EntityType -> Entity)
-> Parser (Maybe Text)
-> Parser (Maybe Double -> Maybe Int -> Maybe EntityType -> Entity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Text")
Parser (Maybe Double -> Maybe Int -> Maybe EntityType -> Entity)
-> Parser (Maybe Double)
-> Parser (Maybe Int -> Maybe EntityType -> Entity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Score")
Parser (Maybe Int -> Maybe EntityType -> Entity)
-> Parser (Maybe Int) -> Parser (Maybe EntityType -> Entity)
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
"EndOffset")
Parser (Maybe EntityType -> Entity)
-> Parser (Maybe EntityType) -> Parser Entity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EntityType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
)
instance Prelude.Hashable Entity
instance Prelude.NFData Entity