Skip to content

Commit 64625d9

Browse files
committed
Merge branch 'develop'
2 parents ba5aace + 6b7634b commit 64625d9

19 files changed

+592
-241
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
.Trashes
77
ehthumbs.db
88
Thumbs.db
9+
*.swp
910

1011
# Jetbrains
1112
**/.idea/*

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
language: php
22
before_install:
33
php:
4-
- 5.5
54
- 5.6
65
- 7.0
6+
- 7.1
7+
- 7.2
8+
- 7.3
79
before_script:
810
- composer self-update
9-
- composer install --prefer-source --no-interaction --dev
11+
- composer install --prefer-source --no-interaction
1012
script:
1113
- bin/phpspec run --config=phpspec.yml --bootstrap=./vendor/autoload.php --no-interaction --format=pretty
1214

1315
notifications:
1416
slack:
1517
rooms:
1618
- secure: 4FRaTAAiYyeUvgw2RhmblgbNiJO4wmd34OBgWcwURjP9oVmFfSwR9r1LNCdUGxrPOghexSY2DjXIuvIrfTfi/xYbhHb3Kw7PEAyB8IuBMlKtY4NSFou62S2VhYpxyg58T+C7P2zi0eDnDE06pwTCoGPaimxMZQY91yQ0yPYDPVXbwe5SjEgamzlwGBxlS/0A6w1iCPHg27/iO2hXtdW3oLS2I0F/Q8Q95RBkX9hpg6yqHlTV7jRbSqvQ9OFBqk/tXMHQvhoPDGgCgQDuykJuaAYx7g9d0YL0eEYYOh9B/TJ/kNOwdRFBu5kuQ2/nFS5Z0S3Y3UIhdYjUmm9gSMnwIbYnrW22EqDJLoT9Zi3Gv7Prg/8/fSkWsof7BJTMSuXUqO1AxDGKIxFv9uSF1daZoY+AC1ooU1xDu1nNvWVYPlkwEdDxxmHpFkGT3ESTZYccPovQl8Z5K0I1BBAVdJKDzm07lE6VHbxkKcvK6gG0TN3uLxnSlQtjkfJ+aVMq1kxeVsB9lEsKs9oezsKzzbftMm525aXPg+OAv+31CUFWxvT/p4ps8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FTdjL68z+srjDPYMSoOcFXXFNP+dmL+Q0veL/E4e40e7CWIU1O3grOcEcCkaSoZVSpGduNnCst8h6MpgauPtrgwHk4zGMoSl+L6al+nFo/3h2dXeebrQ0tY/hRfZi4Q8xwqG9083TBqi71fTpoFZ7sNtrY4Kdtl5Oa2CFUo7lVn1JB9qQwSa0eai3Whv0RyRqqQe77aDUj0dfD2R3Q61rX5OF/f++W0XtNwHQubzmj8HD/cFneShIQsbl9KgYXoR6HiXcbBiNdmmZjSrzkPYh7vlsujYrz6Cg2msKybWJ/FfOz0tS1cjlCtiCMOTExN6tEF8YCp9l+s+5RLe61pgFPy4Snr9pEjuTS5DYliTyZMY2ZZC1clBQtgE8E2qCG1QSzqnqqiGxj2K4zmLPpB4y1XpW8e3yk=
1919
on_success: always
2020
on_failure: always

DEVELOPER.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TBD

README.md

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,39 @@
1-
[![Build Status](https://travis-ci.org/rosette-api/php.svg?branch=develop)](https://travis-ci.org/rosette-api/php)
1+
<a href="https://www.rosette.com"><img src="https://s3.amazonaws.com/styleguide.basistech.com/logos/rosette-logo.png" width="181" height="47" /></a>
22

3-
# PHP client binding for Rosette API #
4-
See the wiki for more information.
3+
---
54

6-
## Installation ##
7-
`composer require "rosette/api"`
5+
[![Build Status](https://travis-ci.org/rosette-api/php.svg?branch=develop)](https://travis-ci.org/rosette-api/php) ![](https://img.shields.io/packagist/v/rosette/api.svg?colorB=bright%20green&style=flat)
6+
7+
## Rosette API
8+
The Rosette Text Analytics Platform uses natural language processing, statistical modeling, and machine learning to
9+
analyze unstructured and semi-structured text across 364 language-encoding-script combinations, revealing valuable
10+
information and actionable data. Rosette provides endpoints for extracting entities and relationships, translating and
11+
comparing the similarity of names, categorizing and adding linguistic tags to text and more.
812

9-
If the version you are using is not [the latest from Packagist](https://packagist.org/packages/rosette/api),
10-
please check for its [**compatibilty with api.rosette.com**](https://developer.rosette.com/features-and-functions?php).
11-
If you have an on-premise version of Rosette API server, please contact support for
12-
binding compatibility with your installation.
13+
## Rosette API Access
14+
- Rosette Cloud [Sign Up](https://developer.rosette.com/signup)
15+
- Rosette Enterprise [Evaluation](https://www.rosette.com/product-eval/)
1316

14-
## Basic Usage ##
15-
See [examples](examples)
17+
## Quick Start
1618

17-
## API Documentation ##
18-
See [documentation](http://rosette-api.github.io/php)
19+
#### Installation
20+
`composer require "rosette/api"`
1921

20-
## Release Notes
21-
See the [wiki](https://github.com/rosette-api/php/wiki/Release-Notes)
22+
#### Examples
23+
View small example programs for each Rosette endpoint
24+
in the [examples](https://github.com/rosette-api/php/tree/develop/examples) directory.
2225

23-
## Additional Information ##
24-
Visit [Rosette API site](https://developer.rosette.com)
26+
#### Documentation & Support
27+
- [Binding API](https://rosette-api.github.io/php/)
28+
- [Rosette Platform API](https://developer.rosette.com/features-and-functions)
29+
- [Binding Release Notes](https://github.com/rosette-api/php/wiki/Release-Notes)
30+
- [Rosette Platform Release Notes](https://support.rosette.com/hc/en-us/articles/360018354971-Release-Notes)
31+
- [Binding/Rosette Platform Compatibility](https://developer.rosette.com/features-and-functions?php#)
32+
- [Support](https://support.rosette.com)
33+
- [Binding License: Apache 2.0](https://github.com/rosette-api/php/blob/develop/LICENSE.txt)
2534

26-
## Docker ##
27-
A Docker image for running the examples against the compiled source library is available on Docker Hub.
35+
## Binding Developer Information
36+
If you are modifying the binding code, please refer to the [developer README](https://github.com/rosette-api/php/tree/develop/DEVELOPER.md) file.
2837

29-
Command: `docker run -e API_KEY=api-key -v "<binding root directory>:/source" rosetteapi/docker-php`
3038

31-
Additional environment settings:
32-
`-e ALT_URL=<alternative URL>`
33-
`-e FILENAME=<single filename>`
3439

composer.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
{
22
"name": "rosette/api",
3-
"version": "1.12.1",
4-
"description": "Rosette API PHP client SDK",
3+
"version": "1.14.3",
4+
"description": "PHP Interface for Rosette Text Analytics",
55
"license": "Apache",
66
"keywords": [
7-
"rosette",
87
"basis",
8+
"entity extraction",
9+
"morphology",
10+
"name similarity",
11+
"ner",
912
"nlp",
10-
"text analytics"
13+
"rosette",
14+
"sentiment",
15+
"text analytics",
16+
"text embeddings"
1117
],
1218
"authors": [
1319
{

examples/README.md

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,55 @@
1-
PHP Examples
2-
============
3-
1+
## Endpoint Examples
42
These examples are scripts that can be run independently to demonstrate the Rosette API functionality.
53

6-
You can now run your desired _endpoint_.php file to see it in action. Before running the examples
7-
for the first time:
8-
9-
1. ```cd examples```
10-
2. ```composer update```
11-
3. The examples are dual purpose in that they're used to test both source and packagist. In order to meet that requirement, the examples expect the vendor directory to be at the same level as examples/.
12-
```cp -r ./vendor/. ../vendor``` or you can edit the example to reference the vendor directory that is in the examples directory.
13-
14-
For example, run `php categories.php` if you want to see the categories functionality demonstrated.
15-
16-
All files require you to input your Rosette API User Key after `--key` to run.
17-
For example: `php ping.php --key 1234567890`
18-
All also allow you to input your own service URL if applicable.
19-
For example: `php ping.php --key 1234567890 --url http://www.myurl.com`
20-
21-
22-
Each example, when run, prints its output to the console.
23-
24-
| File Name | What it does |
25-
| ------------- |------------- |
26-
| categories.php | Gets the category of a document at a URL |
27-
| entities.php | Gets the entities from a piece of text |
28-
| info.php | Gets information about Rosette API |
29-
| language.php | Gets the language of a piece of text |
30-
| morphology_complete.php | Gets the complete morphological analysis of a piece of text|
31-
| morphology_compound-components.php | Gets the de-compounded words from a piece of text |
32-
| morphology_han-readings.php | Gets the Chinese words from a piece of text |
33-
| morphology_lemmas.php | Gets the lemmas of words from a piece of text |
34-
| morphology_parts-of-speech.php | Gets the part-of-speech tags for words in a piece of text |
35-
| name_deduplication.php | Fuzzy deduplication of a list of names |
36-
| name_translation.php | Translates a name from one language to another |
37-
| name_similarity.php | Gets the similarity score of two names |
38-
| ping.php | Pings the Rosette API to check for reachability |
39-
| sentences.php | Gets the sentences from a piece of text |
40-
| sentiment.php | Gets the sentiment of a local file |
41-
| tokens.php | Gets the tokens (words) from a piece of text |
42-
| topics.php | Gets the key phrases and concepts from a piece of text |
43-
| transliteration.php | Transliterates content |
4+
Each example file demonstrates one of the capabilities of the Rosette Platform. Each example, when run, prints its output to the console.
5+
6+
Here are some methods for running the examples. Each example will also accept an optional `--url` parameter for
7+
overriding the default URL.
8+
9+
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.
10+
11+
A note on prerequisites. Rosette API only supports TLS 1.2 so ensure your toolchain also supports it.
12+
13+
#### Docker/Latest Version From Packagist
14+
15+
```
16+
git clone git@github.com:rosette-api/php.git
17+
cd php
18+
docker run -it -v $(pwd):/source --entrypoint bash php:7.3-cli
19+
20+
apt-get update
21+
apt-get install -y git zip
22+
23+
curl -s -o /usr/local/bin/composer https://getcomposer.org/composer.phar
24+
chmod +x /usr/local/bin/composer
25+
composer self-update
26+
27+
cd /source/examples
28+
composer require "rosette/api"
29+
mv vendor/ ../.
30+
31+
php ping.php --key $API_KEY
32+
33+
```
34+
35+
#### Docker/Latest Source
36+
37+
```
38+
git clone git@github.com:rosette-api/php.git
39+
cd php
40+
docker run -it -v $(pwd):/source --entrypoint bash php:7.3-cli
41+
42+
apt-get update
43+
apt-get install -y git zip
44+
45+
curl -s -o /usr/local/bin/composer https://getcomposer.org/composer.phar
46+
chmod +x /usr/local/bin/composer
47+
composer self-update
48+
49+
cd /source
50+
composer install
51+
cd examples
52+
53+
php ping.php --key $API_KEY
4454
55+
```

examples/address_similarity.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
/**
4+
* Example code to call Rosette API to get similarity score for two addresses.
5+
**/
6+
require_once dirname(__FILE__) . '/../vendor/autoload.php';
7+
use rosette\api\Api;
8+
use rosette\api\Address;
9+
use rosette\api\AddressSimilarityParameters;
10+
use rosette\api\RosetteException;
11+
12+
$options = getopt(null, array('key:', 'url::'));
13+
if (!isset($options['key'])) {
14+
echo 'Usage: php ' . __FILE__ . " --key <api_key> --url=<alternate_url>\n";
15+
exit();
16+
}
17+
18+
$addressSimilarityHouseno1 = "1600";
19+
$addressSimilarityRoad1 = "Pennsylvania Ave NW";
20+
$addressSimilarityCity1 = "Washington";
21+
$addressSimilarityState1 = "DC";
22+
$addressSimilarityPostcode1 = "20500";
23+
24+
$addressSimilarityHouseno2 = "160";
25+
$addressSimilarityRoad2 = "Pennsilvana Ave";
26+
$addressSimilarityCity2 = "Washington";
27+
$addressSimilarityState2 = "D.C.";
28+
$addressSimilarityPostcode2 = "20500";
29+
30+
$api = isset($options['url']) ? new Api($options['key'], $options['url']) : new Api($options['key']);
31+
$params = new AddressSimilarityParameters(
32+
new Address(
33+
$addressSimilarityHouseno1,
34+
$addressSimilarityRoad1,
35+
$addressSimilarityCity1,
36+
$addressSimilarityState1,
37+
$addressSimilarityPostcode1
38+
),
39+
new Address(
40+
$addressSimilarityHouseno2,
41+
$addressSimilarityRoad2,
42+
$addressSimilarityCity2,
43+
$addressSimilarityState2,
44+
$addressSimilarityPostcode2
45+
)
46+
);
47+
48+
try {
49+
$result = $api->addressSimilarity($params);
50+
var_dump($result);
51+
} catch (RosetteException $e) {
52+
error_log($e);
53+
}

examples/docker/Dockerfile

Lines changed: 0 additions & 40 deletions
This file was deleted.

examples/docker/README.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)