{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.Language.Types.Product where
import Network.Google.Language.Types.Sum
import Network.Google.Prelude
data AnalyzeSyntaxRequest = AnalyzeSyntaxRequest'
{ _asrEncodingType :: !(Maybe AnalyzeSyntaxRequestEncodingType)
, _asrDocument :: !(Maybe Document)
} deriving (Eq,Show,Data,Typeable,Generic)
analyzeSyntaxRequest
:: AnalyzeSyntaxRequest
analyzeSyntaxRequest =
AnalyzeSyntaxRequest'
{ _asrEncodingType = Nothing
, _asrDocument = Nothing
}
asrEncodingType :: Lens' AnalyzeSyntaxRequest (Maybe AnalyzeSyntaxRequestEncodingType)
asrEncodingType
= lens _asrEncodingType
(\ s a -> s{_asrEncodingType = a})
asrDocument :: Lens' AnalyzeSyntaxRequest (Maybe Document)
asrDocument
= lens _asrDocument (\ s a -> s{_asrDocument = a})
instance FromJSON AnalyzeSyntaxRequest where
parseJSON
= withObject "AnalyzeSyntaxRequest"
(\ o ->
AnalyzeSyntaxRequest' <$>
(o .:? "encodingType") <*> (o .:? "document"))
instance ToJSON AnalyzeSyntaxRequest where
toJSON AnalyzeSyntaxRequest'{..}
= object
(catMaybes
[("encodingType" .=) <$> _asrEncodingType,
("document" .=) <$> _asrDocument])
data DependencyEdge = DependencyEdge'
{ _deHeadTokenIndex :: !(Maybe (Textual Int32))
, _deLabel :: !(Maybe DependencyEdgeLabel)
} deriving (Eq,Show,Data,Typeable,Generic)
dependencyEdge
:: DependencyEdge
dependencyEdge =
DependencyEdge'
{ _deHeadTokenIndex = Nothing
, _deLabel = Nothing
}
deHeadTokenIndex :: Lens' DependencyEdge (Maybe Int32)
deHeadTokenIndex
= lens _deHeadTokenIndex
(\ s a -> s{_deHeadTokenIndex = a})
. mapping _Coerce
deLabel :: Lens' DependencyEdge (Maybe DependencyEdgeLabel)
deLabel = lens _deLabel (\ s a -> s{_deLabel = a})
instance FromJSON DependencyEdge where
parseJSON
= withObject "DependencyEdge"
(\ o ->
DependencyEdge' <$>
(o .:? "headTokenIndex") <*> (o .:? "label"))
instance ToJSON DependencyEdge where
toJSON DependencyEdge'{..}
= object
(catMaybes
[("headTokenIndex" .=) <$> _deHeadTokenIndex,
("label" .=) <$> _deLabel])
newtype ClassifyTextRequest = ClassifyTextRequest'
{ _ctrDocument :: Maybe Document
} deriving (Eq,Show,Data,Typeable,Generic)
classifyTextRequest
:: ClassifyTextRequest
classifyTextRequest =
ClassifyTextRequest'
{ _ctrDocument = Nothing
}
ctrDocument :: Lens' ClassifyTextRequest (Maybe Document)
ctrDocument
= lens _ctrDocument (\ s a -> s{_ctrDocument = a})
instance FromJSON ClassifyTextRequest where
parseJSON
= withObject "ClassifyTextRequest"
(\ o -> ClassifyTextRequest' <$> (o .:? "document"))
instance ToJSON ClassifyTextRequest where
toJSON ClassifyTextRequest'{..}
= object
(catMaybes [("document" .=) <$> _ctrDocument])
data Status = Status'
{ _sDetails :: !(Maybe [StatusDetailsItem])
, _sCode :: !(Maybe (Textual Int32))
, _sMessage :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
status
:: Status
status =
Status'
{ _sDetails = Nothing
, _sCode = Nothing
, _sMessage = Nothing
}
sDetails :: Lens' Status [StatusDetailsItem]
sDetails
= lens _sDetails (\ s a -> s{_sDetails = a}) .
_Default
. _Coerce
sCode :: Lens' Status (Maybe Int32)
sCode
= lens _sCode (\ s a -> s{_sCode = a}) .
mapping _Coerce
sMessage :: Lens' Status (Maybe Text)
sMessage = lens _sMessage (\ s a -> s{_sMessage = a})
instance FromJSON Status where
parseJSON
= withObject "Status"
(\ o ->
Status' <$>
(o .:? "details" .!= mempty) <*> (o .:? "code") <*>
(o .:? "message"))
instance ToJSON Status where
toJSON Status'{..}
= object
(catMaybes
[("details" .=) <$> _sDetails,
("code" .=) <$> _sCode,
("message" .=) <$> _sMessage])
data Sentiment = Sentiment'
{ _sScore :: !(Maybe (Textual Double))
, _sMagnitude :: !(Maybe (Textual Double))
} deriving (Eq,Show,Data,Typeable,Generic)
sentiment
:: Sentiment
sentiment =
Sentiment'
{ _sScore = Nothing
, _sMagnitude = Nothing
}
sScore :: Lens' Sentiment (Maybe Double)
sScore
= lens _sScore (\ s a -> s{_sScore = a}) .
mapping _Coerce
sMagnitude :: Lens' Sentiment (Maybe Double)
sMagnitude
= lens _sMagnitude (\ s a -> s{_sMagnitude = a}) .
mapping _Coerce
instance FromJSON Sentiment where
parseJSON
= withObject "Sentiment"
(\ o ->
Sentiment' <$>
(o .:? "score") <*> (o .:? "magnitude"))
instance ToJSON Sentiment where
toJSON Sentiment'{..}
= object
(catMaybes
[("score" .=) <$> _sScore,
("magnitude" .=) <$> _sMagnitude])
data Token = Token'
{ _tDependencyEdge :: !(Maybe DependencyEdge)
, _tText :: !(Maybe TextSpan)
, _tLemma :: !(Maybe Text)
, _tPartOfSpeech :: !(Maybe PartOfSpeech)
} deriving (Eq,Show,Data,Typeable,Generic)
token
:: Token
token =
Token'
{ _tDependencyEdge = Nothing
, _tText = Nothing
, _tLemma = Nothing
, _tPartOfSpeech = Nothing
}
tDependencyEdge :: Lens' Token (Maybe DependencyEdge)
tDependencyEdge
= lens _tDependencyEdge
(\ s a -> s{_tDependencyEdge = a})
tText :: Lens' Token (Maybe TextSpan)
tText = lens _tText (\ s a -> s{_tText = a})
tLemma :: Lens' Token (Maybe Text)
tLemma = lens _tLemma (\ s a -> s{_tLemma = a})
tPartOfSpeech :: Lens' Token (Maybe PartOfSpeech)
tPartOfSpeech
= lens _tPartOfSpeech
(\ s a -> s{_tPartOfSpeech = a})
instance FromJSON Token where
parseJSON
= withObject "Token"
(\ o ->
Token' <$>
(o .:? "dependencyEdge") <*> (o .:? "text") <*>
(o .:? "lemma")
<*> (o .:? "partOfSpeech"))
instance ToJSON Token where
toJSON Token'{..}
= object
(catMaybes
[("dependencyEdge" .=) <$> _tDependencyEdge,
("text" .=) <$> _tText, ("lemma" .=) <$> _tLemma,
("partOfSpeech" .=) <$> _tPartOfSpeech])
newtype StatusDetailsItem = StatusDetailsItem'
{ _sdiAddtional :: HashMap Text JSONValue
} deriving (Eq,Show,Data,Typeable,Generic)
statusDetailsItem
:: HashMap Text JSONValue
-> StatusDetailsItem
statusDetailsItem pSdiAddtional_ =
StatusDetailsItem'
{ _sdiAddtional = _Coerce # pSdiAddtional_
}
sdiAddtional :: Lens' StatusDetailsItem (HashMap Text JSONValue)
sdiAddtional
= lens _sdiAddtional (\ s a -> s{_sdiAddtional = a})
. _Coerce
instance FromJSON StatusDetailsItem where
parseJSON
= withObject "StatusDetailsItem"
(\ o -> StatusDetailsItem' <$> (parseJSONObject o))
instance ToJSON StatusDetailsItem where
toJSON = toJSON . _sdiAddtional
data ClassificationCategory = ClassificationCategory'
{ _ccConfidence :: !(Maybe (Textual Double))
, _ccName :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
classificationCategory
:: ClassificationCategory
classificationCategory =
ClassificationCategory'
{ _ccConfidence = Nothing
, _ccName = Nothing
}
ccConfidence :: Lens' ClassificationCategory (Maybe Double)
ccConfidence
= lens _ccConfidence (\ s a -> s{_ccConfidence = a})
. mapping _Coerce
ccName :: Lens' ClassificationCategory (Maybe Text)
ccName = lens _ccName (\ s a -> s{_ccName = a})
instance FromJSON ClassificationCategory where
parseJSON
= withObject "ClassificationCategory"
(\ o ->
ClassificationCategory' <$>
(o .:? "confidence") <*> (o .:? "name"))
instance ToJSON ClassificationCategory where
toJSON ClassificationCategory'{..}
= object
(catMaybes
[("confidence" .=) <$> _ccConfidence,
("name" .=) <$> _ccName])
data AnnotateTextRequest = AnnotateTextRequest'
{ _atrEncodingType :: !(Maybe AnnotateTextRequestEncodingType)
, _atrFeatures :: !(Maybe Features)
, _atrDocument :: !(Maybe Document)
} deriving (Eq,Show,Data,Typeable,Generic)
annotateTextRequest
:: AnnotateTextRequest
annotateTextRequest =
AnnotateTextRequest'
{ _atrEncodingType = Nothing
, _atrFeatures = Nothing
, _atrDocument = Nothing
}
atrEncodingType :: Lens' AnnotateTextRequest (Maybe AnnotateTextRequestEncodingType)
atrEncodingType
= lens _atrEncodingType
(\ s a -> s{_atrEncodingType = a})
atrFeatures :: Lens' AnnotateTextRequest (Maybe Features)
atrFeatures
= lens _atrFeatures (\ s a -> s{_atrFeatures = a})
atrDocument :: Lens' AnnotateTextRequest (Maybe Document)
atrDocument
= lens _atrDocument (\ s a -> s{_atrDocument = a})
instance FromJSON AnnotateTextRequest where
parseJSON
= withObject "AnnotateTextRequest"
(\ o ->
AnnotateTextRequest' <$>
(o .:? "encodingType") <*> (o .:? "features") <*>
(o .:? "document"))
instance ToJSON AnnotateTextRequest where
toJSON AnnotateTextRequest'{..}
= object
(catMaybes
[("encodingType" .=) <$> _atrEncodingType,
("features" .=) <$> _atrFeatures,
("document" .=) <$> _atrDocument])
data EntityMention = EntityMention'
{ _emSentiment :: !(Maybe Sentiment)
, _emText :: !(Maybe TextSpan)
, _emType :: !(Maybe EntityMentionType)
} deriving (Eq,Show,Data,Typeable,Generic)
entityMention
:: EntityMention
entityMention =
EntityMention'
{ _emSentiment = Nothing
, _emText = Nothing
, _emType = Nothing
}
emSentiment :: Lens' EntityMention (Maybe Sentiment)
emSentiment
= lens _emSentiment (\ s a -> s{_emSentiment = a})
emText :: Lens' EntityMention (Maybe TextSpan)
emText = lens _emText (\ s a -> s{_emText = a})
emType :: Lens' EntityMention (Maybe EntityMentionType)
emType = lens _emType (\ s a -> s{_emType = a})
instance FromJSON EntityMention where
parseJSON
= withObject "EntityMention"
(\ o ->
EntityMention' <$>
(o .:? "sentiment") <*> (o .:? "text") <*>
(o .:? "type"))
instance ToJSON EntityMention where
toJSON EntityMention'{..}
= object
(catMaybes
[("sentiment" .=) <$> _emSentiment,
("text" .=) <$> _emText, ("type" .=) <$> _emType])
data TextSpan = TextSpan'
{ _tsBeginOffSet :: !(Maybe (Textual Int32))
, _tsContent :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
textSpan
:: TextSpan
textSpan =
TextSpan'
{ _tsBeginOffSet = Nothing
, _tsContent = Nothing
}
tsBeginOffSet :: Lens' TextSpan (Maybe Int32)
tsBeginOffSet
= lens _tsBeginOffSet
(\ s a -> s{_tsBeginOffSet = a})
. mapping _Coerce
tsContent :: Lens' TextSpan (Maybe Text)
tsContent
= lens _tsContent (\ s a -> s{_tsContent = a})
instance FromJSON TextSpan where
parseJSON
= withObject "TextSpan"
(\ o ->
TextSpan' <$>
(o .:? "beginOffset") <*> (o .:? "content"))
instance ToJSON TextSpan where
toJSON TextSpan'{..}
= object
(catMaybes
[("beginOffset" .=) <$> _tsBeginOffSet,
("content" .=) <$> _tsContent])
data AnalyzeEntitySentimentRequest = AnalyzeEntitySentimentRequest'
{ _aesrEncodingType :: !(Maybe AnalyzeEntitySentimentRequestEncodingType)
, _aesrDocument :: !(Maybe Document)
} deriving (Eq,Show,Data,Typeable,Generic)
analyzeEntitySentimentRequest
:: AnalyzeEntitySentimentRequest
analyzeEntitySentimentRequest =
AnalyzeEntitySentimentRequest'
{ _aesrEncodingType = Nothing
, _aesrDocument = Nothing
}
aesrEncodingType :: Lens' AnalyzeEntitySentimentRequest (Maybe AnalyzeEntitySentimentRequestEncodingType)
aesrEncodingType
= lens _aesrEncodingType
(\ s a -> s{_aesrEncodingType = a})
aesrDocument :: Lens' AnalyzeEntitySentimentRequest (Maybe Document)
aesrDocument
= lens _aesrDocument (\ s a -> s{_aesrDocument = a})
instance FromJSON AnalyzeEntitySentimentRequest where
parseJSON
= withObject "AnalyzeEntitySentimentRequest"
(\ o ->
AnalyzeEntitySentimentRequest' <$>
(o .:? "encodingType") <*> (o .:? "document"))
instance ToJSON AnalyzeEntitySentimentRequest where
toJSON AnalyzeEntitySentimentRequest'{..}
= object
(catMaybes
[("encodingType" .=) <$> _aesrEncodingType,
("document" .=) <$> _aesrDocument])
data AnnotateTextResponse = AnnotateTextResponse'
{ _atrEntities :: !(Maybe [Entity])
, _atrTokens :: !(Maybe [Token])
, _atrDocumentSentiment :: !(Maybe Sentiment)
, _atrCategories :: !(Maybe [ClassificationCategory])
, _atrSentences :: !(Maybe [Sentence])
, _atrLanguage :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
annotateTextResponse
:: AnnotateTextResponse
annotateTextResponse =
AnnotateTextResponse'
{ _atrEntities = Nothing
, _atrTokens = Nothing
, _atrDocumentSentiment = Nothing
, _atrCategories = Nothing
, _atrSentences = Nothing
, _atrLanguage = Nothing
}
atrEntities :: Lens' AnnotateTextResponse [Entity]
atrEntities
= lens _atrEntities (\ s a -> s{_atrEntities = a}) .
_Default
. _Coerce
atrTokens :: Lens' AnnotateTextResponse [Token]
atrTokens
= lens _atrTokens (\ s a -> s{_atrTokens = a}) .
_Default
. _Coerce
atrDocumentSentiment :: Lens' AnnotateTextResponse (Maybe Sentiment)
atrDocumentSentiment
= lens _atrDocumentSentiment
(\ s a -> s{_atrDocumentSentiment = a})
atrCategories :: Lens' AnnotateTextResponse [ClassificationCategory]
atrCategories
= lens _atrCategories
(\ s a -> s{_atrCategories = a})
. _Default
. _Coerce
atrSentences :: Lens' AnnotateTextResponse [Sentence]
atrSentences
= lens _atrSentences (\ s a -> s{_atrSentences = a})
. _Default
. _Coerce
atrLanguage :: Lens' AnnotateTextResponse (Maybe Text)
atrLanguage
= lens _atrLanguage (\ s a -> s{_atrLanguage = a})
instance FromJSON AnnotateTextResponse where
parseJSON
= withObject "AnnotateTextResponse"
(\ o ->
AnnotateTextResponse' <$>
(o .:? "entities" .!= mempty) <*>
(o .:? "tokens" .!= mempty)
<*> (o .:? "documentSentiment")
<*> (o .:? "categories" .!= mempty)
<*> (o .:? "sentences" .!= mempty)
<*> (o .:? "language"))
instance ToJSON AnnotateTextResponse where
toJSON AnnotateTextResponse'{..}
= object
(catMaybes
[("entities" .=) <$> _atrEntities,
("tokens" .=) <$> _atrTokens,
("documentSentiment" .=) <$> _atrDocumentSentiment,
("categories" .=) <$> _atrCategories,
("sentences" .=) <$> _atrSentences,
("language" .=) <$> _atrLanguage])
data Features = Features'
{ _fExtractSyntax :: !(Maybe Bool)
, _fExtractDocumentSentiment :: !(Maybe Bool)
, _fClassifyText :: !(Maybe Bool)
, _fExtractEntitySentiment :: !(Maybe Bool)
, _fExtractEntities :: !(Maybe Bool)
} deriving (Eq,Show,Data,Typeable,Generic)
features
:: Features
features =
Features'
{ _fExtractSyntax = Nothing
, _fExtractDocumentSentiment = Nothing
, _fClassifyText = Nothing
, _fExtractEntitySentiment = Nothing
, _fExtractEntities = Nothing
}
fExtractSyntax :: Lens' Features (Maybe Bool)
fExtractSyntax
= lens _fExtractSyntax
(\ s a -> s{_fExtractSyntax = a})
fExtractDocumentSentiment :: Lens' Features (Maybe Bool)
fExtractDocumentSentiment
= lens _fExtractDocumentSentiment
(\ s a -> s{_fExtractDocumentSentiment = a})
fClassifyText :: Lens' Features (Maybe Bool)
fClassifyText
= lens _fClassifyText
(\ s a -> s{_fClassifyText = a})
fExtractEntitySentiment :: Lens' Features (Maybe Bool)
fExtractEntitySentiment
= lens _fExtractEntitySentiment
(\ s a -> s{_fExtractEntitySentiment = a})
fExtractEntities :: Lens' Features (Maybe Bool)
fExtractEntities
= lens _fExtractEntities
(\ s a -> s{_fExtractEntities = a})
instance FromJSON Features where
parseJSON
= withObject "Features"
(\ o ->
Features' <$>
(o .:? "extractSyntax") <*>
(o .:? "extractDocumentSentiment")
<*> (o .:? "classifyText")
<*> (o .:? "extractEntitySentiment")
<*> (o .:? "extractEntities"))
instance ToJSON Features where
toJSON Features'{..}
= object
(catMaybes
[("extractSyntax" .=) <$> _fExtractSyntax,
("extractDocumentSentiment" .=) <$>
_fExtractDocumentSentiment,
("classifyText" .=) <$> _fClassifyText,
("extractEntitySentiment" .=) <$>
_fExtractEntitySentiment,
("extractEntities" .=) <$> _fExtractEntities])
data Document = Document'
{ _dContent :: !(Maybe Text)
, _dLanguage :: !(Maybe Text)
, _dGcsContentURI :: !(Maybe Text)
, _dType :: !(Maybe DocumentType)
} deriving (Eq,Show,Data,Typeable,Generic)
document
:: Document
document =
Document'
{ _dContent = Nothing
, _dLanguage = Nothing
, _dGcsContentURI = Nothing
, _dType = Nothing
}
dContent :: Lens' Document (Maybe Text)
dContent = lens _dContent (\ s a -> s{_dContent = a})
dLanguage :: Lens' Document (Maybe Text)
dLanguage
= lens _dLanguage (\ s a -> s{_dLanguage = a})
dGcsContentURI :: Lens' Document (Maybe Text)
dGcsContentURI
= lens _dGcsContentURI
(\ s a -> s{_dGcsContentURI = a})
dType :: Lens' Document (Maybe DocumentType)
dType = lens _dType (\ s a -> s{_dType = a})
instance FromJSON Document where
parseJSON
= withObject "Document"
(\ o ->
Document' <$>
(o .:? "content") <*> (o .:? "language") <*>
(o .:? "gcsContentUri")
<*> (o .:? "type"))
instance ToJSON Document where
toJSON Document'{..}
= object
(catMaybes
[("content" .=) <$> _dContent,
("language" .=) <$> _dLanguage,
("gcsContentUri" .=) <$> _dGcsContentURI,
("type" .=) <$> _dType])
data AnalyzeSentimentRequest = AnalyzeSentimentRequest'
{ _aEncodingType :: !(Maybe AnalyzeSentimentRequestEncodingType)
, _aDocument :: !(Maybe Document)
} deriving (Eq,Show,Data,Typeable,Generic)
analyzeSentimentRequest
:: AnalyzeSentimentRequest
analyzeSentimentRequest =
AnalyzeSentimentRequest'
{ _aEncodingType = Nothing
, _aDocument = Nothing
}
aEncodingType :: Lens' AnalyzeSentimentRequest (Maybe AnalyzeSentimentRequestEncodingType)
aEncodingType
= lens _aEncodingType
(\ s a -> s{_aEncodingType = a})
aDocument :: Lens' AnalyzeSentimentRequest (Maybe Document)
aDocument
= lens _aDocument (\ s a -> s{_aDocument = a})
instance FromJSON AnalyzeSentimentRequest where
parseJSON
= withObject "AnalyzeSentimentRequest"
(\ o ->
AnalyzeSentimentRequest' <$>
(o .:? "encodingType") <*> (o .:? "document"))
instance ToJSON AnalyzeSentimentRequest where
toJSON AnalyzeSentimentRequest'{..}
= object
(catMaybes
[("encodingType" .=) <$> _aEncodingType,
("document" .=) <$> _aDocument])
data AnalyzeEntitiesResponse = AnalyzeEntitiesResponse'
{ _aerEntities :: !(Maybe [Entity])
, _aerLanguage :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
analyzeEntitiesResponse
:: AnalyzeEntitiesResponse
analyzeEntitiesResponse =
AnalyzeEntitiesResponse'
{ _aerEntities = Nothing
, _aerLanguage = Nothing
}
aerEntities :: Lens' AnalyzeEntitiesResponse [Entity]
aerEntities
= lens _aerEntities (\ s a -> s{_aerEntities = a}) .
_Default
. _Coerce
aerLanguage :: Lens' AnalyzeEntitiesResponse (Maybe Text)
aerLanguage
= lens _aerLanguage (\ s a -> s{_aerLanguage = a})
instance FromJSON AnalyzeEntitiesResponse where
parseJSON
= withObject "AnalyzeEntitiesResponse"
(\ o ->
AnalyzeEntitiesResponse' <$>
(o .:? "entities" .!= mempty) <*> (o .:? "language"))
instance ToJSON AnalyzeEntitiesResponse where
toJSON AnalyzeEntitiesResponse'{..}
= object
(catMaybes
[("entities" .=) <$> _aerEntities,
("language" .=) <$> _aerLanguage])
data AnalyzeSentimentResponse = AnalyzeSentimentResponse'
{ _asrDocumentSentiment :: !(Maybe Sentiment)
, _asrSentences :: !(Maybe [Sentence])
, _asrLanguage :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
analyzeSentimentResponse
:: AnalyzeSentimentResponse
analyzeSentimentResponse =
AnalyzeSentimentResponse'
{ _asrDocumentSentiment = Nothing
, _asrSentences = Nothing
, _asrLanguage = Nothing
}
asrDocumentSentiment :: Lens' AnalyzeSentimentResponse (Maybe Sentiment)
asrDocumentSentiment
= lens _asrDocumentSentiment
(\ s a -> s{_asrDocumentSentiment = a})
asrSentences :: Lens' AnalyzeSentimentResponse [Sentence]
asrSentences
= lens _asrSentences (\ s a -> s{_asrSentences = a})
. _Default
. _Coerce
asrLanguage :: Lens' AnalyzeSentimentResponse (Maybe Text)
asrLanguage
= lens _asrLanguage (\ s a -> s{_asrLanguage = a})
instance FromJSON AnalyzeSentimentResponse where
parseJSON
= withObject "AnalyzeSentimentResponse"
(\ o ->
AnalyzeSentimentResponse' <$>
(o .:? "documentSentiment") <*>
(o .:? "sentences" .!= mempty)
<*> (o .:? "language"))
instance ToJSON AnalyzeSentimentResponse where
toJSON AnalyzeSentimentResponse'{..}
= object
(catMaybes
[("documentSentiment" .=) <$> _asrDocumentSentiment,
("sentences" .=) <$> _asrSentences,
("language" .=) <$> _asrLanguage])
data AnalyzeEntitiesRequest = AnalyzeEntitiesRequest'
{ _aerEncodingType :: !(Maybe AnalyzeEntitiesRequestEncodingType)
, _aerDocument :: !(Maybe Document)
} deriving (Eq,Show,Data,Typeable,Generic)
analyzeEntitiesRequest
:: AnalyzeEntitiesRequest
analyzeEntitiesRequest =
AnalyzeEntitiesRequest'
{ _aerEncodingType = Nothing
, _aerDocument = Nothing
}
aerEncodingType :: Lens' AnalyzeEntitiesRequest (Maybe AnalyzeEntitiesRequestEncodingType)
aerEncodingType
= lens _aerEncodingType
(\ s a -> s{_aerEncodingType = a})
aerDocument :: Lens' AnalyzeEntitiesRequest (Maybe Document)
aerDocument
= lens _aerDocument (\ s a -> s{_aerDocument = a})
instance FromJSON AnalyzeEntitiesRequest where
parseJSON
= withObject "AnalyzeEntitiesRequest"
(\ o ->
AnalyzeEntitiesRequest' <$>
(o .:? "encodingType") <*> (o .:? "document"))
instance ToJSON AnalyzeEntitiesRequest where
toJSON AnalyzeEntitiesRequest'{..}
= object
(catMaybes
[("encodingType" .=) <$> _aerEncodingType,
("document" .=) <$> _aerDocument])
data Entity = Entity'
{ _eSentiment :: !(Maybe Sentiment)
, _eName :: !(Maybe Text)
, _eSalience :: !(Maybe (Textual Double))
, _eMetadata :: !(Maybe EntityMetadata)
, _eType :: !(Maybe EntityType)
, _eMentions :: !(Maybe [EntityMention])
} deriving (Eq,Show,Data,Typeable,Generic)
entity
:: Entity
entity =
Entity'
{ _eSentiment = Nothing
, _eName = Nothing
, _eSalience = Nothing
, _eMetadata = Nothing
, _eType = Nothing
, _eMentions = Nothing
}
eSentiment :: Lens' Entity (Maybe Sentiment)
eSentiment
= lens _eSentiment (\ s a -> s{_eSentiment = a})
eName :: Lens' Entity (Maybe Text)
eName = lens _eName (\ s a -> s{_eName = a})
eSalience :: Lens' Entity (Maybe Double)
eSalience
= lens _eSalience (\ s a -> s{_eSalience = a}) .
mapping _Coerce
eMetadata :: Lens' Entity (Maybe EntityMetadata)
eMetadata
= lens _eMetadata (\ s a -> s{_eMetadata = a})
eType :: Lens' Entity (Maybe EntityType)
eType = lens _eType (\ s a -> s{_eType = a})
eMentions :: Lens' Entity [EntityMention]
eMentions
= lens _eMentions (\ s a -> s{_eMentions = a}) .
_Default
. _Coerce
instance FromJSON Entity where
parseJSON
= withObject "Entity"
(\ o ->
Entity' <$>
(o .:? "sentiment") <*> (o .:? "name") <*>
(o .:? "salience")
<*> (o .:? "metadata")
<*> (o .:? "type")
<*> (o .:? "mentions" .!= mempty))
instance ToJSON Entity where
toJSON Entity'{..}
= object
(catMaybes
[("sentiment" .=) <$> _eSentiment,
("name" .=) <$> _eName,
("salience" .=) <$> _eSalience,
("metadata" .=) <$> _eMetadata,
("type" .=) <$> _eType,
("mentions" .=) <$> _eMentions])
data AnalyzeEntitySentimentResponse = AnalyzeEntitySentimentResponse'
{ _aesrEntities :: !(Maybe [Entity])
, _aesrLanguage :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
analyzeEntitySentimentResponse
:: AnalyzeEntitySentimentResponse
analyzeEntitySentimentResponse =
AnalyzeEntitySentimentResponse'
{ _aesrEntities = Nothing
, _aesrLanguage = Nothing
}
aesrEntities :: Lens' AnalyzeEntitySentimentResponse [Entity]
aesrEntities
= lens _aesrEntities (\ s a -> s{_aesrEntities = a})
. _Default
. _Coerce
aesrLanguage :: Lens' AnalyzeEntitySentimentResponse (Maybe Text)
aesrLanguage
= lens _aesrLanguage (\ s a -> s{_aesrLanguage = a})
instance FromJSON AnalyzeEntitySentimentResponse
where
parseJSON
= withObject "AnalyzeEntitySentimentResponse"
(\ o ->
AnalyzeEntitySentimentResponse' <$>
(o .:? "entities" .!= mempty) <*> (o .:? "language"))
instance ToJSON AnalyzeEntitySentimentResponse where
toJSON AnalyzeEntitySentimentResponse'{..}
= object
(catMaybes
[("entities" .=) <$> _aesrEntities,
("language" .=) <$> _aesrLanguage])
data AnalyzeSyntaxResponse = AnalyzeSyntaxResponse'
{ _aTokens :: !(Maybe [Token])
, _aSentences :: !(Maybe [Sentence])
, _aLanguage :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
analyzeSyntaxResponse
:: AnalyzeSyntaxResponse
analyzeSyntaxResponse =
AnalyzeSyntaxResponse'
{ _aTokens = Nothing
, _aSentences = Nothing
, _aLanguage = Nothing
}
aTokens :: Lens' AnalyzeSyntaxResponse [Token]
aTokens
= lens _aTokens (\ s a -> s{_aTokens = a}) . _Default
. _Coerce
aSentences :: Lens' AnalyzeSyntaxResponse [Sentence]
aSentences
= lens _aSentences (\ s a -> s{_aSentences = a}) .
_Default
. _Coerce
aLanguage :: Lens' AnalyzeSyntaxResponse (Maybe Text)
aLanguage
= lens _aLanguage (\ s a -> s{_aLanguage = a})
instance FromJSON AnalyzeSyntaxResponse where
parseJSON
= withObject "AnalyzeSyntaxResponse"
(\ o ->
AnalyzeSyntaxResponse' <$>
(o .:? "tokens" .!= mempty) <*>
(o .:? "sentences" .!= mempty)
<*> (o .:? "language"))
instance ToJSON AnalyzeSyntaxResponse where
toJSON AnalyzeSyntaxResponse'{..}
= object
(catMaybes
[("tokens" .=) <$> _aTokens,
("sentences" .=) <$> _aSentences,
("language" .=) <$> _aLanguage])
newtype EntityMetadata = EntityMetadata'
{ _emAddtional :: HashMap Text Text
} deriving (Eq,Show,Data,Typeable,Generic)
entityMetadata
:: HashMap Text Text
-> EntityMetadata
entityMetadata pEmAddtional_ =
EntityMetadata'
{ _emAddtional = _Coerce # pEmAddtional_
}
emAddtional :: Lens' EntityMetadata (HashMap Text Text)
emAddtional
= lens _emAddtional (\ s a -> s{_emAddtional = a}) .
_Coerce
instance FromJSON EntityMetadata where
parseJSON
= withObject "EntityMetadata"
(\ o -> EntityMetadata' <$> (parseJSONObject o))
instance ToJSON EntityMetadata where
toJSON = toJSON . _emAddtional
newtype ClassifyTextResponse = ClassifyTextResponse'
{ _ctrCategories :: Maybe [ClassificationCategory]
} deriving (Eq,Show,Data,Typeable,Generic)
classifyTextResponse
:: ClassifyTextResponse
classifyTextResponse =
ClassifyTextResponse'
{ _ctrCategories = Nothing
}
ctrCategories :: Lens' ClassifyTextResponse [ClassificationCategory]
ctrCategories
= lens _ctrCategories
(\ s a -> s{_ctrCategories = a})
. _Default
. _Coerce
instance FromJSON ClassifyTextResponse where
parseJSON
= withObject "ClassifyTextResponse"
(\ o ->
ClassifyTextResponse' <$>
(o .:? "categories" .!= mempty))
instance ToJSON ClassifyTextResponse where
toJSON ClassifyTextResponse'{..}
= object
(catMaybes [("categories" .=) <$> _ctrCategories])
data PartOfSpeech = PartOfSpeech'
{ _posProper :: !(Maybe PartOfSpeechProper)
, _posTag :: !(Maybe PartOfSpeechTag)
, _posPerson :: !(Maybe PartOfSpeechPerson)
, _posAspect :: !(Maybe PartOfSpeechAspect)
, _posCase :: !(Maybe PartOfSpeechCase)
, _posGender :: !(Maybe PartOfSpeechGender)
, _posReciprocity :: !(Maybe PartOfSpeechReciprocity)
, _posNumber :: !(Maybe PartOfSpeechNumber)
, _posVoice :: !(Maybe PartOfSpeechVoice)
, _posForm :: !(Maybe PartOfSpeechForm)
, _posTense :: !(Maybe PartOfSpeechTense)
, _posMood :: !(Maybe PartOfSpeechMood)
} deriving (Eq,Show,Data,Typeable,Generic)
partOfSpeech
:: PartOfSpeech
partOfSpeech =
PartOfSpeech'
{ _posProper = Nothing
, _posTag = Nothing
, _posPerson = Nothing
, _posAspect = Nothing
, _posCase = Nothing
, _posGender = Nothing
, _posReciprocity = Nothing
, _posNumber = Nothing
, _posVoice = Nothing
, _posForm = Nothing
, _posTense = Nothing
, _posMood = Nothing
}
posProper :: Lens' PartOfSpeech (Maybe PartOfSpeechProper)
posProper
= lens _posProper (\ s a -> s{_posProper = a})
posTag :: Lens' PartOfSpeech (Maybe PartOfSpeechTag)
posTag = lens _posTag (\ s a -> s{_posTag = a})
posPerson :: Lens' PartOfSpeech (Maybe PartOfSpeechPerson)
posPerson
= lens _posPerson (\ s a -> s{_posPerson = a})
posAspect :: Lens' PartOfSpeech (Maybe PartOfSpeechAspect)
posAspect
= lens _posAspect (\ s a -> s{_posAspect = a})
posCase :: Lens' PartOfSpeech (Maybe PartOfSpeechCase)
posCase = lens _posCase (\ s a -> s{_posCase = a})
posGender :: Lens' PartOfSpeech (Maybe PartOfSpeechGender)
posGender
= lens _posGender (\ s a -> s{_posGender = a})
posReciprocity :: Lens' PartOfSpeech (Maybe PartOfSpeechReciprocity)
posReciprocity
= lens _posReciprocity
(\ s a -> s{_posReciprocity = a})
posNumber :: Lens' PartOfSpeech (Maybe PartOfSpeechNumber)
posNumber
= lens _posNumber (\ s a -> s{_posNumber = a})
posVoice :: Lens' PartOfSpeech (Maybe PartOfSpeechVoice)
posVoice = lens _posVoice (\ s a -> s{_posVoice = a})
posForm :: Lens' PartOfSpeech (Maybe PartOfSpeechForm)
posForm = lens _posForm (\ s a -> s{_posForm = a})
posTense :: Lens' PartOfSpeech (Maybe PartOfSpeechTense)
posTense = lens _posTense (\ s a -> s{_posTense = a})
posMood :: Lens' PartOfSpeech (Maybe PartOfSpeechMood)
posMood = lens _posMood (\ s a -> s{_posMood = a})
instance FromJSON PartOfSpeech where
parseJSON
= withObject "PartOfSpeech"
(\ o ->
PartOfSpeech' <$>
(o .:? "proper") <*> (o .:? "tag") <*>
(o .:? "person")
<*> (o .:? "aspect")
<*> (o .:? "case")
<*> (o .:? "gender")
<*> (o .:? "reciprocity")
<*> (o .:? "number")
<*> (o .:? "voice")
<*> (o .:? "form")
<*> (o .:? "tense")
<*> (o .:? "mood"))
instance ToJSON PartOfSpeech where
toJSON PartOfSpeech'{..}
= object
(catMaybes
[("proper" .=) <$> _posProper,
("tag" .=) <$> _posTag, ("person" .=) <$> _posPerson,
("aspect" .=) <$> _posAspect,
("case" .=) <$> _posCase,
("gender" .=) <$> _posGender,
("reciprocity" .=) <$> _posReciprocity,
("number" .=) <$> _posNumber,
("voice" .=) <$> _posVoice, ("form" .=) <$> _posForm,
("tense" .=) <$> _posTense,
("mood" .=) <$> _posMood])
data Sentence = Sentence'
{ _sSentiment :: !(Maybe Sentiment)
, _sText :: !(Maybe TextSpan)
} deriving (Eq,Show,Data,Typeable,Generic)
sentence
:: Sentence
sentence =
Sentence'
{ _sSentiment = Nothing
, _sText = Nothing
}
sSentiment :: Lens' Sentence (Maybe Sentiment)
sSentiment
= lens _sSentiment (\ s a -> s{_sSentiment = a})
sText :: Lens' Sentence (Maybe TextSpan)
sText = lens _sText (\ s a -> s{_sText = a})
instance FromJSON Sentence where
parseJSON
= withObject "Sentence"
(\ o ->
Sentence' <$> (o .:? "sentiment") <*> (o .:? "text"))
instance ToJSON Sentence where
toJSON Sentence'{..}
= object
(catMaybes
[("sentiment" .=) <$> _sSentiment,
("text" .=) <$> _sText])