#[non_exhaustive]pub struct Entity {
pub name: String,
pub type: Type,
pub metadata: HashMap<String, String>,
pub mentions: Vec<EntityMention>,
pub sentiment: Option<Sentiment>,
/* private fields */
}Expand description
Represents a phrase in the text that is a known entity, such as a person, an organization, or location. The API associates information, such as probability and mentions, with entities.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringThe representative name for the entity.
type: TypeThe entity type.
metadata: HashMap<String, String>Metadata associated with the entity.
For the metadata associated with other entity types, see the Type table below.
mentions: Vec<EntityMention>The mentions of this entity in the input document. The API currently supports proper noun mentions.
sentiment: Option<Sentiment>For calls to [AnalyzeEntitySentiment][] or if [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to true, this field will contain the aggregate sentiment expressed for this entity in the provided document.
Implementations§
Source§impl Entity
impl Entity
pub fn new() -> Self
Sourcepub fn set_metadata<T, K, V>(self, v: T) -> Self
pub fn set_metadata<T, K, V>(self, v: T) -> Self
Sourcepub fn set_mentions<T, V>(self, v: T) -> Self
pub fn set_mentions<T, V>(self, v: T) -> Self
Sourcepub fn set_sentiment<T>(self, v: T) -> Self
pub fn set_sentiment<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_sentiment<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_sentiment<T>(self, v: Option<T>) -> Self
Trait Implementations§
impl StructuralPartialEq for Entity
Auto Trait Implementations§
impl Freeze for Entity
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnwindSafe for Entity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more