{-# 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.SyntaxToken where
import Amazonka.Comprehend.Types.PartOfSpeechTag
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SyntaxToken = SyntaxToken'
{
SyntaxToken -> Maybe Int
beginOffset :: Prelude.Maybe Prelude.Int,
SyntaxToken -> Maybe Text
text :: Prelude.Maybe Prelude.Text,
SyntaxToken -> Maybe Int
tokenId :: Prelude.Maybe Prelude.Int,
SyntaxToken -> Maybe Int
endOffset :: Prelude.Maybe Prelude.Int,
SyntaxToken -> Maybe PartOfSpeechTag
partOfSpeech :: Prelude.Maybe PartOfSpeechTag
}
deriving (SyntaxToken -> SyntaxToken -> Bool
(SyntaxToken -> SyntaxToken -> Bool)
-> (SyntaxToken -> SyntaxToken -> Bool) -> Eq SyntaxToken
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SyntaxToken -> SyntaxToken -> Bool
$c/= :: SyntaxToken -> SyntaxToken -> Bool
== :: SyntaxToken -> SyntaxToken -> Bool
$c== :: SyntaxToken -> SyntaxToken -> Bool
Prelude.Eq, ReadPrec [SyntaxToken]
ReadPrec SyntaxToken
Int -> ReadS SyntaxToken
ReadS [SyntaxToken]
(Int -> ReadS SyntaxToken)
-> ReadS [SyntaxToken]
-> ReadPrec SyntaxToken
-> ReadPrec [SyntaxToken]
-> Read SyntaxToken
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SyntaxToken]
$creadListPrec :: ReadPrec [SyntaxToken]
readPrec :: ReadPrec SyntaxToken
$creadPrec :: ReadPrec SyntaxToken
readList :: ReadS [SyntaxToken]
$creadList :: ReadS [SyntaxToken]
readsPrec :: Int -> ReadS SyntaxToken
$creadsPrec :: Int -> ReadS SyntaxToken
Prelude.Read, Int -> SyntaxToken -> ShowS
[SyntaxToken] -> ShowS
SyntaxToken -> String
(Int -> SyntaxToken -> ShowS)
-> (SyntaxToken -> String)
-> ([SyntaxToken] -> ShowS)
-> Show SyntaxToken
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SyntaxToken] -> ShowS
$cshowList :: [SyntaxToken] -> ShowS
show :: SyntaxToken -> String
$cshow :: SyntaxToken -> String
showsPrec :: Int -> SyntaxToken -> ShowS
$cshowsPrec :: Int -> SyntaxToken -> ShowS
Prelude.Show, (forall x. SyntaxToken -> Rep SyntaxToken x)
-> (forall x. Rep SyntaxToken x -> SyntaxToken)
-> Generic SyntaxToken
forall x. Rep SyntaxToken x -> SyntaxToken
forall x. SyntaxToken -> Rep SyntaxToken x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SyntaxToken x -> SyntaxToken
$cfrom :: forall x. SyntaxToken -> Rep SyntaxToken x
Prelude.Generic)
newSyntaxToken ::
SyntaxToken
newSyntaxToken :: SyntaxToken
newSyntaxToken =
SyntaxToken' :: Maybe Int
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> Maybe PartOfSpeechTag
-> SyntaxToken
SyntaxToken'
{ $sel:beginOffset:SyntaxToken' :: Maybe Int
beginOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:text:SyntaxToken' :: Maybe Text
text = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tokenId:SyntaxToken' :: Maybe Int
tokenId = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:endOffset:SyntaxToken' :: Maybe Int
endOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:partOfSpeech:SyntaxToken' :: Maybe PartOfSpeechTag
partOfSpeech = Maybe PartOfSpeechTag
forall a. Maybe a
Prelude.Nothing
}
syntaxToken_beginOffset :: Lens.Lens' SyntaxToken (Prelude.Maybe Prelude.Int)
syntaxToken_beginOffset :: (Maybe Int -> f (Maybe Int)) -> SyntaxToken -> f SyntaxToken
syntaxToken_beginOffset = (SyntaxToken -> Maybe Int)
-> (SyntaxToken -> Maybe Int -> SyntaxToken)
-> Lens SyntaxToken SyntaxToken (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SyntaxToken' {Maybe Int
beginOffset :: Maybe Int
$sel:beginOffset:SyntaxToken' :: SyntaxToken -> Maybe Int
beginOffset} -> Maybe Int
beginOffset) (\s :: SyntaxToken
s@SyntaxToken' {} Maybe Int
a -> SyntaxToken
s {$sel:beginOffset:SyntaxToken' :: Maybe Int
beginOffset = Maybe Int
a} :: SyntaxToken)
syntaxToken_text :: Lens.Lens' SyntaxToken (Prelude.Maybe Prelude.Text)
syntaxToken_text :: (Maybe Text -> f (Maybe Text)) -> SyntaxToken -> f SyntaxToken
syntaxToken_text = (SyntaxToken -> Maybe Text)
-> (SyntaxToken -> Maybe Text -> SyntaxToken)
-> Lens SyntaxToken SyntaxToken (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SyntaxToken' {Maybe Text
text :: Maybe Text
$sel:text:SyntaxToken' :: SyntaxToken -> Maybe Text
text} -> Maybe Text
text) (\s :: SyntaxToken
s@SyntaxToken' {} Maybe Text
a -> SyntaxToken
s {$sel:text:SyntaxToken' :: Maybe Text
text = Maybe Text
a} :: SyntaxToken)
syntaxToken_tokenId :: Lens.Lens' SyntaxToken (Prelude.Maybe Prelude.Int)
syntaxToken_tokenId :: (Maybe Int -> f (Maybe Int)) -> SyntaxToken -> f SyntaxToken
syntaxToken_tokenId = (SyntaxToken -> Maybe Int)
-> (SyntaxToken -> Maybe Int -> SyntaxToken)
-> Lens SyntaxToken SyntaxToken (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SyntaxToken' {Maybe Int
tokenId :: Maybe Int
$sel:tokenId:SyntaxToken' :: SyntaxToken -> Maybe Int
tokenId} -> Maybe Int
tokenId) (\s :: SyntaxToken
s@SyntaxToken' {} Maybe Int
a -> SyntaxToken
s {$sel:tokenId:SyntaxToken' :: Maybe Int
tokenId = Maybe Int
a} :: SyntaxToken)
syntaxToken_endOffset :: Lens.Lens' SyntaxToken (Prelude.Maybe Prelude.Int)
syntaxToken_endOffset :: (Maybe Int -> f (Maybe Int)) -> SyntaxToken -> f SyntaxToken
syntaxToken_endOffset = (SyntaxToken -> Maybe Int)
-> (SyntaxToken -> Maybe Int -> SyntaxToken)
-> Lens SyntaxToken SyntaxToken (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SyntaxToken' {Maybe Int
endOffset :: Maybe Int
$sel:endOffset:SyntaxToken' :: SyntaxToken -> Maybe Int
endOffset} -> Maybe Int
endOffset) (\s :: SyntaxToken
s@SyntaxToken' {} Maybe Int
a -> SyntaxToken
s {$sel:endOffset:SyntaxToken' :: Maybe Int
endOffset = Maybe Int
a} :: SyntaxToken)
syntaxToken_partOfSpeech :: Lens.Lens' SyntaxToken (Prelude.Maybe PartOfSpeechTag)
syntaxToken_partOfSpeech :: (Maybe PartOfSpeechTag -> f (Maybe PartOfSpeechTag))
-> SyntaxToken -> f SyntaxToken
syntaxToken_partOfSpeech = (SyntaxToken -> Maybe PartOfSpeechTag)
-> (SyntaxToken -> Maybe PartOfSpeechTag -> SyntaxToken)
-> Lens
SyntaxToken
SyntaxToken
(Maybe PartOfSpeechTag)
(Maybe PartOfSpeechTag)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SyntaxToken' {Maybe PartOfSpeechTag
partOfSpeech :: Maybe PartOfSpeechTag
$sel:partOfSpeech:SyntaxToken' :: SyntaxToken -> Maybe PartOfSpeechTag
partOfSpeech} -> Maybe PartOfSpeechTag
partOfSpeech) (\s :: SyntaxToken
s@SyntaxToken' {} Maybe PartOfSpeechTag
a -> SyntaxToken
s {$sel:partOfSpeech:SyntaxToken' :: Maybe PartOfSpeechTag
partOfSpeech = Maybe PartOfSpeechTag
a} :: SyntaxToken)
instance Core.FromJSON SyntaxToken where
parseJSON :: Value -> Parser SyntaxToken
parseJSON =
String
-> (Object -> Parser SyntaxToken) -> Value -> Parser SyntaxToken
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SyntaxToken"
( \Object
x ->
Maybe Int
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> Maybe PartOfSpeechTag
-> SyntaxToken
SyntaxToken'
(Maybe Int
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> Maybe PartOfSpeechTag
-> SyntaxToken)
-> Parser (Maybe Int)
-> Parser
(Maybe Text
-> Maybe Int -> Maybe Int -> Maybe PartOfSpeechTag -> SyntaxToken)
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 Int -> Maybe Int -> Maybe PartOfSpeechTag -> SyntaxToken)
-> Parser (Maybe Text)
-> Parser
(Maybe Int -> Maybe Int -> Maybe PartOfSpeechTag -> SyntaxToken)
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 Int -> Maybe Int -> Maybe PartOfSpeechTag -> SyntaxToken)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe PartOfSpeechTag -> SyntaxToken)
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
"TokenId")
Parser (Maybe Int -> Maybe PartOfSpeechTag -> SyntaxToken)
-> Parser (Maybe Int)
-> Parser (Maybe PartOfSpeechTag -> SyntaxToken)
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 PartOfSpeechTag -> SyntaxToken)
-> Parser (Maybe PartOfSpeechTag) -> Parser SyntaxToken
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PartOfSpeechTag)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PartOfSpeech")
)
instance Prelude.Hashable SyntaxToken
instance Prelude.NFData SyntaxToken