1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Provides information about an entity.</p>
/// <p></p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Entity {
/// <p>The level of confidence that Amazon Comprehend has in the accuracy of the detection.</p>
pub score: ::std::option::Option<f32>,
/// <p>The entity type. For entity detection using the built-in model, this field contains one of the standard entity types listed below.</p>
/// <p>For custom entity detection, this field contains one of the entity types that you specified when you trained your custom model.</p>
pub r#type: ::std::option::Option<crate::types::EntityType>,
/// <p>The text of the entity.</p>
pub text: ::std::option::Option<::std::string::String>,
/// <p>The zero-based offset from the beginning of the source text to the first character in the entity.</p>
/// <p>This field is empty for non-text input.</p>
pub begin_offset: ::std::option::Option<i32>,
/// <p>The zero-based offset from the beginning of the source text to the last character in the entity.</p>
/// <p>This field is empty for non-text input.</p>
pub end_offset: ::std::option::Option<i32>,
/// <p>A reference to each block for this entity. This field is empty for plain-text input.</p>
pub block_references: ::std::option::Option<::std::vec::Vec<crate::types::BlockReference>>,
}
impl Entity {
/// <p>The level of confidence that Amazon Comprehend has in the accuracy of the detection.</p>
pub fn score(&self) -> ::std::option::Option<f32> {
self.score
}
/// <p>The entity type. For entity detection using the built-in model, this field contains one of the standard entity types listed below.</p>
/// <p>For custom entity detection, this field contains one of the entity types that you specified when you trained your custom model.</p>
pub fn r#type(&self) -> ::std::option::Option<&crate::types::EntityType> {
self.r#type.as_ref()
}
/// <p>The text of the entity.</p>
pub fn text(&self) -> ::std::option::Option<&str> {
self.text.as_deref()
}
/// <p>The zero-based offset from the beginning of the source text to the first character in the entity.</p>
/// <p>This field is empty for non-text input.</p>
pub fn begin_offset(&self) -> ::std::option::Option<i32> {
self.begin_offset
}
/// <p>The zero-based offset from the beginning of the source text to the last character in the entity.</p>
/// <p>This field is empty for non-text input.</p>
pub fn end_offset(&self) -> ::std::option::Option<i32> {
self.end_offset
}
/// <p>A reference to each block for this entity. This field is empty for plain-text input.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.block_references.is_none()`.
pub fn block_references(&self) -> &[crate::types::BlockReference] {
self.block_references.as_deref().unwrap_or_default()
}
}
impl Entity {
/// Creates a new builder-style object to manufacture [`Entity`](crate::types::Entity).
pub fn builder() -> crate::types::builders::EntityBuilder {
crate::types::builders::EntityBuilder::default()
}
}
/// A builder for [`Entity`](crate::types::Entity).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct EntityBuilder {
pub(crate) score: ::std::option::Option<f32>,
pub(crate) r#type: ::std::option::Option<crate::types::EntityType>,
pub(crate) text: ::std::option::Option<::std::string::String>,
pub(crate) begin_offset: ::std::option::Option<i32>,
pub(crate) end_offset: ::std::option::Option<i32>,
pub(crate) block_references: ::std::option::Option<::std::vec::Vec<crate::types::BlockReference>>,
}
impl EntityBuilder {
/// <p>The level of confidence that Amazon Comprehend has in the accuracy of the detection.</p>
pub fn score(mut self, input: f32) -> Self {
self.score = ::std::option::Option::Some(input);
self
}
/// <p>The level of confidence that Amazon Comprehend has in the accuracy of the detection.</p>
pub fn set_score(mut self, input: ::std::option::Option<f32>) -> Self {
self.score = input;
self
}
/// <p>The level of confidence that Amazon Comprehend has in the accuracy of the detection.</p>
pub fn get_score(&self) -> &::std::option::Option<f32> {
&self.score
}
/// <p>The entity type. For entity detection using the built-in model, this field contains one of the standard entity types listed below.</p>
/// <p>For custom entity detection, this field contains one of the entity types that you specified when you trained your custom model.</p>
pub fn r#type(mut self, input: crate::types::EntityType) -> Self {
self.r#type = ::std::option::Option::Some(input);
self
}
/// <p>The entity type. For entity detection using the built-in model, this field contains one of the standard entity types listed below.</p>
/// <p>For custom entity detection, this field contains one of the entity types that you specified when you trained your custom model.</p>
pub fn set_type(mut self, input: ::std::option::Option<crate::types::EntityType>) -> Self {
self.r#type = input;
self
}
/// <p>The entity type. For entity detection using the built-in model, this field contains one of the standard entity types listed below.</p>
/// <p>For custom entity detection, this field contains one of the entity types that you specified when you trained your custom model.</p>
pub fn get_type(&self) -> &::std::option::Option<crate::types::EntityType> {
&self.r#type
}
/// <p>The text of the entity.</p>
pub fn text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.text = ::std::option::Option::Some(input.into());
self
}
/// <p>The text of the entity.</p>
pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.text = input;
self
}
/// <p>The text of the entity.</p>
pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
&self.text
}
/// <p>The zero-based offset from the beginning of the source text to the first character in the entity.</p>
/// <p>This field is empty for non-text input.</p>
pub fn begin_offset(mut self, input: i32) -> Self {
self.begin_offset = ::std::option::Option::Some(input);
self
}
/// <p>The zero-based offset from the beginning of the source text to the first character in the entity.</p>
/// <p>This field is empty for non-text input.</p>
pub fn set_begin_offset(mut self, input: ::std::option::Option<i32>) -> Self {
self.begin_offset = input;
self
}
/// <p>The zero-based offset from the beginning of the source text to the first character in the entity.</p>
/// <p>This field is empty for non-text input.</p>
pub fn get_begin_offset(&self) -> &::std::option::Option<i32> {
&self.begin_offset
}
/// <p>The zero-based offset from the beginning of the source text to the last character in the entity.</p>
/// <p>This field is empty for non-text input.</p>
pub fn end_offset(mut self, input: i32) -> Self {
self.end_offset = ::std::option::Option::Some(input);
self
}
/// <p>The zero-based offset from the beginning of the source text to the last character in the entity.</p>
/// <p>This field is empty for non-text input.</p>
pub fn set_end_offset(mut self, input: ::std::option::Option<i32>) -> Self {
self.end_offset = input;
self
}
/// <p>The zero-based offset from the beginning of the source text to the last character in the entity.</p>
/// <p>This field is empty for non-text input.</p>
pub fn get_end_offset(&self) -> &::std::option::Option<i32> {
&self.end_offset
}
/// Appends an item to `block_references`.
///
/// To override the contents of this collection use [`set_block_references`](Self::set_block_references).
///
/// <p>A reference to each block for this entity. This field is empty for plain-text input.</p>
pub fn block_references(mut self, input: crate::types::BlockReference) -> Self {
let mut v = self.block_references.unwrap_or_default();
v.push(input);
self.block_references = ::std::option::Option::Some(v);
self
}
/// <p>A reference to each block for this entity. This field is empty for plain-text input.</p>
pub fn set_block_references(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::BlockReference>>) -> Self {
self.block_references = input;
self
}
/// <p>A reference to each block for this entity. This field is empty for plain-text input.</p>
pub fn get_block_references(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::BlockReference>> {
&self.block_references
}
/// Consumes the builder and constructs a [`Entity`](crate::types::Entity).
pub fn build(self) -> crate::types::Entity {
crate::types::Entity {
score: self.score,
r#type: self.r#type,
text: self.text,
begin_offset: self.begin_offset,
end_offset: self.end_offset,
block_references: self.block_references,
}
}
}