2017 © Pedro PelĆ”ez
 

library semtools

A tool for classifying and enriching English language text based on publicly available semantic API services.

image

nv/semtools

A tool for classifying and enriching English language text based on publicly available semantic API services.

  • Friday, November 14, 2014
  • by strackovski
  • Repository
  • 1 Watchers
  • 1 Stars
  • 40 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Provides read access wrappers to public semantic API services. Version 0.0.4 supports classification using the uClassify.com service and annotation (enrichment) using Reuters OpenCalais API., (*1)

Visit OpenCalais and uClassify homepages for more information about their services and to obtain an API key., (*2)

Features

  • uClassify API reader enables use of all available public classifiers.
  • OpenCalais API reader enables use of the powerful enrichment service from Reuters.

How-to & Examples

Below is a basic example, also available in examples/index.php file. For detailed options, please see the API documentation., (*3)

Classification

use nv\semtools\Classifiers\uClassify;

header('Content-type: text/xml');

// Instantiate the reader with your API key (provided by uClassify)
$classifier = new uClassify\UclassifyReader('YOUR_API_KEY');

// Create a new request with the text to be classified and the classifier to use
$classifierRequest = new uClassify\UclassifyRequest(
    'My happy text',
    'prfekt/Myers Briggs Attitude'
);

// Execute and return the request
$classifierResponse = $classifier->read($classifierRequest);
echo $classifierResponse->getResponse();

Prints:, (*4)

<?xml version="1.0" encoding="UTF-8" ?>
<uclassify xmlns="http://api.uclassify.com/1/ResponseSchema" version="1.01">
    <status success="true" statusCode="2000"/>
    <readCalls>
    <classify id="cls1">
        <classification textCoverage="1">
            <class className="Extraversion" p="0.99998"/>
            <class className="Introversion" p="2.0456e-005"/>
        </classification>
    </classify>
    </readCalls>
</uclassify>

Annotation

use nv\semtools\Annotators\OpenCalais;

// The content to process
$content = '';
// Instantiate a new annotator instance with your API key (provided by OpenCalais)
$annotator = new OpenCalais\OpenCalaisReader('YOUR_API_KEY');

// Create a new request with passing the content as parameter
$annotatorRequest = new OpenCalais\OpenCalaisRequest($content);

// Execute request, recieve response
$annotatorResponse = $annotator->read($annotatorRequest);

// To get the raw response
$annotatorResponse->getResponse();

// To get the response parsed to php array
print_r($annotatorResponse->getEntities());

Prints:, (*5)

...

Check out OpenCalais homepage for details on different response formats., (*6)

License

Copyright 2014 Vladimir Stračkovski. MIT license. For more information please see the license file included in this project., (*7)

The Versions

14/11 2014

dev-master

9999999-dev http://www.nv3.org/semtools

A tool for classifying and enriching English language text based on publicly available semantic API services.

  Sources   Download

MIT

The Requires

 

The Development Requires

14/11 2014

dev-develop

dev-develop http://www.nv3.org/semtools

A tool for classifying and enriching English language text based on publicly available semantic API services.

  Sources   Download

MIT

The Requires

 

The Development Requires

13/08 2014

0.0.4

0.0.4.0 http://www.nv3.org/semtools

A tool for classifying and enriching English language text based on publicly available semantic API services.

  Sources   Download

MIT

The Requires

 

The Development Requires