#[non_exhaustive]pub struct Entity {
pub name: String,
pub type: Type,
pub metadata: HashMap<String, String>,
pub mentions: Vec<EntityMention>,
pub sentiment: Option<Sentiment>,
}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
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
Sourcepub fn set_sentiment<T: Into<Option<Sentiment>>>(self, v: T) -> Self
pub fn set_sentiment<T: Into<Option<Sentiment>>>(self, v: T) -> Self
Sets the value of sentiment.
Sourcepub fn set_mentions<T, V>(self, v: T) -> Self
pub fn set_mentions<T, V>(self, v: T) -> Self
Sets the value of mentions.
Sourcepub fn set_metadata<T, K, V>(self, v: T) -> Self
pub fn set_metadata<T, K, V>(self, v: T) -> Self
Sets the value of metadata.