Calais PHP and JSON Demos
This PHP code (server and client) demonstrates how to use Calais with PHP. We offer both the raw representation of the Internet browser and a document viewer representation highlighting all the entities in the text. Download the attached file, which contains documentation as well as source files.
To enable your PHP demo in Safari and Firefox, see this posting from Pete Warden.
The example of a JSON wrapper – code that runs on the server and converts the RDF into JSON format - is also presented. We will be releasing (soon) a much simpler JSON wrapper (based on RDF) and another format is based in Simple Output Format, as well as a Java application controlling the Calais Web Service.
Stay tuned.
To incorporate Calais relevance capability, use the following JSON code. (Provided by http://prima.appspot.com/).
CalaisJSONIf.php
foreach ($element_atts as $name => $value)
{
if ($name == "count")
{
$new_element["repeat"] = (integer)$value;
}
if ($name == "relevance")
{
$new_element["relevance"] = (float)$value;
}
| Attachment | Size |
|---|---|
| opencalais_php_demo.tar_.gz | 5.22 MB |
| opencalais_php_demo.zip | 3.97 MB |
