Skip to main content

aws_sdk_comprehend/types/
_mention_sentiment.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains the sentiment and sentiment score for one mention of an entity.</p>
4/// <p>For more information about targeted sentiment, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-targeted-sentiment.html">Targeted sentiment</a> in the <i>Amazon Comprehend Developer Guide</i>.</p>
5#[non_exhaustive]
6#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
7pub struct MentionSentiment {
8    /// <p>The sentiment of the mention.</p>
9    pub sentiment: ::std::option::Option<crate::types::SentimentType>,
10    /// <p>Describes the level of confidence that Amazon Comprehend has in the accuracy of its detection of sentiments.</p>
11    pub sentiment_score: ::std::option::Option<crate::types::SentimentScore>,
12}
13impl MentionSentiment {
14    /// <p>The sentiment of the mention.</p>
15    pub fn sentiment(&self) -> ::std::option::Option<&crate::types::SentimentType> {
16        self.sentiment.as_ref()
17    }
18    /// <p>Describes the level of confidence that Amazon Comprehend has in the accuracy of its detection of sentiments.</p>
19    pub fn sentiment_score(&self) -> ::std::option::Option<&crate::types::SentimentScore> {
20        self.sentiment_score.as_ref()
21    }
22}
23impl MentionSentiment {
24    /// Creates a new builder-style object to manufacture [`MentionSentiment`](crate::types::MentionSentiment).
25    pub fn builder() -> crate::types::builders::MentionSentimentBuilder {
26        crate::types::builders::MentionSentimentBuilder::default()
27    }
28}
29
30/// A builder for [`MentionSentiment`](crate::types::MentionSentiment).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct MentionSentimentBuilder {
34    pub(crate) sentiment: ::std::option::Option<crate::types::SentimentType>,
35    pub(crate) sentiment_score: ::std::option::Option<crate::types::SentimentScore>,
36}
37impl MentionSentimentBuilder {
38    /// <p>The sentiment of the mention.</p>
39    pub fn sentiment(mut self, input: crate::types::SentimentType) -> Self {
40        self.sentiment = ::std::option::Option::Some(input);
41        self
42    }
43    /// <p>The sentiment of the mention.</p>
44    pub fn set_sentiment(mut self, input: ::std::option::Option<crate::types::SentimentType>) -> Self {
45        self.sentiment = input;
46        self
47    }
48    /// <p>The sentiment of the mention.</p>
49    pub fn get_sentiment(&self) -> &::std::option::Option<crate::types::SentimentType> {
50        &self.sentiment
51    }
52    /// <p>Describes the level of confidence that Amazon Comprehend has in the accuracy of its detection of sentiments.</p>
53    pub fn sentiment_score(mut self, input: crate::types::SentimentScore) -> Self {
54        self.sentiment_score = ::std::option::Option::Some(input);
55        self
56    }
57    /// <p>Describes the level of confidence that Amazon Comprehend has in the accuracy of its detection of sentiments.</p>
58    pub fn set_sentiment_score(mut self, input: ::std::option::Option<crate::types::SentimentScore>) -> Self {
59        self.sentiment_score = input;
60        self
61    }
62    /// <p>Describes the level of confidence that Amazon Comprehend has in the accuracy of its detection of sentiments.</p>
63    pub fn get_sentiment_score(&self) -> &::std::option::Option<crate::types::SentimentScore> {
64        &self.sentiment_score
65    }
66    /// Consumes the builder and constructs a [`MentionSentiment`](crate::types::MentionSentiment).
67    pub fn build(self) -> crate::types::MentionSentiment {
68        crate::types::MentionSentiment {
69            sentiment: self.sentiment,
70            sentiment_score: self.sentiment_score,
71        }
72    }
73}