public abstract class LanguageServiceClient
LanguageService client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Language.V1Assembly
Google.Cloud.Language.V1.dll
Remarks
Provides text analysis operations such as sentiment analysis and entity recognition.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the LanguageService service, which is a host of "language.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
String |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default LanguageService scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyList<String> |
The default LanguageService scopes are:
GrpcClient
public virtual LanguageService.LanguageServiceClient GrpcClient { get; }
The underlying gRPC LanguageService client
Property Value | |
---|---|
Type | Description |
LanguageService.LanguageServiceClient |
Methods
AnalyzeEntities(AnalyzeEntitiesRequest, CallSettings)
public virtual AnalyzeEntitiesResponse AnalyzeEntities(AnalyzeEntitiesRequest request, CallSettings callSettings = null)
Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.
Parameters | |
---|---|
Name | Description |
request | AnalyzeEntitiesRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
AnalyzeEntitiesResponse | The RPC response. |
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest
{
Document = new Document(),
EncodingType = EncodingType.None,
};
// Make the request
AnalyzeEntitiesResponse response = languageServiceClient.AnalyzeEntities(request);
AnalyzeEntities(Document, CallSettings)
public virtual AnalyzeEntitiesResponse AnalyzeEntities(Document document, CallSettings callSettings = null)
Analyzes the entities in the given document, specifying an EncodingType of UTF-16 for offsets.
Parameters | |
---|---|
Name | Description |
document | Document The document to analyze. |
callSettings | CallSettings The call settings to apply to the RPC, if any. |
Returns | |
---|---|
Type | Description |
AnalyzeEntitiesResponse | The result of the entity analysis. |
This method simply calls AnalyzeEntities(Document, EncodingType, CallSettings), passing an EncodingType of UTF-16. This is the encoding used internally by .NET strings, so the offsets returned by the analysis will be suitable for use in calls such as System.String.Substring(System.Int32,System.Int32).
LanguageServiceClient client = LanguageServiceClient.Create();
Document document = Document.FromPlainText("Richard of York gave battle in vain.");
AnalyzeEntitiesResponse response = client.AnalyzeEntities(document);
Console.WriteLine($"Detected language: {response.Language}");
Console.WriteLine("Detected entities:");
foreach (Entity entity in response.Entities)
{
Console.WriteLine($" {entity.Name} ({(int) (entity.Salience * 100)}%)");
}
AnalyzeEntities(Document, EncodingType, CallSettings)
public virtual AnalyzeEntitiesResponse AnalyzeEntities(Document document, EncodingType encodingType, CallSettings callSettings = null)
Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
encodingType | EncodingType The encoding type used by the API to calculate offsets. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
AnalyzeEntitiesResponse | The RPC response. |
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
Document document = new Document();
EncodingType encodingType = EncodingType.None;
// Make the request
AnalyzeEntitiesResponse response = languageServiceClient.AnalyzeEntities(document, encodingType);
AnalyzeEntitiesAsync(AnalyzeEntitiesRequest, CallSettings)
public virtual Task<AnalyzeEntitiesResponse> AnalyzeEntitiesAsync(AnalyzeEntitiesRequest request, CallSettings callSettings = null)
Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.
Parameters | |
---|---|
Name | Description |
request | AnalyzeEntitiesRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeEntitiesResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest
{
Document = new Document(),
EncodingType = EncodingType.None,
};
// Make the request
AnalyzeEntitiesResponse response = await languageServiceClient.AnalyzeEntitiesAsync(request);
AnalyzeEntitiesAsync(AnalyzeEntitiesRequest, CancellationToken)
public virtual Task<AnalyzeEntitiesResponse> AnalyzeEntitiesAsync(AnalyzeEntitiesRequest request, CancellationToken cancellationToken)
Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.
Parameters | |
---|---|
Name | Description |
request | AnalyzeEntitiesRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeEntitiesResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
AnalyzeEntitiesRequest request = new AnalyzeEntitiesRequest
{
Document = new Document(),
EncodingType = EncodingType.None,
};
// Make the request
AnalyzeEntitiesResponse response = await languageServiceClient.AnalyzeEntitiesAsync(request);
AnalyzeEntitiesAsync(Document, CallSettings)
public virtual Task<AnalyzeEntitiesResponse> AnalyzeEntitiesAsync(Document document, CallSettings callSettings = null)
Analyzes the entities in the given document asynchronously, specifying an EncodingType of UTF-16 for offsets.
Parameters | |
---|---|
Name | Description |
document | Document The document to analyze. |
callSettings | CallSettings The call settings to apply to the RPC, if any. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeEntitiesResponse> | A task representing the asynchronous operation. The result of the task is the entity analysis response. |
This method simply calls AnalyzeEntitiesAsync(Document, EncodingType, CallSettings), passing an EncodingType of UTF-16. This is the encoding used internally by .NET strings, so the offsets returned by the analysis will be suitable for use in calls such as System.String.Substring(System.Int32,System.Int32).
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
// Make the request
AnalyzeEntitiesResponse response = await languageServiceClient.AnalyzeEntitiesAsync(document);
AnalyzeEntitiesAsync(Document, EncodingType, CallSettings)
public virtual Task<AnalyzeEntitiesResponse> AnalyzeEntitiesAsync(Document document, EncodingType encodingType, CallSettings callSettings = null)
Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
encodingType | EncodingType The encoding type used by the API to calculate offsets. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeEntitiesResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
EncodingType encodingType = EncodingType.None;
// Make the request
AnalyzeEntitiesResponse response = await languageServiceClient.AnalyzeEntitiesAsync(document, encodingType);
AnalyzeEntitiesAsync(Document, EncodingType, CancellationToken)
public virtual Task<AnalyzeEntitiesResponse> AnalyzeEntitiesAsync(Document document, EncodingType encodingType, CancellationToken cancellationToken)
Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
encodingType | EncodingType The encoding type used by the API to calculate offsets. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeEntitiesResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
EncodingType encodingType = EncodingType.None;
// Make the request
AnalyzeEntitiesResponse response = await languageServiceClient.AnalyzeEntitiesAsync(document, encodingType);
AnalyzeEntitiesAsync(Document, CancellationToken)
public virtual Task<AnalyzeEntitiesResponse> AnalyzeEntitiesAsync(Document document, CancellationToken cancellationToken)
Analyzes the entities in the given document asynchronously, specifying an EncodingType of UTF-16 for offsets.
Parameters | |
---|---|
Name | Description |
document | Document The document to analyze. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeEntitiesResponse> | A task representing the asynchronous operation. The result of the task is the entity analysis response. |
This method simply calls AnalyzeEntitiesAsync(Document, EncodingType, CancellationToken), passing an EncodingType of UTF-16. This is the encoding used internally by .NET strings, so the offsets returned by the analysis will be suitable for use in calls such as System.String.Substring(System.Int32,System.Int32).
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
// Make the request
AnalyzeEntitiesResponse response = await languageServiceClient.AnalyzeEntitiesAsync(document);
AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest, CallSettings)
public virtual AnalyzeEntitySentimentResponse AnalyzeEntitySentiment(AnalyzeEntitySentimentRequest request, CallSettings callSettings = null)
Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes sentiment associated with each entity and its mentions.
Parameters | |
---|---|
Name | Description |
request | AnalyzeEntitySentimentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
AnalyzeEntitySentimentResponse | The RPC response. |
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
AnalyzeEntitySentimentRequest request = new AnalyzeEntitySentimentRequest
{
Document = new Document(),
EncodingType = EncodingType.None,
};
// Make the request
AnalyzeEntitySentimentResponse response = languageServiceClient.AnalyzeEntitySentiment(request);
AnalyzeEntitySentiment(Document, CallSettings)
public virtual AnalyzeEntitySentimentResponse AnalyzeEntitySentiment(Document document, CallSettings callSettings = null)
Analyzes the entities in the given document and analyzes the sentiment associated with them, specifying an EncodingType of UTF-16 for offsets.
Parameters | |
---|---|
Name | Description |
document | Document The document to analyze. |
callSettings | CallSettings The call settings to apply to the RPC, if any. |
Returns | |
---|---|
Type | Description |
AnalyzeEntitySentimentResponse | The result of the entity and sentiment analysis. |
This method simply calls AnalyzeEntitySentiment(Document, EncodingType, CallSettings), passing an EncodingType of UTF-16. This is the encoding used internally by .NET strings, so the offsets returned by the analysis will be suitable for use in calls such as System.String.Substring(System.Int32,System.Int32).
LanguageServiceClient client = LanguageServiceClient.Create();
Document document = Document.FromPlainText("Jennifer is clever and witty, but Robert is rude.");
AnalyzeEntitySentimentResponse response = client.AnalyzeEntitySentiment(document);
foreach (Entity entity in response.Entities)
{
Console.WriteLine($"{entity.Name} ({(int)(entity.Salience * 100)}%)");
Console.WriteLine($" Sentiment score: {entity.Sentiment.Score}; magnitude: {entity.Sentiment.Magnitude}");
}
AnalyzeEntitySentiment(Document, EncodingType, CallSettings)
public virtual AnalyzeEntitySentimentResponse AnalyzeEntitySentiment(Document document, EncodingType encodingType, CallSettings callSettings = null)
Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes sentiment associated with each entity and its mentions.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
encodingType | EncodingType The encoding type used by the API to calculate offsets. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
AnalyzeEntitySentimentResponse | The RPC response. |
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
Document document = new Document();
EncodingType encodingType = EncodingType.None;
// Make the request
AnalyzeEntitySentimentResponse response = languageServiceClient.AnalyzeEntitySentiment(document, encodingType);
AnalyzeEntitySentimentAsync(AnalyzeEntitySentimentRequest, CallSettings)
public virtual Task<AnalyzeEntitySentimentResponse> AnalyzeEntitySentimentAsync(AnalyzeEntitySentimentRequest request, CallSettings callSettings = null)
Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes sentiment associated with each entity and its mentions.
Parameters | |
---|---|
Name | Description |
request | AnalyzeEntitySentimentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeEntitySentimentResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
AnalyzeEntitySentimentRequest request = new AnalyzeEntitySentimentRequest
{
Document = new Document(),
EncodingType = EncodingType.None,
};
// Make the request
AnalyzeEntitySentimentResponse response = await languageServiceClient.AnalyzeEntitySentimentAsync(request);
AnalyzeEntitySentimentAsync(AnalyzeEntitySentimentRequest, CancellationToken)
public virtual Task<AnalyzeEntitySentimentResponse> AnalyzeEntitySentimentAsync(AnalyzeEntitySentimentRequest request, CancellationToken cancellationToken)
Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes sentiment associated with each entity and its mentions.
Parameters | |
---|---|
Name | Description |
request | AnalyzeEntitySentimentRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeEntitySentimentResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
AnalyzeEntitySentimentRequest request = new AnalyzeEntitySentimentRequest
{
Document = new Document(),
EncodingType = EncodingType.None,
};
// Make the request
AnalyzeEntitySentimentResponse response = await languageServiceClient.AnalyzeEntitySentimentAsync(request);
AnalyzeEntitySentimentAsync(Document, CallSettings)
public virtual Task<AnalyzeEntitySentimentResponse> AnalyzeEntitySentimentAsync(Document document, CallSettings callSettings = null)
Analyzes the entities in the given document asynchronously and analyzes the sentiment associated with them, specifying an EncodingType of UTF-16 for offsets.
Parameters | |
---|---|
Name | Description |
document | Document The document to analyze. |
callSettings | CallSettings The call settings to apply to the RPC, if any. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeEntitySentimentResponse> | A task representing the asynchronous operation. The result of the task is the entity and sentiment analysis response. |
This method simply calls AnalyzeEntitySentimentAsync(Document, EncodingType, CallSettings), passing an EncodingType of UTF-16. This is the encoding used internally by .NET strings, so the offsets returned by the analysis will be suitable for use in calls such as System.String.Substring(System.Int32,System.Int32).
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
// Make the request
AnalyzeEntitySentimentResponse response = await languageServiceClient.AnalyzeEntitySentimentAsync(document);
AnalyzeEntitySentimentAsync(Document, EncodingType, CallSettings)
public virtual Task<AnalyzeEntitySentimentResponse> AnalyzeEntitySentimentAsync(Document document, EncodingType encodingType, CallSettings callSettings = null)
Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes sentiment associated with each entity and its mentions.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
encodingType | EncodingType The encoding type used by the API to calculate offsets. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeEntitySentimentResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
EncodingType encodingType = EncodingType.None;
// Make the request
AnalyzeEntitySentimentResponse response = await languageServiceClient.AnalyzeEntitySentimentAsync(document, encodingType);
AnalyzeEntitySentimentAsync(Document, EncodingType, CancellationToken)
public virtual Task<AnalyzeEntitySentimentResponse> AnalyzeEntitySentimentAsync(Document document, EncodingType encodingType, CancellationToken cancellationToken)
Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes sentiment associated with each entity and its mentions.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
encodingType | EncodingType The encoding type used by the API to calculate offsets. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeEntitySentimentResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
EncodingType encodingType = EncodingType.None;
// Make the request
AnalyzeEntitySentimentResponse response = await languageServiceClient.AnalyzeEntitySentimentAsync(document, encodingType);
AnalyzeEntitySentimentAsync(Document, CancellationToken)
public virtual Task<AnalyzeEntitySentimentResponse> AnalyzeEntitySentimentAsync(Document document, CancellationToken cancellationToken)
Analyzes the entities in the given document asynchronously and analyzes the sentiment associated with them, specifying an EncodingType of UTF-16 for offsets.
Parameters | |
---|---|
Name | Description |
document | Document The document to analyze. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeEntitySentimentResponse> | A task representing the asynchronous operation. The result of the task is the entity and sentiment analysis response. |
This method simply calls AnalyzeEntitySentimentAsync(Document, EncodingType, CancellationToken), passing an EncodingType of UTF-16. This is the encoding used internally by .NET strings, so the offsets returned by the analysis will be suitable for use in calls such as System.String.Substring(System.Int32,System.Int32).
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
// Make the request
AnalyzeEntitySentimentResponse response = await languageServiceClient.AnalyzeEntitySentimentAsync(document);
AnalyzeSentiment(AnalyzeSentimentRequest, CallSettings)
public virtual AnalyzeSentimentResponse AnalyzeSentiment(AnalyzeSentimentRequest request, CallSettings callSettings = null)
Analyzes the sentiment of the provided text.
Parameters | |
---|---|
Name | Description |
request | AnalyzeSentimentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
AnalyzeSentimentResponse | The RPC response. |
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
AnalyzeSentimentRequest request = new AnalyzeSentimentRequest
{
Document = new Document(),
EncodingType = EncodingType.None,
};
// Make the request
AnalyzeSentimentResponse response = languageServiceClient.AnalyzeSentiment(request);
AnalyzeSentiment(Document, CallSettings)
public virtual AnalyzeSentimentResponse AnalyzeSentiment(Document document, CallSettings callSettings = null)
Analyzes the sentiment of the provided text.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
AnalyzeSentimentResponse | The RPC response. |
LanguageServiceClient client = LanguageServiceClient.Create();
Document document = Document.FromPlainText("You're simply the best - better than all the rest.");
AnalyzeSentimentResponse response = client.AnalyzeSentiment(document);
Console.WriteLine($"Detected language: {response.Language}");
Console.WriteLine($"Sentiment score: {response.DocumentSentiment.Score}");
Console.WriteLine($"Sentiment magnitude: {response.DocumentSentiment.Magnitude}");
AnalyzeSentiment(Document, EncodingType, CallSettings)
public virtual AnalyzeSentimentResponse AnalyzeSentiment(Document document, EncodingType encodingType, CallSettings callSettings = null)
Analyzes the sentiment of the provided text.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
encodingType | EncodingType The encoding type used by the API to calculate sentence offsets. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
AnalyzeSentimentResponse | The RPC response. |
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
Document document = new Document();
EncodingType encodingType = EncodingType.None;
// Make the request
AnalyzeSentimentResponse response = languageServiceClient.AnalyzeSentiment(document, encodingType);
AnalyzeSentimentAsync(AnalyzeSentimentRequest, CallSettings)
public virtual Task<AnalyzeSentimentResponse> AnalyzeSentimentAsync(AnalyzeSentimentRequest request, CallSettings callSettings = null)
Analyzes the sentiment of the provided text.
Parameters | |
---|---|
Name | Description |
request | AnalyzeSentimentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeSentimentResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
AnalyzeSentimentRequest request = new AnalyzeSentimentRequest
{
Document = new Document(),
EncodingType = EncodingType.None,
};
// Make the request
AnalyzeSentimentResponse response = await languageServiceClient.AnalyzeSentimentAsync(request);
AnalyzeSentimentAsync(AnalyzeSentimentRequest, CancellationToken)
public virtual Task<AnalyzeSentimentResponse> AnalyzeSentimentAsync(AnalyzeSentimentRequest request, CancellationToken cancellationToken)
Analyzes the sentiment of the provided text.
Parameters | |
---|---|
Name | Description |
request | AnalyzeSentimentRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeSentimentResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
AnalyzeSentimentRequest request = new AnalyzeSentimentRequest
{
Document = new Document(),
EncodingType = EncodingType.None,
};
// Make the request
AnalyzeSentimentResponse response = await languageServiceClient.AnalyzeSentimentAsync(request);
AnalyzeSentimentAsync(Document, CallSettings)
public virtual Task<AnalyzeSentimentResponse> AnalyzeSentimentAsync(Document document, CallSettings callSettings = null)
Analyzes the sentiment of the provided text.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeSentimentResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
// Make the request
AnalyzeSentimentResponse response = await languageServiceClient.AnalyzeSentimentAsync(document);
AnalyzeSentimentAsync(Document, EncodingType, CallSettings)
public virtual Task<AnalyzeSentimentResponse> AnalyzeSentimentAsync(Document document, EncodingType encodingType, CallSettings callSettings = null)
Analyzes the sentiment of the provided text.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
encodingType | EncodingType The encoding type used by the API to calculate sentence offsets. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeSentimentResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
EncodingType encodingType = EncodingType.None;
// Make the request
AnalyzeSentimentResponse response = await languageServiceClient.AnalyzeSentimentAsync(document, encodingType);
AnalyzeSentimentAsync(Document, EncodingType, CancellationToken)
public virtual Task<AnalyzeSentimentResponse> AnalyzeSentimentAsync(Document document, EncodingType encodingType, CancellationToken cancellationToken)
Analyzes the sentiment of the provided text.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
encodingType | EncodingType The encoding type used by the API to calculate sentence offsets. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeSentimentResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
EncodingType encodingType = EncodingType.None;
// Make the request
AnalyzeSentimentResponse response = await languageServiceClient.AnalyzeSentimentAsync(document, encodingType);
AnalyzeSentimentAsync(Document, CancellationToken)
public virtual Task<AnalyzeSentimentResponse> AnalyzeSentimentAsync(Document document, CancellationToken cancellationToken)
Analyzes the sentiment of the provided text.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeSentimentResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
// Make the request
AnalyzeSentimentResponse response = await languageServiceClient.AnalyzeSentimentAsync(document);
AnalyzeSyntax(AnalyzeSyntaxRequest, CallSettings)
public virtual AnalyzeSyntaxResponse AnalyzeSyntax(AnalyzeSyntaxRequest request, CallSettings callSettings = null)
Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
Parameters | |
---|---|
Name | Description |
request | AnalyzeSyntaxRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
AnalyzeSyntaxResponse | The RPC response. |
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
AnalyzeSyntaxRequest request = new AnalyzeSyntaxRequest
{
Document = new Document(),
EncodingType = EncodingType.None,
};
// Make the request
AnalyzeSyntaxResponse response = languageServiceClient.AnalyzeSyntax(request);
AnalyzeSyntax(Document, CallSettings)
public virtual AnalyzeSyntaxResponse AnalyzeSyntax(Document document, CallSettings callSettings = null)
Analyzes the syntax in the given document, specifying an EncodingType of UTF-16 for offsets.
Parameters | |
---|---|
Name | Description |
document | Document The document to analyze. |
callSettings | CallSettings The call settings to apply to the RPC, if any. |
Returns | |
---|---|
Type | Description |
AnalyzeSyntaxResponse | The result of the entity analysis. |
This method simply calls AnalyzeSyntax(Document, EncodingType, CallSettings), passing an EncodingType of UTF-16. This is the encoding used internally by .NET strings, so the offsets returned by the analysis will be suitable for use in calls such as System.String.Substring(System.Int32,System.Int32).
LanguageServiceClient client = LanguageServiceClient.Create();
Document document = Document.FromPlainText(
"This is a simple sentence. This sentence, while not very complicated, is still more complicated than the first.");
AnalyzeSyntaxResponse response = client.AnalyzeSyntax(document);
Console.WriteLine($"Detected language: {response.Language}");
Console.WriteLine($"Number of sentences: {response.Sentences.Count}");
Console.WriteLine($"Number of tokens: {response.Tokens.Count}");
AnalyzeSyntax(Document, EncodingType, CallSettings)
public virtual AnalyzeSyntaxResponse AnalyzeSyntax(Document document, EncodingType encodingType, CallSettings callSettings = null)
Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
encodingType | EncodingType The encoding type used by the API to calculate offsets. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
AnalyzeSyntaxResponse | The RPC response. |
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
Document document = new Document();
EncodingType encodingType = EncodingType.None;
// Make the request
AnalyzeSyntaxResponse response = languageServiceClient.AnalyzeSyntax(document, encodingType);
AnalyzeSyntaxAsync(AnalyzeSyntaxRequest, CallSettings)
public virtual Task<AnalyzeSyntaxResponse> AnalyzeSyntaxAsync(AnalyzeSyntaxRequest request, CallSettings callSettings = null)
Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
Parameters | |
---|---|
Name | Description |
request | AnalyzeSyntaxRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeSyntaxResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
AnalyzeSyntaxRequest request = new AnalyzeSyntaxRequest
{
Document = new Document(),
EncodingType = EncodingType.None,
};
// Make the request
AnalyzeSyntaxResponse response = await languageServiceClient.AnalyzeSyntaxAsync(request);
AnalyzeSyntaxAsync(AnalyzeSyntaxRequest, CancellationToken)
public virtual Task<AnalyzeSyntaxResponse> AnalyzeSyntaxAsync(AnalyzeSyntaxRequest request, CancellationToken cancellationToken)
Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
Parameters | |
---|---|
Name | Description |
request | AnalyzeSyntaxRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeSyntaxResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
AnalyzeSyntaxRequest request = new AnalyzeSyntaxRequest
{
Document = new Document(),
EncodingType = EncodingType.None,
};
// Make the request
AnalyzeSyntaxResponse response = await languageServiceClient.AnalyzeSyntaxAsync(request);
AnalyzeSyntaxAsync(Document, CallSettings)
public virtual Task<AnalyzeSyntaxResponse> AnalyzeSyntaxAsync(Document document, CallSettings callSettings = null)
Analyzes the syntax in the given document asynchronously, specifying an EncodingType of UTF-16 for offsets.
Parameters | |
---|---|
Name | Description |
document | Document The document to analyze. |
callSettings | CallSettings The call settings to apply to the RPC, if any. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeSyntaxResponse> | A task representing the asynchronous operation. The result of the task is the entity analysis response. |
This method simply calls AnalyzeSyntaxAsync(Document, EncodingType, CallSettings), passing an EncodingType of UTF-16. This is the encoding used internally by .NET strings, so the offsets returned by the analysis will be suitable for use in calls such as System.String.Substring(System.Int32,System.Int32).
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
// Make the request
AnalyzeSyntaxResponse response = await languageServiceClient.AnalyzeSyntaxAsync(document);
AnalyzeSyntaxAsync(Document, EncodingType, CallSettings)
public virtual Task<AnalyzeSyntaxResponse> AnalyzeSyntaxAsync(Document document, EncodingType encodingType, CallSettings callSettings = null)
Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
encodingType | EncodingType The encoding type used by the API to calculate offsets. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeSyntaxResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
EncodingType encodingType = EncodingType.None;
// Make the request
AnalyzeSyntaxResponse response = await languageServiceClient.AnalyzeSyntaxAsync(document, encodingType);
AnalyzeSyntaxAsync(Document, EncodingType, CancellationToken)
public virtual Task<AnalyzeSyntaxResponse> AnalyzeSyntaxAsync(Document document, EncodingType encodingType, CancellationToken cancellationToken)
Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
encodingType | EncodingType The encoding type used by the API to calculate offsets. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeSyntaxResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
EncodingType encodingType = EncodingType.None;
// Make the request
AnalyzeSyntaxResponse response = await languageServiceClient.AnalyzeSyntaxAsync(document, encodingType);
AnalyzeSyntaxAsync(Document, CancellationToken)
public virtual Task<AnalyzeSyntaxResponse> AnalyzeSyntaxAsync(Document document, CancellationToken cancellationToken)
Analyzes the syntax in the given document asynchronously, specifying an EncodingType of UTF-16 for offsets.
Parameters | |
---|---|
Name | Description |
document | Document The document to analyze. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnalyzeSyntaxResponse> | A task representing the asynchronous operation. The result of the task is the entity analysis response. |
This method simply calls AnalyzeSyntaxAsync(Document, EncodingType, CancellationToken), passing an EncodingType of UTF-16. This is the encoding used internally by .NET strings, so the offsets returned by the analysis will be suitable for use in calls such as System.String.Substring(System.Int32,System.Int32).
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
// Make the request
AnalyzeSyntaxResponse response = await languageServiceClient.AnalyzeSyntaxAsync(document);
AnnotateText(AnnotateTextRequest, CallSettings)
public virtual AnnotateTextResponse AnnotateText(AnnotateTextRequest request, CallSettings callSettings = null)
A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.
Parameters | |
---|---|
Name | Description |
request | AnnotateTextRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
AnnotateTextResponse | The RPC response. |
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
AnnotateTextRequest request = new AnnotateTextRequest
{
Document = new Document(),
Features = new AnnotateTextRequest.Types.Features(),
EncodingType = EncodingType.None,
};
// Make the request
AnnotateTextResponse response = languageServiceClient.AnnotateText(request);
AnnotateText(Document, AnnotateTextRequest.Types.Features, CallSettings)
public virtual AnnotateTextResponse AnnotateText(Document document, AnnotateTextRequest.Types.Features features, CallSettings callSettings = null)
Annotates the given document, specifying an EncodingType of UTF-16 for offsets.
Parameters | |
---|---|
Name | Description |
document | Document The document to annotate. |
features | AnnotateTextRequest.Types.Features The analysis features to enable. |
callSettings | CallSettings The call settings to apply to the RPC, if any. |
Returns | |
---|---|
Type | Description |
AnnotateTextResponse | The result of the text analysis. |
This method simply calls AnnotateText(Document, AnnotateTextRequest.Types.Features, EncodingType, CallSettings), passing an EncodingType of UTF-16. This is the encoding used internally by .NET strings, so the offsets returned by the analysis will be suitable for use in calls such as System.String.Substring(System.Int32,System.Int32).
LanguageServiceClient client = LanguageServiceClient.Create();
Document document = Document.FromPlainText("Richard of York gave battle in vain.");
// "Features" selects which features you wish to enable. Here we want to extract syntax
// and entities - you can also extract document sentiment.
AnnotateTextResponse response = client.AnnotateText(document,
new Features { ExtractSyntax = true, ExtractEntities = true });
Console.WriteLine($"Detected language: {response.Language}");
// The Sentences and Tokens properties provide all kinds of information
// about the parsed text.
Console.WriteLine($"Number of sentences: {response.Sentences.Count}");
Console.WriteLine($"Number of tokens: {response.Tokens.Count}");
Console.WriteLine("Detected entities:");
foreach (Entity entity in response.Entities)
{
Console.WriteLine($" {entity.Name} ({(int)(entity.Salience * 100)}%)");
}
AnnotateText(Document, AnnotateTextRequest.Types.Features, EncodingType, CallSettings)
public virtual AnnotateTextResponse AnnotateText(Document document, AnnotateTextRequest.Types.Features features, EncodingType encodingType, CallSettings callSettings = null)
A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
features | AnnotateTextRequest.Types.Features The enabled features. |
encodingType | EncodingType The encoding type used by the API to calculate offsets. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
AnnotateTextResponse | The RPC response. |
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
Document document = new Document();
AnnotateTextRequest.Types.Features features = new AnnotateTextRequest.Types.Features();
EncodingType encodingType = EncodingType.None;
// Make the request
AnnotateTextResponse response = languageServiceClient.AnnotateText(document, features, encodingType);
AnnotateTextAsync(AnnotateTextRequest, CallSettings)
public virtual Task<AnnotateTextResponse> AnnotateTextAsync(AnnotateTextRequest request, CallSettings callSettings = null)
A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.
Parameters | |
---|---|
Name | Description |
request | AnnotateTextRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<AnnotateTextResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
AnnotateTextRequest request = new AnnotateTextRequest
{
Document = new Document(),
Features = new AnnotateTextRequest.Types.Features(),
EncodingType = EncodingType.None,
};
// Make the request
AnnotateTextResponse response = await languageServiceClient.AnnotateTextAsync(request);
AnnotateTextAsync(AnnotateTextRequest, CancellationToken)
public virtual Task<AnnotateTextResponse> AnnotateTextAsync(AnnotateTextRequest request, CancellationToken cancellationToken)
A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.
Parameters | |
---|---|
Name | Description |
request | AnnotateTextRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnnotateTextResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
AnnotateTextRequest request = new AnnotateTextRequest
{
Document = new Document(),
Features = new AnnotateTextRequest.Types.Features(),
EncodingType = EncodingType.None,
};
// Make the request
AnnotateTextResponse response = await languageServiceClient.AnnotateTextAsync(request);
AnnotateTextAsync(Document, AnnotateTextRequest.Types.Features, CallSettings)
public virtual Task<AnnotateTextResponse> AnnotateTextAsync(Document document, AnnotateTextRequest.Types.Features features, CallSettings callSettings = null)
Annotates the given document, specifying an EncodingType of UTF-16 for offsets.
Parameters | |
---|---|
Name | Description |
document | Document The document to annotate. |
features | AnnotateTextRequest.Types.Features The analysis features to enable. |
callSettings | CallSettings The call settings to apply to the RPC, if any. |
Returns | |
---|---|
Type | Description |
Task<AnnotateTextResponse> | A task representing the asynchronous operation. The result of the task is the text analysis response. |
This method simply calls AnnotateTextAsync(Document, AnnotateTextRequest.Types.Features, EncodingType, CallSettings), passing an EncodingType of UTF-16. This is the encoding used internally by .NET strings, so the offsets returned by the analysis will be suitable for use in calls such as System.String.Substring(System.Int32,System.Int32).
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
AnnotateTextRequest.Types.Features features = new AnnotateTextRequest.Types.Features();
// Make the request
AnnotateTextResponse response = await languageServiceClient.AnnotateTextAsync(document, features);
AnnotateTextAsync(Document, AnnotateTextRequest.Types.Features, EncodingType, CallSettings)
public virtual Task<AnnotateTextResponse> AnnotateTextAsync(Document document, AnnotateTextRequest.Types.Features features, EncodingType encodingType, CallSettings callSettings = null)
A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
features | AnnotateTextRequest.Types.Features The enabled features. |
encodingType | EncodingType The encoding type used by the API to calculate offsets. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<AnnotateTextResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
AnnotateTextRequest.Types.Features features = new AnnotateTextRequest.Types.Features();
EncodingType encodingType = EncodingType.None;
// Make the request
AnnotateTextResponse response = await languageServiceClient.AnnotateTextAsync(document, features, encodingType);
AnnotateTextAsync(Document, AnnotateTextRequest.Types.Features, EncodingType, CancellationToken)
public virtual Task<AnnotateTextResponse> AnnotateTextAsync(Document document, AnnotateTextRequest.Types.Features features, EncodingType encodingType, CancellationToken cancellationToken)
A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and analyzeSyntax provide in one call.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
features | AnnotateTextRequest.Types.Features The enabled features. |
encodingType | EncodingType The encoding type used by the API to calculate offsets. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnnotateTextResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
AnnotateTextRequest.Types.Features features = new AnnotateTextRequest.Types.Features();
EncodingType encodingType = EncodingType.None;
// Make the request
AnnotateTextResponse response = await languageServiceClient.AnnotateTextAsync(document, features, encodingType);
AnnotateTextAsync(Document, AnnotateTextRequest.Types.Features, CancellationToken)
public virtual Task<AnnotateTextResponse> AnnotateTextAsync(Document document, AnnotateTextRequest.Types.Features features, CancellationToken cancellationToken)
Annotates the given document, specifying an EncodingType of UTF-16 for offsets.
Parameters | |
---|---|
Name | Description |
document | Document The document to annotate. |
features | AnnotateTextRequest.Types.Features The analysis features to enable. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<AnnotateTextResponse> | A task representing the asynchronous operation. The result of the task is the text analysis response. |
This method simply calls AnnotateTextAsync(Document, AnnotateTextRequest.Types.Features, EncodingType, CancellationToken), passing an EncodingType of UTF-16. This is the encoding used internally by .NET strings, so the offsets returned by the analysis will be suitable for use in calls such as System.String.Substring(System.Int32,System.Int32).
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
AnnotateTextRequest.Types.Features features = new AnnotateTextRequest.Types.Features();
// Make the request
AnnotateTextResponse response = await languageServiceClient.AnnotateTextAsync(document, features);
ClassifyText(ClassifyTextRequest, CallSettings)
public virtual ClassifyTextResponse ClassifyText(ClassifyTextRequest request, CallSettings callSettings = null)
Classifies a document into categories.
Parameters | |
---|---|
Name | Description |
request | ClassifyTextRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
ClassifyTextResponse | The RPC response. |
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
ClassifyTextRequest request = new ClassifyTextRequest
{
Document = new Document(),
};
// Make the request
ClassifyTextResponse response = languageServiceClient.ClassifyText(request);
ClassifyText(Document, CallSettings)
public virtual ClassifyTextResponse ClassifyText(Document document, CallSettings callSettings = null)
Classifies a document into categories.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
ClassifyTextResponse | The RPC response. |
// Create client
LanguageServiceClient languageServiceClient = LanguageServiceClient.Create();
// Initialize request argument(s)
Document document = new Document();
// Make the request
ClassifyTextResponse response = languageServiceClient.ClassifyText(document);
ClassifyTextAsync(ClassifyTextRequest, CallSettings)
public virtual Task<ClassifyTextResponse> ClassifyTextAsync(ClassifyTextRequest request, CallSettings callSettings = null)
Classifies a document into categories.
Parameters | |
---|---|
Name | Description |
request | ClassifyTextRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<ClassifyTextResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
ClassifyTextRequest request = new ClassifyTextRequest
{
Document = new Document(),
};
// Make the request
ClassifyTextResponse response = await languageServiceClient.ClassifyTextAsync(request);
ClassifyTextAsync(ClassifyTextRequest, CancellationToken)
public virtual Task<ClassifyTextResponse> ClassifyTextAsync(ClassifyTextRequest request, CancellationToken cancellationToken)
Classifies a document into categories.
Parameters | |
---|---|
Name | Description |
request | ClassifyTextRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<ClassifyTextResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
ClassifyTextRequest request = new ClassifyTextRequest
{
Document = new Document(),
};
// Make the request
ClassifyTextResponse response = await languageServiceClient.ClassifyTextAsync(request);
ClassifyTextAsync(Document, CallSettings)
public virtual Task<ClassifyTextResponse> ClassifyTextAsync(Document document, CallSettings callSettings = null)
Classifies a document into categories.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<ClassifyTextResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
// Make the request
ClassifyTextResponse response = await languageServiceClient.ClassifyTextAsync(document);
ClassifyTextAsync(Document, CancellationToken)
public virtual Task<ClassifyTextResponse> ClassifyTextAsync(Document document, CancellationToken cancellationToken)
Classifies a document into categories.
Parameters | |
---|---|
Name | Description |
document | Document Input document. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<ClassifyTextResponse> | A Task containing the RPC response. |
// Create client
LanguageServiceClient languageServiceClient = await LanguageServiceClient.CreateAsync();
// Initialize request argument(s)
Document document = new Document();
// Make the request
ClassifyTextResponse response = await languageServiceClient.ClassifyTextAsync(document);
Create()
public static LanguageServiceClient Create()
Synchronously creates a LanguageServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use LanguageServiceClientBuilder.
Returns | |
---|---|
Type | Description |
LanguageServiceClient | The created LanguageServiceClient. |
CreateAsync(CancellationToken)
public static Task<LanguageServiceClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))
Asynchronously creates a LanguageServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use LanguageServiceClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
Task<LanguageServiceClient> | The task representing the created LanguageServiceClient. |
ShutdownDefaultChannelsAsync()
public static Task ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Returns | |
---|---|
Type | Description |
Task | A task representing the asynchronous shutdown operation. |
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.