👋 This document is a wiki on the use of Google Natural Language API, it will detail its main features, its setup and configuration, and present practical use cases.
API overview
The IA Natural Language API extracts information from unstructured text using Google Machine Learning, providing users with a way to understand natural language, such as :
- Sentiment analysis: It can determine whether the overall tone of a text is positive, negative or neutral.
- Entity analysis: extracts named entities (proper nouns, common nouns, etc.), as well as entity types, salience and mentions for each entity (historical monuments, celebrities, etc.).
- Syntax analysis: This breaks down the text into sentences and words, while identifying the role of each word (such as subject, verb, object, etc.).
- Content classification: The API can automatically categorize textual content into a variety of subjects, making it easy to manage and organize large datasets.
ℹ️ The various categories returned in the classification analysis are listed on this page.
- Text moderation: This is used to analyze text against a list of categories that may be considered sensitive or dangerous.
ℹ️ The list of categories returned in text moderation can be found on this page.
Example of API use
Google offers the possibility of testing the API online on the Google Cloud site. Here's the result of a category analysis of our Starfox Analytics agency's description:
"Born in 2020, Starfox Analytics relies on experts who are passionate about Data Marketing and Web Analytics. We support our customers on topics such as Data Layer implementation, GA4 migration, cookie & RGPD compliance, GTM server-side and Facebook conversion API. Rigor, availability and pro-activity are the fundamental qualities of our agency.
".

Content moderation
This analysis is the latest to see the light of day in the Google Natural Language API. It was added in September 2023.
Text moderation is used to detect sensitive or harmful content. The first moderation category that comes to mind is "toxicity", but there can be many other topics of interest. A model based on PaLM 2 feeds predictions and evaluates 16 categories
- Toxicity
- Insult
- Public Safety
- War & Conflict
- Denigrating
- Profanity
- Health
- Finance
- Violent
- Death
- Damage & Tragedy
- Religion & Belief
- Policy
- Sexual
- Firearms & Weapons
- Illicit drugs
- Legal
For example:
The text analysis result contains the categories with their corresponding confidence thresholds.
In our example, we've analyzed an extract from a Huffingtonpost FR article on the appointment of Gabriel Attal as Prime Minister.
- The category
Policy
obtains a score of99%
. - Il est conseillé d’ignorer les catégories dont le score est <
50%
because it's often unrepresentative.

Enterprise API use cases
Customer sentiment analysis: Companies can use this API to analyze customer opinions and comments on social networks, online forums or surveys. This enables them to understand customers' general feelings about their products or services.
Feedback on Products and Services: Analyze customer feedback to improve existing products and services or develop new offers to meet customer needs.
Pricing
Price per unit of 1000 characters
Price per unit of 1000 characters
Price per 100 characters

A need, a question?
Write to us at hello@starfox-analytics.com.
Our team will get back to you as soon as possible.