giulioprinaricotti / dandelion-php
dev-master
2018-02-18 22:11 UTC
Requires
- php: >=5.4
- ext-curl: *
- ext-json: *
- ext-mbstring: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ~1.12
- phpunit/phpunit: ~4.8
- satooshi/php-coveralls: ~1.0
- squizlabs/php_codesniffer: ~2.6
This package is auto-updated.
Last update: 2025-01-29 06:01:35 UTC
README
Unofficial Dandelion Swagger API definition
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 0.0.1
- Build package: io.swagger.codegen.languages.PhpClientCodegen
Requirements
PHP 5.4.0 and later
Installation & Usage
Composer
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/giulioprinaricotti/dandelion-php.git"
}
],
"require": {
"giulioprinaricotti/dandelion-php": "*@dev"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php
:
require_once('/path/to/dandelion-php/autoload.php');
Tests
To run the unit tests:
composer install
./vendor/bin/phpunit
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api_key DandelionPHP\Configuration::getDefaultConfiguration()->setApiKey('token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // DandelionPHP\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); $api_instance = new DandelionPHP\Api\DefaultApi(); $text = "text_example"; // string | use \"text\" when you have plain text that doesn't need any pre-processing $include = "include_example"; // string | Returns more information on annotated entities: \"types\" adds type information from DBpedia or dandelion. DBpedia types are extracted based on the lang parameter (e.g. if lang=en, types are extracted from DBpedia english). Please notice that different DBpedia instances may contain different types for the same resource; \"categories\" adds category information from DBpedia/Wikipedia; \"abstract\" adds the text of the Wikipedia abstract; \"image\" adds a link to an image depicting the tagged entity, as well as a link to the image thumbnail, served by Wikipedia. Please check the licensing terms of each image on Wikipedia before using it in your app; \"lod\" adds links to equivalent (sameAs) entities in Linked Open Data repositories or other websites. It currently only supports DBpedia and Wikipedia; \"alternate_labels\" adds some other names used when referring to the entity. $lang = "lang_example"; // string | The language of the text to be annotated; currently English, French, German, Italian and Portuguese are supported. Leave this parameter out to let the Entity Extraction API automatically detect the language for you. $country = "country_example"; // string | This parameter specifies the country which we assume VAT and telephone numbers to be coming from. This is important to get correct results, as different countries may adopt different formats. $top_entities = 56; // int | The number of most important entities that must be included in the response. try { $result = $api_instance->getEntitiesFromText($text, $include, $lang, $country, $top_entities); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->getEntitiesFromText: ', $e->getMessage(), PHP_EOL; } ?>
Documentation for API Endpoints
All URIs are relative to https://api.dandelion.eu/datatxt
Documentation For Models
- ApiResponseError
- EntityExtractionResponse
- EntityExtractionResponseAnnotation
- EntityExtractionResponseAnnotationLod
- EntityExtractionResponseTopEntity
Documentation For Authorization
api_key
- Type: API key
- API key parameter name: token
- Location: URL query string