{-# 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.KeyPhrase where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data KeyPhrase = KeyPhrase'
{
KeyPhrase -> Maybe Int
beginOffset :: Prelude.Maybe Prelude.Int,
KeyPhrase -> Maybe Text
text :: Prelude.Maybe Prelude.Text,
KeyPhrase -> Maybe Double
score :: Prelude.Maybe Prelude.Double,
KeyPhrase -> Maybe Int
endOffset :: Prelude.Maybe Prelude.Int
}
deriving (KeyPhrase -> KeyPhrase -> Bool
(KeyPhrase -> KeyPhrase -> Bool)
-> (KeyPhrase -> KeyPhrase -> Bool) -> Eq KeyPhrase
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyPhrase -> KeyPhrase -> Bool
$c/= :: KeyPhrase -> KeyPhrase -> Bool
== :: KeyPhrase -> KeyPhrase -> Bool
$c== :: KeyPhrase -> KeyPhrase -> Bool
Prelude.Eq, ReadPrec [KeyPhrase]
ReadPrec KeyPhrase
Int -> ReadS KeyPhrase
ReadS [KeyPhrase]
(Int -> ReadS KeyPhrase)
-> ReadS [KeyPhrase]
-> ReadPrec KeyPhrase
-> ReadPrec [KeyPhrase]
-> Read KeyPhrase
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KeyPhrase]
$creadListPrec :: ReadPrec [KeyPhrase]
readPrec :: ReadPrec KeyPhrase
$creadPrec :: ReadPrec KeyPhrase
readList :: ReadS [KeyPhrase]
$creadList :: ReadS [KeyPhrase]
readsPrec :: Int -> ReadS KeyPhrase
$creadsPrec :: Int -> ReadS KeyPhrase
Prelude.Read, Int -> KeyPhrase -> ShowS
[KeyPhrase] -> ShowS
KeyPhrase -> String
(Int -> KeyPhrase -> ShowS)
-> (KeyPhrase -> String)
-> ([KeyPhrase] -> ShowS)
-> Show KeyPhrase
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyPhrase] -> ShowS
$cshowList :: [KeyPhrase] -> ShowS
show :: KeyPhrase -> String
$cshow :: KeyPhrase -> String
showsPrec :: Int -> KeyPhrase -> ShowS
$cshowsPrec :: Int -> KeyPhrase -> ShowS
Prelude.Show, (forall x. KeyPhrase -> Rep KeyPhrase x)
-> (forall x. Rep KeyPhrase x -> KeyPhrase) -> Generic KeyPhrase
forall x. Rep KeyPhrase x -> KeyPhrase
forall x. KeyPhrase -> Rep KeyPhrase x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KeyPhrase x -> KeyPhrase
$cfrom :: forall x. KeyPhrase -> Rep KeyPhrase x
Prelude.Generic)
newKeyPhrase ::
KeyPhrase
newKeyPhrase :: KeyPhrase
newKeyPhrase =
KeyPhrase' :: Maybe Int -> Maybe Text -> Maybe Double -> Maybe Int -> KeyPhrase
KeyPhrase'
{ $sel:beginOffset:KeyPhrase' :: Maybe Int
beginOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:text:KeyPhrase' :: Maybe Text
text = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:score:KeyPhrase' :: Maybe Double
score = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:endOffset:KeyPhrase' :: Maybe Int
endOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
keyPhrase_beginOffset :: Lens.Lens' KeyPhrase (Prelude.Maybe Prelude.Int)
keyPhrase_beginOffset :: (Maybe Int -> f (Maybe Int)) -> KeyPhrase -> f KeyPhrase
keyPhrase_beginOffset = (KeyPhrase -> Maybe Int)
-> (KeyPhrase -> Maybe Int -> KeyPhrase)
-> Lens KeyPhrase KeyPhrase (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyPhrase' {Maybe Int
beginOffset :: Maybe Int
$sel:beginOffset:KeyPhrase' :: KeyPhrase -> Maybe Int
beginOffset} -> Maybe Int
beginOffset) (\s :: KeyPhrase
s@KeyPhrase' {} Maybe Int
a -> KeyPhrase
s {$sel:beginOffset:KeyPhrase' :: Maybe Int
beginOffset = Maybe Int
a} :: KeyPhrase)
keyPhrase_text :: Lens.Lens' KeyPhrase (Prelude.Maybe Prelude.Text)
keyPhrase_text :: (Maybe Text -> f (Maybe Text)) -> KeyPhrase -> f KeyPhrase
keyPhrase_text = (KeyPhrase -> Maybe Text)
-> (KeyPhrase -> Maybe Text -> KeyPhrase)
-> Lens KeyPhrase KeyPhrase (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyPhrase' {Maybe Text
text :: Maybe Text
$sel:text:KeyPhrase' :: KeyPhrase -> Maybe Text
text} -> Maybe Text
text) (\s :: KeyPhrase
s@KeyPhrase' {} Maybe Text
a -> KeyPhrase
s {$sel:text:KeyPhrase' :: Maybe Text
text = Maybe Text
a} :: KeyPhrase)
keyPhrase_score :: Lens.Lens' KeyPhrase (Prelude.Maybe Prelude.Double)
keyPhrase_score :: (Maybe Double -> f (Maybe Double)) -> KeyPhrase -> f KeyPhrase
keyPhrase_score = (KeyPhrase -> Maybe Double)
-> (KeyPhrase -> Maybe Double -> KeyPhrase)
-> Lens KeyPhrase KeyPhrase (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyPhrase' {Maybe Double
score :: Maybe Double
$sel:score:KeyPhrase' :: KeyPhrase -> Maybe Double
score} -> Maybe Double
score) (\s :: KeyPhrase
s@KeyPhrase' {} Maybe Double
a -> KeyPhrase
s {$sel:score:KeyPhrase' :: Maybe Double
score = Maybe Double
a} :: KeyPhrase)
keyPhrase_endOffset :: Lens.Lens' KeyPhrase (Prelude.Maybe Prelude.Int)
keyPhrase_endOffset :: (Maybe Int -> f (Maybe Int)) -> KeyPhrase -> f KeyPhrase
keyPhrase_endOffset = (KeyPhrase -> Maybe Int)
-> (KeyPhrase -> Maybe Int -> KeyPhrase)
-> Lens KeyPhrase KeyPhrase (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyPhrase' {Maybe Int
endOffset :: Maybe Int
$sel:endOffset:KeyPhrase' :: KeyPhrase -> Maybe Int
endOffset} -> Maybe Int
endOffset) (\s :: KeyPhrase
s@KeyPhrase' {} Maybe Int
a -> KeyPhrase
s {$sel:endOffset:KeyPhrase' :: Maybe Int
endOffset = Maybe Int
a} :: KeyPhrase)
instance Core.FromJSON KeyPhrase where
parseJSON :: Value -> Parser KeyPhrase
parseJSON =
String -> (Object -> Parser KeyPhrase) -> Value -> Parser KeyPhrase
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"KeyPhrase"
( \Object
x ->
Maybe Int -> Maybe Text -> Maybe Double -> Maybe Int -> KeyPhrase
KeyPhrase'
(Maybe Int -> Maybe Text -> Maybe Double -> Maybe Int -> KeyPhrase)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Double -> Maybe Int -> KeyPhrase)
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 -> KeyPhrase)
-> Parser (Maybe Text)
-> Parser (Maybe Double -> Maybe Int -> KeyPhrase)
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 -> KeyPhrase)
-> Parser (Maybe Double) -> Parser (Maybe Int -> KeyPhrase)
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 -> KeyPhrase)
-> Parser (Maybe Int) -> Parser KeyPhrase
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")
)
instance Prelude.Hashable KeyPhrase
instance Prelude.NFData KeyPhrase