giulioprinaricotti/dandelion-php

dev-master 2018-02-18 22:11 UTC

This package is auto-updated.

Last update: 2024-09-29 05:01:21 UTC


README

非官方的Dandelion Swagger API定义

此PHP包由Swagger Codegen项目自动生成

  • API版本:0.0.1
  • 构建包:io.swagger.codegen.languages.PhpClientCodegen

要求

PHP 5.4.0 及以上

安装与使用

Composer

要使用Composer安装绑定,请在composer.json中添加以下内容

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/giulioprinaricotti/dandelion-php.git"
    }
  ],
  "require": {
    "giulioprinaricotti/dandelion-php": "*@dev"
  }
}

然后运行 composer install

手动安装

下载文件并包含 autoload.php

    require_once('/path/to/dandelion-php/autoload.php');

测试

要运行单元测试

composer install
./vendor/bin/phpunit

入门

请按照安装过程进行,然后运行以下命令

<?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;
}

?>

API端点文档

所有URI相对于 https://api.dandelion.eu/datatxt

模型文档

授权文档

api_key

  • 类型:API密钥
  • API密钥参数名:token
  • 位置:URL查询字符串

作者

g.prinaricotti@gmail.com