Skip to main content

Quick Start – Semantic Tagging

This quick start shows how to use the Media API to perform semantic tagging of articles. For a more in-depth explanation, see this guide article.

First Steps

To use the API, you'll need a valid API key with appropriate authorization. If you don't have one yet, contact us here.

While we don't provide SDKs specifically for the Media API, you can use our G3 SDKs for content analysis with (the https://media-api.geneea.com/v2/nlp/analyze endpoint). This includes semantic tagging.

We'll begin by defining some shared setup (replace <YOUR_API_KEY> with your actual API key):

# No special setup necessary

Basic Analysis

To perform a basic analysis of a document—retrieving tags (keywords), entities, relations, and sentiment—use the following code:

curl -X POST -H 'X-API-KEY: <YOUR_API_KEY>' -H 'accept: */*' -H 'content-type: application/json' 'https://media-api.geneea.com/v2/nlp/analyze' -d '{
"id": "1234",
"title": "Emmanuel Macron in Germany.",
"text": "Mr. Macron visited a trade show in Munich."
}'

The above code produces the following result. For a detailed explanation of the fields, see the Analysis reference page.

Note:

  1. The relations field is omitted here for simplicity.
  2. The exact set of returned features depends on your account plan.

Typical:

{
"version": "3.2.1",
"id": "1234",
"language": { "detected": "en" },
"tags": [
{ "id": "t0", "gkbId": "G3052772", "stdForm": "Emmanuel Macron", "type": "media", "relevance": 22.605, "feats": { "wikidataId": "Q3052772" } },
{ "id": "t1", "gkbId": "G183", "stdForm": "Germany", "type": "media", "relevance": 18.365, "feats": { "wikidataId": "Q183" } },
{ "id": "t2", "gkbId": "G1726", "stdForm": "Munich", "type": "media", "relevance": 7.57, "feats": { "wikidataId": "Q1726" } }
],
"usedChars": 100,
"metadata": {"referenceKey": "311441-120020-a24f0281"}
}

Full:

{
"version": "3.2.1",
"id": "1234",
"language": { "detected": "en" },
"entities": [
{ "id": "e0", "gkbId": "G57305", "stdForm": "trade fair", "type": "general" },
{ "id": "e1", "gkbId": "G183", "stdForm": "Germany", "type": "location" },
{ "id": "e2", "gkbId": "G1726", "stdForm": "Munich", "type": "location" },
{ "id": "e3", "gkbId": "G3052772", "stdForm": "Emmanuel Macron", "type": "person" },
{ "id": "e4", "gkbId": "G183", "stdForm": "Germany", "type": "country", "feats": {"derivedBy": "gkb2:[gkbp:adminCountry]" } },
{ "id": "e5", "gkbId": "G980", "stdForm": "Bavaria", "type": "region", "feats": { "derivedBy": "gkb2:[gkbp:region]" } }
],
"tags": [
{ "id": "t0", "gkbId": "G3052772", "stdForm": "Emmanuel Macron", "type": "media", "relevance": 22.605, "feats": { "wikidataId": "Q3052772" } },
{ "id": "t1", "gkbId": "G183", "stdForm": "Germany", "type": "media", "relevance": 18.365, "feats": { "wikidataId": "Q183" } },
{ "id": "t2", "gkbId": "G1726", "stdForm": "Munich", "type": "media", "relevance": 7.57, "feats": { "wikidataId": "Q1726" } }
],
"relations": [..],
"docSentiment": { "mean": 0.0, "label": "neutral", "positive": 0.0, "negative": 0.0 },
"usedChars": 100,
"metadata": {"referenceKey": "311441-120020-a24f0281"}
}

Next Steps

For more advanced uses of the tagging API, see this guide article. The full guide also covers additional topics such as:

  • photo suggestions
  • feedback loop
  • knowledge base
  • and more.