{-# 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.SentimentScore where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SentimentScore = SentimentScore'
{
SentimentScore -> Maybe Double
mixed :: Prelude.Maybe Prelude.Double,
SentimentScore -> Maybe Double
negative :: Prelude.Maybe Prelude.Double,
SentimentScore -> Maybe Double
neutral :: Prelude.Maybe Prelude.Double,
SentimentScore -> Maybe Double
positive :: Prelude.Maybe Prelude.Double
}
deriving (SentimentScore -> SentimentScore -> Bool
(SentimentScore -> SentimentScore -> Bool)
-> (SentimentScore -> SentimentScore -> Bool) -> Eq SentimentScore
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SentimentScore -> SentimentScore -> Bool
$c/= :: SentimentScore -> SentimentScore -> Bool
== :: SentimentScore -> SentimentScore -> Bool
$c== :: SentimentScore -> SentimentScore -> Bool
Prelude.Eq, ReadPrec [SentimentScore]
ReadPrec SentimentScore
Int -> ReadS SentimentScore
ReadS [SentimentScore]
(Int -> ReadS SentimentScore)
-> ReadS [SentimentScore]
-> ReadPrec SentimentScore
-> ReadPrec [SentimentScore]
-> Read SentimentScore
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SentimentScore]
$creadListPrec :: ReadPrec [SentimentScore]
readPrec :: ReadPrec SentimentScore
$creadPrec :: ReadPrec SentimentScore
readList :: ReadS [SentimentScore]
$creadList :: ReadS [SentimentScore]
readsPrec :: Int -> ReadS SentimentScore
$creadsPrec :: Int -> ReadS SentimentScore
Prelude.Read, Int -> SentimentScore -> ShowS
[SentimentScore] -> ShowS
SentimentScore -> String
(Int -> SentimentScore -> ShowS)
-> (SentimentScore -> String)
-> ([SentimentScore] -> ShowS)
-> Show SentimentScore
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SentimentScore] -> ShowS
$cshowList :: [SentimentScore] -> ShowS
show :: SentimentScore -> String
$cshow :: SentimentScore -> String
showsPrec :: Int -> SentimentScore -> ShowS
$cshowsPrec :: Int -> SentimentScore -> ShowS
Prelude.Show, (forall x. SentimentScore -> Rep SentimentScore x)
-> (forall x. Rep SentimentScore x -> SentimentScore)
-> Generic SentimentScore
forall x. Rep SentimentScore x -> SentimentScore
forall x. SentimentScore -> Rep SentimentScore x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SentimentScore x -> SentimentScore
$cfrom :: forall x. SentimentScore -> Rep SentimentScore x
Prelude.Generic)
newSentimentScore ::
SentimentScore
newSentimentScore :: SentimentScore
newSentimentScore =
SentimentScore' :: Maybe Double
-> Maybe Double -> Maybe Double -> Maybe Double -> SentimentScore
SentimentScore'
{ $sel:mixed:SentimentScore' :: Maybe Double
mixed = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:negative:SentimentScore' :: Maybe Double
negative = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:neutral:SentimentScore' :: Maybe Double
neutral = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:positive:SentimentScore' :: Maybe Double
positive = Maybe Double
forall a. Maybe a
Prelude.Nothing
}
sentimentScore_mixed :: Lens.Lens' SentimentScore (Prelude.Maybe Prelude.Double)
sentimentScore_mixed :: (Maybe Double -> f (Maybe Double))
-> SentimentScore -> f SentimentScore
sentimentScore_mixed = (SentimentScore -> Maybe Double)
-> (SentimentScore -> Maybe Double -> SentimentScore)
-> Lens SentimentScore SentimentScore (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SentimentScore' {Maybe Double
mixed :: Maybe Double
$sel:mixed:SentimentScore' :: SentimentScore -> Maybe Double
mixed} -> Maybe Double
mixed) (\s :: SentimentScore
s@SentimentScore' {} Maybe Double
a -> SentimentScore
s {$sel:mixed:SentimentScore' :: Maybe Double
mixed = Maybe Double
a} :: SentimentScore)
sentimentScore_negative :: Lens.Lens' SentimentScore (Prelude.Maybe Prelude.Double)
sentimentScore_negative :: (Maybe Double -> f (Maybe Double))
-> SentimentScore -> f SentimentScore
sentimentScore_negative = (SentimentScore -> Maybe Double)
-> (SentimentScore -> Maybe Double -> SentimentScore)
-> Lens SentimentScore SentimentScore (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SentimentScore' {Maybe Double
negative :: Maybe Double
$sel:negative:SentimentScore' :: SentimentScore -> Maybe Double
negative} -> Maybe Double
negative) (\s :: SentimentScore
s@SentimentScore' {} Maybe Double
a -> SentimentScore
s {$sel:negative:SentimentScore' :: Maybe Double
negative = Maybe Double
a} :: SentimentScore)
sentimentScore_neutral :: Lens.Lens' SentimentScore (Prelude.Maybe Prelude.Double)
sentimentScore_neutral :: (Maybe Double -> f (Maybe Double))
-> SentimentScore -> f SentimentScore
sentimentScore_neutral = (SentimentScore -> Maybe Double)
-> (SentimentScore -> Maybe Double -> SentimentScore)
-> Lens SentimentScore SentimentScore (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SentimentScore' {Maybe Double
neutral :: Maybe Double
$sel:neutral:SentimentScore' :: SentimentScore -> Maybe Double
neutral} -> Maybe Double
neutral) (\s :: SentimentScore
s@SentimentScore' {} Maybe Double
a -> SentimentScore
s {$sel:neutral:SentimentScore' :: Maybe Double
neutral = Maybe Double
a} :: SentimentScore)
sentimentScore_positive :: Lens.Lens' SentimentScore (Prelude.Maybe Prelude.Double)
sentimentScore_positive :: (Maybe Double -> f (Maybe Double))
-> SentimentScore -> f SentimentScore
sentimentScore_positive = (SentimentScore -> Maybe Double)
-> (SentimentScore -> Maybe Double -> SentimentScore)
-> Lens SentimentScore SentimentScore (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SentimentScore' {Maybe Double
positive :: Maybe Double
$sel:positive:SentimentScore' :: SentimentScore -> Maybe Double
positive} -> Maybe Double
positive) (\s :: SentimentScore
s@SentimentScore' {} Maybe Double
a -> SentimentScore
s {$sel:positive:SentimentScore' :: Maybe Double
positive = Maybe Double
a} :: SentimentScore)
instance Core.FromJSON SentimentScore where
parseJSON :: Value -> Parser SentimentScore
parseJSON =
String
-> (Object -> Parser SentimentScore)
-> Value
-> Parser SentimentScore
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SentimentScore"
( \Object
x ->
Maybe Double
-> Maybe Double -> Maybe Double -> Maybe Double -> SentimentScore
SentimentScore'
(Maybe Double
-> Maybe Double -> Maybe Double -> Maybe Double -> SentimentScore)
-> Parser (Maybe Double)
-> Parser
(Maybe Double -> Maybe Double -> Maybe Double -> SentimentScore)
forall (f :: * -> *) a b. Functor 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
"Mixed")
Parser
(Maybe Double -> Maybe Double -> Maybe Double -> SentimentScore)
-> Parser (Maybe Double)
-> Parser (Maybe Double -> Maybe Double -> SentimentScore)
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
"Negative")
Parser (Maybe Double -> Maybe Double -> SentimentScore)
-> Parser (Maybe Double) -> Parser (Maybe Double -> SentimentScore)
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
"Neutral")
Parser (Maybe Double -> SentimentScore)
-> Parser (Maybe Double) -> Parser SentimentScore
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
"Positive")
)
instance Prelude.Hashable SentimentScore
instance Prelude.NFData SentimentScore