-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from rosette-api/WS-3151-1.29.0-updates
Ws 3151 1.29.0 updates
- Loading branch information
Showing
12 changed files
with
329 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ These examples are scripts that can be run independently to demonstrate the Rose | |
|
||
Each example file demonstrates one of the capabilities of the Rosette Platform. Each example, when run, prints its output to the console. | ||
|
||
Here are some methods for running the examples. Each example will also accept an optional `--url` parameter for | ||
Here are some methods for running the examples. Each example will also accept an optional `--url=` parameter for | ||
overriding the default URL. | ||
|
||
Also, the examples are dual purpose in that they're used to test both source and packagist. The instructions include steps to address this depending on what you are testing. | ||
|
@@ -15,7 +15,7 @@ A note on prerequisites. Rosette API only supports TLS 1.2 so ensure your toolc | |
``` | ||
git clone [email protected]:rosette-api/php.git | ||
cd php | ||
docker run -it -v $(pwd):/source --entrypoint bash php:7.3-cli | ||
docker run -it -v $(pwd):/source --entrypoint bash php:8.2-cli | ||
apt-get update | ||
apt-get install -y git zip | ||
|
@@ -37,7 +37,7 @@ php ping.php --key $API_KEY | |
``` | ||
git clone [email protected]:rosette-api/php.git | ||
cd php | ||
docker run -it -v $(pwd):/source --entrypoint bash php:7.3-cli | ||
docker run -it -v $(pwd):/source --entrypoint bash php:8.2-cli | ||
apt-get update | ||
apt-get install -y git zip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
/** | ||
* Example code to call Rosette API to get events from a piece of text. | ||
**/ | ||
require_once dirname(__FILE__) . '/../vendor/autoload.php'; | ||
use rosette\api\Api; | ||
use rosette\api\DocumentParameters; | ||
use rosette\api\RosetteException; | ||
|
||
$options = getopt('', array('key:', 'url::')); | ||
if (!isset($options['key'])) { | ||
echo 'Usage: php ' . __FILE__ . " --key <api_key> --url=<alternate_url>\n"; | ||
exit(); | ||
} | ||
|
||
$events_text_data = "Alice has a flight to Budapest. She has not booked a hotel."; | ||
$api = isset($options['url']) ? new Api($options['key'], $options['url']) : new Api($options['key']); | ||
$params = new DocumentParameters(); | ||
$content = $events_text_data; | ||
$params->set('content', $content); | ||
|
||
try { | ||
$result = $api->events($params); | ||
var_dump($result); | ||
} catch (RosetteException $e) { | ||
error_log($e); | ||
} | ||
|
||
$api->setOption('negation', 'BOTH'); | ||
try { | ||
$result = $api->events($params); | ||
var_dump($result); | ||
} catch (RosetteException $e) { | ||
error_log($e); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
/** | ||
* Example code to call Rosette API to compare two lists of records and return a similarity score for each pair of records | ||
**/ | ||
require_once dirname(__FILE__) . '/../vendor/autoload.php'; | ||
use rosette\api\Api; | ||
use rosette\api\RecordSimilarityParameters; | ||
use rosette\api\RosetteException; | ||
|
||
$options = getopt('', array('key:', 'url::')); | ||
if (!isset($options['key'])) { | ||
echo 'Usage: php ' . __FILE__ . " --key <api_key> --url=<alternate_url>\n"; | ||
exit(); | ||
} | ||
|
||
$fields = array( | ||
"primaryName" => array("type" => "rni_name", "weight" => 0.5), | ||
"dob" => array("type" => "rni_date", "weight" => 0.2), | ||
"addr" => array("type" => "rni_address", "weight" => 0.5), | ||
"dob2" => array("type" => "rni_date", "weight" => 0.1) | ||
); | ||
|
||
$properties = array( | ||
"threshold" => 0.7, | ||
"includeExplainInfo" => true, | ||
); | ||
|
||
$records = array( | ||
"left" => array( | ||
array( | ||
"primaryName" => array("text" => "Ethan R", "language" => "eng", "script" => "Latn", "entityType" => "PERSON", "languageOfOrigin" => "eng"), | ||
"dob" => "1993-04-16", | ||
"addr" => "123 Roadlane Ave", | ||
"dob2" => array("date" => "1993/04/16") | ||
), | ||
array( | ||
"dob" => array("date" => "1993-04-16"), | ||
"primaryName" => array("text" => "Evan R") | ||
) | ||
), | ||
"right" => array( | ||
array( | ||
"dob" => array("date" => "1993-04-16"), | ||
"primaryName" => array("text" => "Seth R", "language" => "eng"), | ||
), | ||
array( | ||
"dob" => array("date" => "1993-04-16"), | ||
"primaryName" => "Ivan R", | ||
"addr" => array("address" => "123 Roadlane Ave"), | ||
"dob2" => array("date" => "1993/04/16") | ||
) | ||
|
||
) | ||
); | ||
|
||
$api = isset($options['url']) ? new Api($options['key'], $options['url']) : new Api($options['key']); | ||
$params = new RecordSimilarityParameters($fields, $properties, $records); | ||
|
||
try { | ||
$result = $api->recordSimilarity($params); | ||
var_dump($result); | ||
} catch (RosetteException $e) { | ||
error_log($e); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.