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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Provides information about an extracted medical entity.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Entity {
/// <p>The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather than a global unique identifier.</p>
pub id: ::std::option::Option<i32>,
/// <p>The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 code point in the string.</p>
pub begin_offset: ::std::option::Option<i32>,
/// <p>The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 code point in the string.</p>
pub end_offset: ::std::option::Option<i32>,
/// <p>The level of confidence that Amazon Comprehend Medical has in the accuracy of the detection.</p>
pub score: ::std::option::Option<f32>,
/// <p>The segment of input text extracted as this entity.</p>
pub text: ::std::option::Option<::std::string::String>,
/// <p>The category of the entity.</p>
pub category: ::std::option::Option<crate::types::EntityType>,
/// <p>Describes the specific type of entity with category of entities.</p>
pub r#type: ::std::option::Option<crate::types::EntitySubType>,
/// <p>Contextual information for the entity.</p>
pub traits: ::std::option::Option<::std::vec::Vec<crate::types::Trait>>,
/// <p>The extracted attributes that relate to this entity.</p>
pub attributes: ::std::option::Option<::std::vec::Vec<crate::types::Attribute>>,
}
impl Entity {
/// <p>The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather than a global unique identifier.</p>
pub fn id(&self) -> ::std::option::Option<i32> {
self.id
}
/// <p>The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 code point in the string.</p>
pub fn begin_offset(&self) -> ::std::option::Option<i32> {
self.begin_offset
}
/// <p>The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 code point in the string.</p>
pub fn end_offset(&self) -> ::std::option::Option<i32> {
self.end_offset
}
/// <p>The level of confidence that Amazon Comprehend Medical has in the accuracy of the detection.</p>
pub fn score(&self) -> ::std::option::Option<f32> {
self.score
}
/// <p>The segment of input text extracted as this entity.</p>
pub fn text(&self) -> ::std::option::Option<&str> {
self.text.as_deref()
}
/// <p>The category of the entity.</p>
pub fn category(&self) -> ::std::option::Option<&crate::types::EntityType> {
self.category.as_ref()
}
/// <p>Describes the specific type of entity with category of entities.</p>
pub fn r#type(&self) -> ::std::option::Option<&crate::types::EntitySubType> {
self.r#type.as_ref()
}
/// <p>Contextual information for the entity.</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 `.traits.is_none()`.
pub fn traits(&self) -> &[crate::types::Trait] {
self.traits.as_deref().unwrap_or_default()
}
/// <p>The extracted attributes that relate to this entity.</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 `.attributes.is_none()`.
pub fn attributes(&self) -> &[crate::types::Attribute] {
self.attributes.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) id: ::std::option::Option<i32>,
pub(crate) begin_offset: ::std::option::Option<i32>,
pub(crate) end_offset: ::std::option::Option<i32>,
pub(crate) score: ::std::option::Option<f32>,
pub(crate) text: ::std::option::Option<::std::string::String>,
pub(crate) category: ::std::option::Option<crate::types::EntityType>,
pub(crate) r#type: ::std::option::Option<crate::types::EntitySubType>,
pub(crate) traits: ::std::option::Option<::std::vec::Vec<crate::types::Trait>>,
pub(crate) attributes: ::std::option::Option<::std::vec::Vec<crate::types::Attribute>>,
}
impl EntityBuilder {
/// <p>The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather than a global unique identifier.</p>
pub fn id(mut self, input: i32) -> Self {
self.id = ::std::option::Option::Some(input);
self
}
/// <p>The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather than a global unique identifier.</p>
pub fn set_id(mut self, input: ::std::option::Option<i32>) -> Self {
self.id = input;
self
}
/// <p>The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather than a global unique identifier.</p>
pub fn get_id(&self) -> &::std::option::Option<i32> {
&self.id
}
/// <p>The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 code point in the string.</p>
pub fn begin_offset(mut self, input: i32) -> Self {
self.begin_offset = ::std::option::Option::Some(input);
self
}
/// <p>The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 code point in the string.</p>
pub fn set_begin_offset(mut self, input: ::std::option::Option<i32>) -> Self {
self.begin_offset = input;
self
}
/// <p>The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 code point in the string.</p>
pub fn get_begin_offset(&self) -> &::std::option::Option<i32> {
&self.begin_offset
}
/// <p>The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 code point in the string.</p>
pub fn end_offset(mut self, input: i32) -> Self {
self.end_offset = ::std::option::Option::Some(input);
self
}
/// <p>The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 code point in the string.</p>
pub fn set_end_offset(mut self, input: ::std::option::Option<i32>) -> Self {
self.end_offset = input;
self
}
/// <p>The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 code point in the string.</p>
pub fn get_end_offset(&self) -> &::std::option::Option<i32> {
&self.end_offset
}
/// <p>The level of confidence that Amazon Comprehend Medical 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 Medical 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 Medical has in the accuracy of the detection.</p>
pub fn get_score(&self) -> &::std::option::Option<f32> {
&self.score
}
/// <p>The segment of input text extracted as this 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 segment of input text extracted as this entity.</p>
pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.text = input;
self
}
/// <p>The segment of input text extracted as this entity.</p>
pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
&self.text
}
/// <p>The category of the entity.</p>
pub fn category(mut self, input: crate::types::EntityType) -> Self {
self.category = ::std::option::Option::Some(input);
self
}
/// <p>The category of the entity.</p>
pub fn set_category(mut self, input: ::std::option::Option<crate::types::EntityType>) -> Self {
self.category = input;
self
}
/// <p>The category of the entity.</p>
pub fn get_category(&self) -> &::std::option::Option<crate::types::EntityType> {
&self.category
}
/// <p>Describes the specific type of entity with category of entities.</p>
pub fn r#type(mut self, input: crate::types::EntitySubType) -> Self {
self.r#type = ::std::option::Option::Some(input);
self
}
/// <p>Describes the specific type of entity with category of entities.</p>
pub fn set_type(mut self, input: ::std::option::Option<crate::types::EntitySubType>) -> Self {
self.r#type = input;
self
}
/// <p>Describes the specific type of entity with category of entities.</p>
pub fn get_type(&self) -> &::std::option::Option<crate::types::EntitySubType> {
&self.r#type
}
/// Appends an item to `traits`.
///
/// To override the contents of this collection use [`set_traits`](Self::set_traits).
///
/// <p>Contextual information for the entity.</p>
pub fn traits(mut self, input: crate::types::Trait) -> Self {
let mut v = self.traits.unwrap_or_default();
v.push(input);
self.traits = ::std::option::Option::Some(v);
self
}
/// <p>Contextual information for the entity.</p>
pub fn set_traits(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Trait>>) -> Self {
self.traits = input;
self
}
/// <p>Contextual information for the entity.</p>
pub fn get_traits(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Trait>> {
&self.traits
}
/// Appends an item to `attributes`.
///
/// To override the contents of this collection use [`set_attributes`](Self::set_attributes).
///
/// <p>The extracted attributes that relate to this entity.</p>
pub fn attributes(mut self, input: crate::types::Attribute) -> Self {
let mut v = self.attributes.unwrap_or_default();
v.push(input);
self.attributes = ::std::option::Option::Some(v);
self
}
/// <p>The extracted attributes that relate to this entity.</p>
pub fn set_attributes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Attribute>>) -> Self {
self.attributes = input;
self
}
/// <p>The extracted attributes that relate to this entity.</p>
pub fn get_attributes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Attribute>> {
&self.attributes
}
/// Consumes the builder and constructs a [`Entity`](crate::types::Entity).
pub fn build(self) -> crate::types::Entity {
crate::types::Entity {
id: self.id,
begin_offset: self.begin_offset,
end_offset: self.end_offset,
score: self.score,
text: self.text,
category: self.category,
r#type: self.r#type,
traits: self.traits,
attributes: self.attributes,
}
}
}