PHP Classes

PHP IBM Watson: Call IBM Watson API services

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 271 All time: 7,713 This week: 524Up
Version License PHP version Categories
ibm-watson 1.0.0Custom (specified...5PHP 5, Web services, Artificial intel...
Description 

Author

This package can call IBM Watson API services.

It sends HTTP requests to several types of APIs of IBM Watson.

Currently it provides classes to access APIs for natural language understanding, language translation, etc..

Innovation Award
PHP Programming Innovation award nominee
May 2017
Number 7
IBM Watson is a cloud based infrastructure that provides artificial intelligence software services.

This package can call IBM Watson API to benefit from several types of their artificial intelligence services.

Manuel Lemos
Picture of MERAJ AHMAD SIDDIQUI
  Performance   Level  
Innovation award
Innovation award
Nominee: 2x

 

Example

<?php

include dirname(dirname(__DIR__)) . "/vendor/autoload.php";
//Provide jspn file to config
use IBMWatson\Config;
//json file containing url, username and password for the service
$api_credintial_json_file = dirname(dirname(__DIR__)) . "/config/language_translator.json";
$config = Config::init($api_credintial_json_file);

use
IBMWatson\Language\LanguageTranslator\Translator;
/**
 * Providing config to Translator
 * @var Translator
 */
$translator = new Translator($config);

$language_supported = $translator->getSupportedLanguage();

$language_set = [
   
"from" => "en",
   
"to" => "es",
];
$translator->setLanguage($language_set);

$text = "PHP Developer, I code to change the world's work flow";

$translated = $translator->translate($text);
//all models
$models = $translator->listModels();
//conversationa Models
$conver_models = $translator->listConversationalModels();

//Creating new model
/**
 * Creating a new model requires a glossary to used by watson
 * a tmx file (Translation Memory Echange ) by which the translation will work
 * a sample tms file is provided
 */

$glossary_tmx = "custom_model.tmx";
$new_model_details = [
   
"name" => "custom-englis-to-bhojpuri",
   
"base_model_id" => "en-es",
   
"glossary" => $glossary_tmx,
];

$new_model = $translator->createModel($new_model_details);
var_dump($new_model);


  Files folder image Files (23)  
File Role Description
Files folder imageconfig (1 file)
Files folder imageexamples (2 directories)
Files folder imagesrc (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file License.md Lic. License text
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file _config.yml Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:271
This week:0
All time:7,713
This week:524Up