Linkgua Semantic API

post/v1/annotate

Annotate bring to publishers a simple service or a API for extract valuable keywords in any text. The Embed API provides you with a tool to grow by adding media to your site. Give your user the content they are looking for. Use the Embed API to lean what your audience is viewing, sharing and interacting online.

Get your key and start coding now! It's Free!


Definition

https://api.linkgua.com /v1/annotate

Parameters

html_fragment:
String/HTML

String or HTML to analyze. (Must be less than 3000 characters.)

lang:
String optional

The language of the text has been annotated; currently English, Spanish, French, German, Italian and Portuguese and and are supported.

Allowed values: en|es|fr|de|it|pt

confidence:
Float optional

Confidence threshold: the entities with a confidence value below this threshold will not be considered. Confidence is an estimate of the annotation quality, within a range between 0 and 1. A higher threshold will give fewer but more precise entries. A low threshold value will give you more confidence but less precise and more margin of error.

Default value: 0.4

Allowed values: 0.0..1.0

document_id:
String optional

Client Document ID. This parameter make possible track entities on any specific document and give the possibility to recommend clients documents based entities.

document_url:
String optional

Document url in client. This parameters make possible track the entities for this documents and give the possibility to recommend clients documents based entities.

document_title:
String optional

Document Title. Must exist "document_id" or "document_url" for take in account. This parameters make possible track the entities for this documents and give the possibility to recommend clients documents based entities.

document_author:
String optional

Document Author. Must exist "document_id" or "document_url" for take in account.

document_lang:
String optional

Document Language. Must exist "document_id" or "document_url" for take in account.

document_abstract:
String optional

Document abstract. Must exist "document_id" or "document_url" for take in account.

document_categories:
String optional

Document categories. This parameter is comma separated list. [ex. "business, politic"]. Must exist "document_id" or "document_url" for take in account.

document_genres:
String optional

Document genres. This parameter is comma separated list. [ex. "Fiction, History Fiction"]. Must exist "document_id" or "document_url" for take in account.

document_types:
String optional

Document types. This parameter is comma separated list. [ex. "Book, Novel"]. Must exist "document_id" or "document_url" for take in account.

KEY:
String

Your API Key

TOKEN:
String

Your API Token


Examples

                        
    var params = {
        /* Could be String or Html */
        html_fragment : "<p>Hollywood: Gaga to honor David Bowie at Grammys.</p>",
        KEY : ':yourKey',
        TOKEN:':yourToken'
    };

    $.post( "https://api.linkgua.com/v1/annotate",params, function( response ) {
        //print the complete response in console.
        console.log(JSON.stringify(response));
    });

                        
                    
                        
    curl 'https://api.linkgua.com/v1/annotate' \
    --data-urlencode 'html_fragment=Hollywood: Gaga to honor David Bowie at Grammys.' \
    --data 'KEY=:yourkey' \
    --data 'TOKEN=:yourToken'
                        
                    
                        
    import requests

    # Create the query
    params = {
        "html_fragment": '<p>Hollywood: Gaga to honor David Bowie at Grammys.</p>',
        "KEY": ":yourKey"
        "TOKEN": ":yourToken"
    }

    # Make the call.
    r = requests.post('https://api.linkgua.com/v1/annotate', params=params)

    # print the json result.
    print r.json()
                        
                    
                    
    $params = array(
        'html_fragment' => "<p>Hollywood: Gaga to honor David Bowie at Grammys.</p>",
        'KEY' => :yourkey,
        'TOKEN' => :yourToken
    );

    $handle = curl_init("https://api.linkgua.com/api/v1/annotate");
    curl_setopt($handle, CURLOPT_POST, true);
    curl_setopt($handle, CURLOPT_POSTFIELDS, http_build_query($params));
    $output = curl_exec($handle);
    curl_close($handle);

    //show the complete response.
    var_dump($output);


                    
                

Result Format

                        
    HTTP/1.1 200 OK
    {
        status: "Petition Status [success/error]",
        data: {
            timestamp: "Date and time of the response generation process",
            time: "Time elapsed for generating the response (milliseconds)",
            lang: "The language used to tag the input text",
            wikifiedDocument: "The Original text with all the annotation transformed in links.",
            annotations : [
                {
                    id: "ID of the linked Wikipedia resource. (Entity Id is used for call the entity endpoint api)",
                    mid: "ID of the linked Freebase resource",
                    title: "Title of the linked Wikipedia resource",
                    uri: "URL of the entity on Wikipedia",
                    label: "Most common name used to represent the resource",
                    confidence: "Value of confidence for this annotation",
                    spot: "Annotated string, as it is in the input text",
                    start: "Character position in the input text where the annotation begins",
                    end: "Character position in the input text where the annotation ends",
                    types: [
                        "List of types of the linked DBpedia resource"
                    ],
                    categories: [
                        "List of the category of the linked DBpedia resource"
                    ],
                    abstract: "Abstract of the linked Wikipedia resource",
                    lod: {
                        wikipedia: "URL of the Wikipedia article that represents the resource",
                        dbpedia: "URI of the resource on DBpedia"
                        freebase: "URI of the resource on Freebase"
                    },
                    alternateLabels: [
                        "List of other names used when referring to the entity"
                    ],
                    image: {
                        full: "URL of a depiction of the resource on Wikipedia.",
                        thumbnail: "URL of the thumbnail of the depiction.",
                    }
                },
                {...}
            ]
        }
    }
                        
                    

See a real response online

html_fragment = "Hollywood: Gaga to honor David Bowie at Grammys."

View JSON Response


Documentation

Annotate bring a simple API for extract valuable keywords in any text.

Want to Try out the Annotate API?

Try out our handy Annotate API Explorer. It's awesome and will allow you to preview the response with any text.

Go to the Annotate API Demo

Get your key and start coding. It's Free!