You're viewing Apigee Edge documentation.
Go to the
Apigee X documentation. info
Version 1.2.0
Provides access to the Google Cloud Natural Language API.
Use this extension to classify content by applying categories, as well as to analyze content sentiment on a positive to negative scale.
This content provides reference for configuring and using this extension. For steps to configure an extension using the Apigee console, see Adding and configuring an extension.
Actions
classifyContent
Analyzes a portion of text and returns a list of content categories that apply to the text.
For more on this feature in the Natural Language API, see Classifying Content and Content Categories.
Request parameters
<Input><![CDATA[{
"data" : "content-to-analyze"
}]]></Input>
Parameter | Description | Type | Default | Required |
---|---|---|---|---|
data | The content to analyze. | String | None. | Yes. |
Response
A Categories array in which each item contains a category for classifying the content and a confidence score.
sentenceSentiment
Analyzes the given text and identifies the prevailing emotional opinion within it, especially to determine a writer's attitude as positive, negative, or neutral.
For more on this feature in the Natural Language API, see Analyzing Sentiment and Natural Language API Basics.
Request parameters
<Input><![CDATA[{
"data" : "content-to-analyze"
}]]></Input>
Parameter | Description | Type | Default | Required |
---|---|---|---|---|
data | The content to analyze. | String | None. | Yes. |
Response
An object containing sentiment scores for the document overall and each of its sentences (in an array). For both the document and its sentences, the following properties are included:
- A Content property with the content analyzed.
- A Score property indicating the content's sentiment on a scale between 1 and -1, from positive (positive number) to negative (negative number).
- A Magnitude property indicating the overall strength of emotion (both positive and negative) within the content, between 0.0 and +inf.
entitySentiment
Analyzes the specified text to determine the sentiment (positive or negative) expressed about each entity within the text. Entity sentiment is represented by numerical score and magnitude values and is determined for each mention of an entity. Those scores are then aggregated into an overall sentiment score and magnitude for an entity.
For more about entity analysis in the Google Cloud Natural Language API, see Analyzing Entity Sentiment and Interpreting sentiment analysis values.
Request parameters
<Input><![CDATA[{
"data" : "content-to-analyze"
}]]></Input>
Parameter | Description | Type | Default | Required |
---|---|---|---|---|
data | The content to analyze. | String | None. | Yes. |
Response
An array of objects containing sentiment scores for entities in the text. For both the document and its sentences, the following properties are included:
- A Name property with .
- A Type property describing the entity's type.
- A Score property indicating the entity's sentiment on a scale between 1 and -1, from positive (positive number) to negative (negative number).
- A Magnitude property indicating the strength of emotion (both positive and negative) for the entity, between 0.0 and +inf.
Configuration Reference
Use the following when you're configuring and deploying this extension for use in API proxies.
Common extension properties
The following properties are present for every extension.
Property | Description | Default | Required |
---|---|---|---|
name |
Name you're giving this configuration of the extension. | None | Yes |
packageName |
Name of the extension package as given by Apigee Edge. | None | Yes |
version |
Version number for the extension package from which you're configuring an extension. | None | Yes |
configuration |
Configuration value specific to the extension you're adding. See Properties for this extension package | None | Yes |
Properties for this extension package
Specify values for the following configuration properties specific to this extension.
Property | Description | Default | Required |
---|---|---|---|
credentials | When entered in the Apigee Edge console, this is the contents of your service account key file. When sent via the management API, it is a base64-encoded value generated from the service account key file. | None. | Yes. |