Sentiment Analysis in Google Sheets
Sentiment Analysis integrates part of the functionality provided by the Sentiment Analysis API. It provides two levels of analysis: a global, more general sentiment analysis of the whole text, and a feature-level analysis, which shows the aggregated polarity of each entity and concept detected in the text.
On the right, you can see the sidebar that appears when you click on Sentiment Analysis.
There are two sections in the interface: Select cells with texts to analyze, which we have already covered in the corresponding section, and Analysis settings.
In Analysis settings you can configure three values:
- Language, to select the language of the texts. By default, the language set as preferred in the General Settings will be preselected. The possible values are: Spanish, English, French, Catalan, Portuguese and Italian as well as the languages included in the Nordic pack, Danish, Swedish, Norwegian and Finnish.
- Model, to select the model that will be used to measure the sentiment of the texts. The models listed are associated to specific languages, so the two values must be coherent. Currently, the only model available for all languages is General, but all the languages support the user sentiment models defined in the sentiment models customization console that are associated to the
license key introduced in the settings panel.
- User dictionary, to select if you want to use one of your user dictionaries in the analysis. The dictionaries that will appear in this menu are the ones created through the dictionaries customization console that are associated to the
key introduced in the settings panel.
The Advanced settings menu contains additional options for Sentiment Analysis. There are three differentiated sections: Analysis type, where you can select which type of sentiment analysis you want to carry out; Document analysis, where you can configure which fields you want to output when you analyze the sentiment of a document, and Topic analysis, where you can configure which fields you want to output when you analyze the sentiment of the topics featured in a document:
- Analysis type: select which type of sentiment analysis you want to carry out. There are two possible values and at least one of them must be selected:
Both analyses are independent from each other and are selected by default.
- Document, to extract the global sentiment of a text.
- Topics, to extract the topics of a text and find the polarity associated to each one of them.
- Document analysis: in this section you can configure which fields you want to output when you analyze the sentiment of a document. There are five possibilities:
- Polarity: shows the polarity tag obtained for the text. If no polarity has been detected, its value will be NONE; each value will have a color according to this scheme:
- Agreement: shows the agreement between the polarities detected in the text.
- Subjectivity: shows the subjectivity value obtained for the text.
- Confidence: shows the confidence value associated to the polarity detected.
- Irony: shows if the text is considered ironic.
- Topic analysis: in this section you can configure which fields you want to output when you analyze the sentiment of the topics detected in a document. There are six options:
- Form: shows the name by which the topic extracted is identified. It's non-configurable, so it always appears in the results.
- Topic category: shows the type of topic extracted, that is, if it's an entity or a concept.
- Rank: contains the order in which the topics have been detected. It's specific for each type of topic, that is, the first entity detected will be ranked 1, and the first concept will be ranked 1 too.
- Type: shows the type associated to the topic according to our ontology.
- Polarity: shows the polarity tag obtained for the topic. It behaves the same way as the polarity tag we've shown for Document Analysis.
- Sense ID: shows the ID of the topic detected.
You can read more information about each one of these fields in the response section of the API documentation.
There are two different types of sentiment analysis that can be carried out. Both of them will be shown in a new separate spreadsheet:
- The document-level analysis will be displayed in a sheet called "Global Sentiment Analysis".
- The feature-level analysis in a sheet called "Topics Sentiment Analysis".
This means that if both analysis options are selected, Sentiment Analysis will result in two new sheets.
Both sheets will include a column with the source text, a column with the IDs if enabled, and a column for each one of the output fields configured in the advanced settings.
This is an example of a possible output of the document-level polarity of some texts in English using the model General. The configuration is set to show all the available output fields:
The following example shows a possible output of the sentiment analysis at a feature level, which displays the topics found in the text and their polarity. The analysis of the example has been carried out over restaurant reviews in English, using the General model and showing all the available output fields. In this case, we have not specified the IDs in the input.
You can see in the image above how each topic found in a text is inserted in a new row.