How to search articles by entity
Find articles mentioning specific people, organizations, locations, or other named entities
Overview
Empowered by Named Entity Recognition (NER), News API v3 lets you find articles mentioning specific people, organizations, locations, or other named entities. With NER, you can perform more precise and relevant searches than with simple keyword queries.
Before you start
Before you begin, ensure you have:
- An active API key for NewsCatcher News API v3
- NLP functionality enabled in your subscription plan
- Basic knowledge of making API requests
- Python or another tool for making HTTP requests (e.g., cURL, Postman, or a programming language with HTTP capabilities)
Steps
Understand entity types and search syntax
News API v3 supports four main entity types that reflect the following query parameters:
PER_entity_name
: Person namesORG_entity_name
: Organization namesLOC_entity_name
: Location namesMISC_entity_name
: Miscellaneous names (products, events, nationalities, etc.)
Construct your query using entities
Let’s start with a simple entity search for a tech company:
This query searches for articles about the tech industry that mention OpenAI as an organization.
You can expand your search to include multiple entities:
Include NLP data in the API response
To include entity information in the API response, use the include_nlp_data
parameter:
To learn more about NLP capabilities in News API v3, see NLP features.
Make an API request with your entity query
Here’s a Python example demonstrating a search request using named entities:
Analyze the results
The API returns a JSON response. Here’s a simplified example focusing on entity-related fields:
Refine your entity search
Use the COUNT functionality to filter based on entity mention frequency:
Use different entity types together:
Combine entity search with boolean operators for more complex queries:
Use the NEAR operator to find articles where terms are mentioned in proximity to each other and combine with entity search:
Always use backslashes \
before double quotes within query strings to
maintain exact match syntax in JSON.
See also
Was this page helpful?