tagging-basic
- cURL
- cURL (Windows)
- JavaScript
- Python
- Python SDK
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."
}'
curl -X POST -H "X-API-KEY: <YOUR_API_KEY>" -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.\"
}"
const analyze = async (config, input) => {
const response = await axios.post('nlp/analyze', input, config);
return response.data;
};
const input = {
id: '1234',
title: 'Emmanuel Macron in Germany.',
text: 'Mr. Macron visited a trade show in Munich.'
}
analyze(config, input).then(report);
def analyze(input):
return requests.post(f'{BASE_URL}nlp/analyze', json=input, headers=HEADERS).json()
input = {
'id': '1234',
'title': 'Emmanuel Macron in Germany.',
'text': 'Mr. Macron visited a trade show in Munich.'
}
analyze(input)
requestBuilder = g3.Request.Builder()
with g3.Client.create(url=f'{BASE_URL}nlp/analyze') as analyzer:
analyzer.session.headers.update({'X-API-Key': API_KEY})
request = requestBuilder.build(id=str('1234'), title='Emmanuel Macron in Germany.', text='Mr. Macron visited a trade show in Munich.')
result = analyzer.analyze(request)
print("Entities:") ## there will be no entities, unless they are specified in your plan and configuration
for e in result.entities:
print(f' {e.type}: {e.stdForm} ({e.gkbId}) relevance: {e.feats.get("relevance")}, derivedBy: {e.feats.get("derivedBy", "N/A")}, derivedOnly: {e.feats.get("derivedOnly", "false")}'))
print("Tags:")
for t in result.tags:
print(f'\t{t.type}: {t.stdForm} ({t.gkbId}) relevance: {t.relevance}')