pub struct LanguageService { /* private fields */ }Expand description
Implements a client for the Cloud Natural Language API.
§Example
let client = LanguageService::builder().build().await?;
// use `client` to make requests to the Cloud Natural Language API.§Service Description
Provides text analysis operations such as sentiment analysis and entity recognition.
§Configuration
To configure LanguageService use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://language.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
LanguageService holds a connection pool internally, it is advised to
create one and the reuse it. You do not need to wrap LanguageService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl LanguageService
impl LanguageService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for LanguageService.
let client = LanguageService::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: LanguageService + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: LanguageService + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn analyze_sentiment(&self) -> AnalyzeSentiment
pub fn analyze_sentiment(&self) -> AnalyzeSentiment
Analyzes the sentiment of the provided text.
Sourcepub fn analyze_entities(&self) -> AnalyzeEntities
pub fn analyze_entities(&self) -> AnalyzeEntities
Finds named entities (currently proper names and common nouns) in the text along with entity types, probability, mentions for each entity, and other properties.
Sourcepub fn classify_text(&self) -> ClassifyText
pub fn classify_text(&self) -> ClassifyText
Classifies a document into categories.
Sourcepub fn moderate_text(&self) -> ModerateText
pub fn moderate_text(&self) -> ModerateText
Moderates a document for harmful and sensitive categories.
Sourcepub fn annotate_text(&self) -> AnnotateText
pub fn annotate_text(&self) -> AnnotateText
A convenience method that provides all features in one call.
Trait Implementations§
Source§impl Clone for LanguageService
impl Clone for LanguageService
Source§fn clone(&self) -> LanguageService
fn clone(&self) -> LanguageService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more