Skip to content

Keyphrase extraction output

The relevants resource that performs keyphrase extraction returns a JSON object with this structure:

{
    "success": Boolean success flag,
    "data": {
        "content": analyzed text,
        "language": language code,
        "version": technology version info,      
        "knowledge": [],
        "topics": [],
        "mainSentences": [],
        "mainPhrases": [],
        "mainSyncons": [],
        "mainLemmas": []
    }
}

For the description of the contents, language and version properties see the API resources output overview.

Common properties

Items that can be directly mapped to the text have properties indicating their position.
Items that occur only once, such as a main sentence, have the start and end properties while items that can occur multiple times, such as a main lemma, have an array with the positions of all the occurrences.

Items also have a score property which provides a measure of their relevance.

topics

The topics array contains references to Knowledge Graph topics pertinent with the text.
Each array item corresponds to a topic, for example:

{
    "id": 223,
    "label": "mechanics",
    "score": 3.5,
    "winner": true
}

Possible topics are listed in the reference section.
id is the identification number, winner is a Boolean flag set to true if the topic is considered particularly relevant.

mainSentences

The mainSentences array contains info about relevant sentences.
Each array item represents a sentence, for example:

{
    "value": "The machine is held until ready to start by a sort of trap to be sprung when all is ready; then with a tremendous flapping and snapping of the four-cylinder engine, the huge machine springs aloft.",
    "score": 13.3,
    "start": 740,
    "end": 936
}

mainPhrases

The mainPhrases array contains info about the phrases deemed particularly representative during the analysis.
Each array item represents a phrase, for example:

{
    "value": "four-cylinder engine",
    "score": 8,
    "positions": [
        {
            "start": 883,
            "end": 903
        }
    ]
}

positions is an array of positions (because a relevant phrase can occur more than once in a text).

mainSyncons

The mainSyncons array contains references to Knowledge Graph syncons corresponding to the concepts that were considered relevant.
Each array item represents a syncon, for example:

{
    "positions": [
        {
            "end": 19,
            "start": 11
        }
    ],
    "score": 35.59,
    "syncon": 45740
}

The key property is syncon. The syncon value is a pointer to the knowledge array entry that has its syncon property set to the same value.

mainLemmas

The mainLemmas array contains relevant lemmas.
Each array item represents a lemma, for example:

{
    "value": "locomotive",
    "score": 6.5,
    "positions": [
        {
            "start": 1152,
            "end": 1162
        },
        {
            "start": 1163,
            "end": 1167
        },
        {
            "start": 1239,
            "end": 1249
        },
        {
            "start": 1335,
            "end": 1345
        },
        {
            "start": 1394,
            "end": 1404
        }
    ]
}

knowledge

The knowledge array contains Knowledge Graph data for the mainSyncons array entries.

The link between the maiySyncons array entry and the corresponding entry in this array is represented by thesyncon property value both objects have in common, for example:

mainSyncons entry:

{
    "positions": [
        {
            "end": 53,
            "start": 35
        }
    ],
    "score": 9.19,
    "syncon": 41583
}

Corresponding entry in the knowledge array:

{
    "label": "person.athlete.basketball_player",
    "properties": [
        {
            "type": "WikiDataId",
            "value": "Q3665646"
        }
    ],
    "syncon": 41583
}

Each entry in the array has a format like this:

{
    "label": "person",
    "properties": [
        {
            "type": "WikiDataId",
            "value": "Q215627"
        }
    ],
    "syncon": 73282
}

The label property is a textual rendering of the general conceptual category for the syncon in the Knowledge Graph.

The properties array contains the outcome of Knowledge linking. Each item has two properties, type and value. type specifies the knowledge base, value is the property value. Possible knowledge bases and interpretation of the value property follow.

type value
Coordinate Latitude and longitude
WikiDataId Wikipedia article ID
DBpediaId URL of the DBPedia content
GeoNamesId ID of the record in the GeoNames database