2017 © Pedro Peláez
 

library wes-php-client

PHP Client for Wikidata Entity Suggester

image

wes-php-client/wes-php-client

PHP Client for Wikidata Entity Suggester

  • Tuesday, May 21, 2013
  • by Nilesh
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Wikidata Entity Suggester PHP Client

This is the PHP client for the Wikidata Entity Suggester. It uses the Entity Suggester's REST API to push data and get suggestions., (*1)

Installation via Composer

The best way to use the library is via Composer., (*2)

After you install composer, run in console:, (*3)

cd your/working/directory
composer require guzzle/guzzle
composer require wes-php-client/wes-php-client

Type 'dev-master' for both, when prompted for the version., (*4)

OR, (*5)

You can manually add the library to your dependencies in the composer.json file:, (*6)

{
    "require": {
        "wes-php-client/wes-php-client": "dev-master"
    }
}

and install your dependencies:, (*7)

composer install

Usage

``` php // Always include this file to use the client require_once("vendor/autoload.php");, (*8)

// Instanciate the Myrrix/Entity Suggester service $wes = new EntitySuggesterService('localhost', 8080);, (*9)

// Push the data in the file /path/data.csv into the Entity Suggester. // Please check this page for info on how the data should be structured in the CSV file. $wes->ingestFile("/path/data.csv");, (*10)

// Refresh the index (add newly added data into the model) $wes->refresh();, (*11)

// Get value recommendations for a new item $recommendation = $myrrix->getRecommendation(array( "107----4167410", "106", "107----215627", "156" ), "value"); // returns an array of property-value pairs and strengths (example: [["107----4167410",0.53],["373----Huntsville Alabama",0.499]]), (*12)

// Get property recommendations for a new item $recommendation = $myrrix->getRecommendation(array( "107----4167410", "106", "107----215627", "156" ), "property"); // returns an array of properties and strengths (example: [["25",0.53],["156",0.499]]), (*13)

// Specify the number of recommendations (optional) $recommendation = $myrrix->getRecommendation(array( "107----4167410", "106", "107----215627", "156" ), "property", 20); // returns an array of 20 properties with strengths (example: [["25",0.53],["156",0.499]]), (*14)

```, (*15)

See wesTest.php for a crude example/demo. It is temporarily deployed here., (*16)

The Versions

21/05 2013

dev-master

9999999-dev https://github.com/nilesh-c/wes-php-client

PHP Client for Wikidata Entity Suggester

  Sources   Download

MIT

The Requires

 

wikidata recommendation myrrix entity-suggester