← Back to Blog

How to Use the Google NLP API to Extract Local SEO Entities (Step-by-Step Tutorial)

📅 August 12, 2026 ⏱ 10 min read 🏷️ Technical SEO

Stop guessing what Google thinks your page is about. The Google Cloud Natural Language API reveals exactly which entities—people, places, brands, concepts—Google's AI detects in your content, and how important they are.

In this step-by-step tutorial, you'll learn how to:

Whether you're a local business owner, an SEO agency, or a freelancer, this guide will give you a practical, repeatable workflow to build semantic authority in 2026.

📑 Table of Contents

What is the Google NLP API?

The Google Cloud Natural Language API is a machine learning tool that reveals the structure and meaning of text. It extracts entities (proper nouns like people, places, organizations, and concepts) from any text you feed it, along with their salience (importance) scores.

Think of it as putting on Google's glasses. When you run your content—or your competitor's content—through this API, you see exactly what Google "sees" when it reads your page. You stop guessing and start knowing.

Why Entities Matter More Than Keywords in 2026

In traditional SEO, the fundamental unit was a keyword. In AI search (Google Gemini, ChatGPT, Perplexity), the fundamental unit is an entity—a unique, identifiable thing: a brand, a person, a concept, a place.

Key shift: LLMs don't count keyword frequency—they build knowledge graphs about your brand, asking: what is this thing? What category does it belong to? What relationships connect it to other entities?

For local SEO, this means:

🔥 Pro Tip: The API offers 5,000 free units per month. For most local SEO audits (analyzing 10-20 competitor pages), this is more than enough to get started without spending a dime.

Step 1: Set Up Your Google Cloud Account

Before you can use the API, you need a Google Cloud Platform (GCP) account.

  1. Go to cloud.google.com and sign in with your Google account.
  2. Create a new project (or select an existing one).
  3. New customers get $300 in free credits to test and deploy workloads, including AI APIs.

Step 2: Enable the Natural Language API

  1. In the Google Cloud Console, navigate to APIs & Services → Library.
  2. Search for "Cloud Natural Language API" and select it.
  3. Click Enable.

Step 3: Create Your API Key

  1. Go to APIs & Services → Credentials.
  2. Click Create Credentials → API Key.
  3. Copy your new API key and store it securely.
  4. (Optional) Restrict the key to only the Natural Language API for security.

Step 4: Run Your First Entity Analysis

Method A: Using cURL (No Coding Required)

The simplest way to test the API is with a cURL command. Open your terminal and run:

curl -X POST \
  -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
  -H "Content-Type: application/json; charset=utf-8" \
  --data '{
    "encodingType": "UTF8",
    "document": {
      "type": "PLAIN_TEXT",
      "content": "ABC Plumbing provides emergency boiler repair and 24/7 pipe installation services across Manchester, Salford, and Trafford. We are Gas Safe registered and available 365 days a year."
    }
  }' \
  "https://language.googleapis.com/v2/documents:analyzeEntities"

Method B: Using Python (For Regular Use)

If you plan to analyze multiple pages regularly, Python is more efficient:

# Import the Google Cloud client library
from google.cloud import language_v1

# Initialize the client
client = language_v1.LanguageServiceClient()

# Your text content (copy a competitor's page content here)
text = """ABC Plumbing provides emergency boiler repair and 24/7 pipe 
          installation services across Manchester, Salford, and Trafford. 
          We are Gas Safe registered and available 365 days a year."""

# Create a document object
document = language_v1.Document(
    content=text,
    type_=language_v1.Document.Type.PLAIN_TEXT
)

# Call the API to analyze entities
response = client.analyze_entities(document=document)

# Print results
for entity in response.entities:
    print(f"Entity: {entity.name}")
    print(f"Type: {entity.type_.name}")
    print(f"Salience: {entity.salience:.4f}")
    print(f"Mentions: {len(entity.mentions)}")
    print("-" * 40)

# Filter for high-salience entities only (above 0.15 threshold)
high_salience = [e for e in response.entities if e.salience > 0.15]
print(f"\nHigh-salience entities found: {len(high_salience)}")

Understanding the Response

The API returns a JSON response with the following key fields:

Field What It Means Why It Matters for Local SEO
name The entity text (e.g., "Manchester") This is what Google recognizes as a distinct entity
type Entity category: PERSON, LOCATION, ORGANIZATION, etc. Tells you if Google sees your location, brand, or service as distinct entities
salience Importance score from 0.0 to 1.0 Higher salience = Google thinks this entity is central to your content
mentions How many times the entity appears Confirms entity frequency and context

Example Response for the plumbing text above:

{
  "entities": [
    {
      "name": "ABC Plumbing",
      "type": "ORGANIZATION",
      "salience": 0.4231,
      "mentions": [{"text": {"content": "ABC Plumbing"}}]
    },
    {
      "name": "Manchester",
      "type": "LOCATION",
      "salience": 0.3124,
      "mentions": [{"text": {"content": "Manchester"}}]
    },
    {
      "name": "Salford",
      "type": "LOCATION",
      "salience": 0.1876,
      "mentions": [{"text": {"content": "Salford"}}]
    },
    {
      "name": "Trafford",
      "type": "LOCATION",
      "salience": 0.1542,
      "mentions": [{"text": {"content": "Trafford"}}]
    }
  ]
}

Step 5: Analyze Your Competitors' Content

This is where the real power of the NLP API reveals itself.

The Competitor Audit Process:

  1. Identify your top 5 local competitors (the ones ranking above you in the Local Pack).
  2. Extract their content:
    • Copy their homepage text
    • Copy their main service page text
    • Copy their "About Us" page text
  3. Run each through the NLP API using the Python script above.
  4. Create a comparison table:
Entity Your Content (Salience) Competitor A (Salience) Competitor B (Salience)
Manchester 0.31 0.52 0.48
Salford 0.19 0.08 0.35
Trafford 0.15 0.42 0.12
Gas Safe 0.09 0.28 0.31
Emergency 0.22 0.41 0.38
24/7 0.18 0.33 0.29
Boiler Repair 0.27 0.19 0.44

5. Spot the gaps: Where are your competitors scoring higher salience on critical entities?

Step 6: Identify Your Entity Gaps

Based on the comparison above, you can identify three types of gaps:

Gap Type 1: Dominance Gap (Low Salience on Target Entities)

Problem: Your core entity (e.g., "Emergency Plumbing") has low salience compared to competitors.

Fix: Rewrite your introduction to establish dominance. Move your primary entity closer to the beginning of your content.

Example: Instead of starting with "We are a plumbing company," start with "Emergency plumbing services in Manchester—available 24/7, 365 days a year."

Gap Type 2: Missing Entity Gap (Entities You Don't Mention at All)

Problem: Competitors mention entities like "Trafford Centre" or "MediaCityUK" that you've completely ignored.

Fix: Organically add these missing entities to your content. Create dedicated paragraphs or service pages for these micro-locations.

Example: Add a section: "We serve businesses around the Trafford Centre and MediaCityUK with rapid response plumbing services."

Gap Type 3: Context Gap (Weak Entity Relationships)

Problem: You mention entities, but the API doesn't connect them strongly.

Fix: Use semantic triplets (Subject → Predicate → Object) to strengthen relationships.

Example: Instead of "We serve Manchester," write "[ABC Plumbing] → [provides] → [emergency services] to [Manchester] and [Salford] residents."

Step 7: Implement Your Findings

7.1 Update Your Website Content

Based on your entity gap analysis, rewrite your:

7.2 Update Your Schema Markup

Ensure your JSON-LD schema includes all the entities the API detects:

{
  "@context": "https://schema.org",
  "@type": "LocalBusiness",
  "name": "ABC Plumbing",
  "address": {
    "@type": "PostalAddress",
    "addressLocality": "Manchester",
    "addressRegion": "Greater Manchester"
  },
  "areaServed": ["Manchester", "Salford", "Trafford"],
  "openingHours": "Mo-Su 00:00-23:59",
  "memberOf": {
    "@type": "Organization",
    "name": "Gas Safe Register"
  }
}

7.3 Create New Content Targeting Missing Entities

If you discovered missing location entities, create:

Local SEO Case Study: Before and After

Before (Entity-Weak Content)

"We are a plumbing company based in the Greater Manchester area. We offer boiler repair, pipe installation, and emergency callouts. Our team is experienced and reliable."

NLP API Results:

After (Entity-Clear Content)

"ABC Plumbing provides emergency boiler repair and 24/7 pipe installation services across Manchester city centre, Salford Quays, and the Trafford Park area. We are Gas Safe registered and have served over 500 local businesses since 2015. Available 365 days a year—including weekends and bank holidays."

NLP API Results:

Result: Google's AI now clearly understands:

Common Mistakes to Avoid

FAQ

What is the Google NLP API?

The Google Cloud Natural Language API is a machine learning tool that extracts entities (people, places, organizations, concepts) from text, along with their importance scores (salience). It reveals how Google's AI "reads" your content.

Is the Google NLP API free?

New Google Cloud customers receive $300 in free credits. Additionally, the Natural Language API offers 5,000 free units per month—enough to analyze 10-20 competitor pages for free.

What is salience in the NLP API?

Salience is a score from 0.0 to 1.0 that indicates how important an entity is to the overall text. Higher salience = Google's AI thinks this entity is central to understanding your content.

How do I analyze a competitor's page with the NLP API?

Copy the text from their homepage, service pages, and About Us page. Paste it into the Python script or cURL command. Run the analysis and compare the entities and salience scores against your own content.

What entity types does the API detect?

The API detects multiple entity types including: PERSON, LOCATION, ORGANIZATION, DATE, NUMBER, ADDRESS, EVENT, WORK_OF_ART, CONSUMER_GOOD, and more.

How often should I run entity analysis?

Run a full entity audit quarterly, or whenever you: create new service pages, enter a new geographic market, notice a competitor overtaking you in the Local Pack, or update your website content significantly.

Can I use the NLP API for voice search optimization?

Yes! Voice searches are more conversational and entity-focused (e.g., "Where is the closest open vet?"). Use the API to identify the entities in your voice search target queries and optimize your content accordingly.

How does entity analysis help with Google Business Profile optimization?

Run your GBP description through the API. If key location entities (your city, neighborhoods, landmarks) have low salience, rewrite your description to strengthen those entities. Also ensure your GBP categories align with your highest-salience service entities.

Ready to Take Your Local SEO to the Next Level?

At Ranking Matters, we use advanced entity analysis, NLP API auditing, and AI-powered content strategies to help local businesses dominate their market.

Let us build a custom entity map that drives real calls and foot traffic.

WhatsApp
📊 Book Free Audit