Relations

We distinguish three types of relations:

  • attribute relations: For example, good in a good pizza or the pizza is good is an attribute of pizza.

  • verbal relations: For example, eat in John ate a pizza is a relation between John and pizza.

  • parent relations: For example, beer is an alcoholic drink, which in turn is a drink (Only some accounts have access to this feature, in general it requires access to GKB.)

See the Relation object reference page for more information.

Sample call

You can easily try it yourself:

curl -X POST https://api.geneea.com/v3/analysis \
-H 'Authorization: user_key <YOUR USER KEY>' \
-H 'Content-Type: application/json' \
-d '{
    "id": "1",
    "text": "The trip to London was great. Only the food was weird. Especially the pizza was terrible.",
    "analyses": ["tags"],
    "domain": "voc-hospitality"
}'

# On Windows, use \" instead of " and " instead of '
def callGeneea(input):
    url = 'https://api.geneea.com/v3/analysis'
    headers = {
        'content-type': 'application/json',
        'Authorization': 'user_key <your user key>'
    }

    return requests.post(url, json=input, headers=headers).json()

responseObj = callGeneea({
    'id': '1',
    'text': 'The trip to London was great. Only the food was weird. Especially the pizza was terrible.',
    'analyses': ['tags'],
    'domain': 'voc-hospitality'
)

print(responseObj)

You should get the following response:

{
    "id": "1",
    "language": {"detected": "en"},
    "entities": [
        {"id": "E0", "gkbId": "HSP-1091", "stdForm": "pizza", "type": "food"}
    ],
    "relations": [
        {"id": "R0", "name": "amazing", "textRepr": "amazing(trip)", "type": "ATTR", "args": [{"type": "SUBJECT", "name": "trip"}], "feats": {"negated": "false", "modality": ""}},
        {"id": "R1", "name": "weird", "textRepr": "weird(food)", "type": "ATTR", "args": [{"type": "SUBJECT", "name": "food"}], "feats": {"negated": "false", "modality": ""}},
        {"id": "R2", "name": "terrible", "textRepr": "terrible(pizza)", "type": "ATTR", "args": [{"type": "SUBJECT", "name": "pizza", "entityId": "E0"}], "feats": {"negated": "false", "modality": ""}}
    ],
    "usedChars": 100
}

Since relations might refer to entities, the entities are automatically returned in the response XS well.