: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new LanguageServiceClient({fallback: true}, gax); ```
Properties
apiEndpoint
getapiEndpoint():string;
The DNS address for this API service.
apiEndpoint
staticgetapiEndpoint():string;
The DNS address for this API service - same as servicePath.
Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties.
{Promise} - The promise which resolves to an array. The first element of the array is an object representing AnalyzeEntitiesResponse. Please see the documentation for more details and examples.
Example
/** * This snippet has been automatically generated and should be regarded as a code template only. * It will require modifications to work. * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. *//** * Required. Input document. */// const document = {}/** * The encoding type used by the API to calculate offsets. */// const encodingType = {}// Imports the Language libraryconst{LanguageServiceClient}=require('@google-cloud/language').v1;// Instantiates a clientconstlanguageClient=newLanguageServiceClient();asyncfunctioncallAnalyzeEntities(){// Construct requestconstrequest={document,};// Run requestconstresponse=awaitlanguageClient.analyzeEntities(request);console.log(response);}callAnalyzeEntities();
{Promise} - The promise which resolves to an array. The first element of the array is an object representing AnalyzeEntitySentimentResponse. Please see the documentation for more details and examples.
Example
/** * This snippet has been automatically generated and should be regarded as a code template only. * It will require modifications to work. * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. *//** * Required. Input document. */// const document = {}/** * The encoding type used by the API to calculate offsets. */// const encodingType = {}// Imports the Language libraryconst{LanguageServiceClient}=require('@google-cloud/language').v1;// Instantiates a clientconstlanguageClient=newLanguageServiceClient();asyncfunctioncallAnalyzeEntitySentiment(){// Construct requestconstrequest={document,};// Run requestconstresponse=awaitlanguageClient.analyzeEntitySentiment(request);console.log(response);}callAnalyzeEntitySentiment();
{Promise} - The promise which resolves to an array. The first element of the array is an object representing AnalyzeSentimentResponse. Please see the documentation for more details and examples.
Example
/** * This snippet has been automatically generated and should be regarded as a code template only. * It will require modifications to work. * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. *//** * Required. Input document. */// const document = {}/** * The encoding type used by the API to calculate sentence offsets. */// const encodingType = {}// Imports the Language libraryconst{LanguageServiceClient}=require('@google-cloud/language').v1;// Instantiates a clientconstlanguageClient=newLanguageServiceClient();asyncfunctioncallAnalyzeSentiment(){// Construct requestconstrequest={document,};// Run requestconstresponse=awaitlanguageClient.analyzeSentiment(request);console.log(response);}callAnalyzeSentiment();
Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties.
{Promise} - The promise which resolves to an array. The first element of the array is an object representing AnalyzeSyntaxResponse. Please see the documentation for more details and examples.
Example
/** * This snippet has been automatically generated and should be regarded as a code template only. * It will require modifications to work. * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. *//** * Required. Input document. */// const document = {}/** * The encoding type used by the API to calculate offsets. */// const encodingType = {}// Imports the Language libraryconst{LanguageServiceClient}=require('@google-cloud/language').v1;// Instantiates a clientconstlanguageClient=newLanguageServiceClient();asyncfunctioncallAnalyzeSyntax(){// Construct requestconstrequest={document,};// Run requestconstresponse=awaitlanguageClient.analyzeSyntax(request);console.log(response);}callAnalyzeSyntax();
{Promise} - The promise which resolves to an array. The first element of the array is an object representing AnnotateTextResponse. Please see the documentation for more details and examples.
Example
/** * This snippet has been automatically generated and should be regarded as a code template only. * It will require modifications to work. * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. *//** * Required. Input document. */// const document = {}/** * Required. The enabled features. */// const features = {}/** * The encoding type used by the API to calculate offsets. */// const encodingType = {}// Imports the Language libraryconst{LanguageServiceClient}=require('@google-cloud/language').v1;// Instantiates a clientconstlanguageClient=newLanguageServiceClient();asyncfunctioncallAnnotateText(){// Construct requestconstrequest={document,features,};// Run requestconstresponse=awaitlanguageClient.annotateText(request);console.log(response);}callAnnotateText();
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ClassifyTextResponse. Please see the documentation for more details and examples.
Example
/** * This snippet has been automatically generated and should be regarded as a code template only. * It will require modifications to work. * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. *//** * Required. Input document. */// const document = {}/** * Model options to use for classification. Defaults to v1 options if not * specified. */// const classificationModelOptions = {}// Imports the Language libraryconst{LanguageServiceClient}=require('@google-cloud/language').v1;// Instantiates a clientconstlanguageClient=newLanguageServiceClient();asyncfunctioncallClassifyText(){// Construct requestconstrequest={document,};// Run requestconstresponse=awaitlanguageClient.classifyText(request);console.log(response);}callClassifyText();
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns
Type
Description
Promise<{
[name: string]: Function;
}>
{Promise} A promise that resolves to an authenticated service stub.
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ModerateTextResponse. Please see the documentation for more details and examples.
Example
/** * This snippet has been automatically generated and should be regarded as a code template only. * It will require modifications to work. * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. *//** * Required. Input document. */// const document = {}// Imports the Language libraryconst{LanguageServiceClient}=require('@google-cloud/language').v1;// Instantiates a clientconstlanguageClient=newLanguageServiceClient();asyncfunctioncallModerateText(){// Construct requestconstrequest={document,};// Run requestconstresponse=awaitlanguageClient.moderateText(request);console.log(response);}callModerateText();
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-28 UTC."],[],[]]