Skip to content

Commit 5e7672d

Browse files
committed
readme examples
1 parent beb1a91 commit 5e7672d

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Laravel NLP
2-
A simple wrapper for PHP-NLP-Client and OpenCalais NLP tools.
2+
A simple wrapper for PHP-NLP-Client for accessing Python and Java NLP libraries.
33

44
## Installation
55

@@ -9,13 +9,18 @@ $ composer require web64/laravel-nlp
99

1010
## Requirements
1111

12+
## NLP Server
13+
This package requires a running instance of the NLP Server [https://github.com/web64/nlpserver]
14+
1215
## Included Tools
1316

1417
* Article Extraction
1518
* Language Detection
1619
* Entity Extraction (Named Entity Recognition)
1720
* Sentiment Analysis
18-
*
21+
* Summarization
22+
* Translation
23+
* Embeddings - Neighbouring Words
1924

2025
## Usage
2126

@@ -49,8 +54,36 @@ print_r($article);
4954
```
5055

5156
### Entity Extraction
57+
```php
58+
$text = "Barack Hussein Obama is an American politician who served as the 44th President of the United States from January 20, 2009 to January 20, 2017. Before that, he served in the Illinois State Senate from 1997 until 2004.";
5259

60+
$entities = NLP::entities( $text, 'en' );
61+
/*
62+
Array
63+
(
64+
[0] => Barack Hussein Obama
65+
[1] => American
66+
[2] => United States
67+
[3] => Illinois
68+
)
69+
*/
70+
```
5371
### Sentiment Analysis
72+
```php
73+
$sentiment = NLP::sentiment( "This is great!" );
74+
// 1
75+
76+
$sentiment = NLP::sentiment( "I hate this product" );
77+
// -1
78+
```
79+
### Summarization
80+
### Translation
81+
Second parameter is the source language. Language will be automatically detected if left as NULL
82+
83+
```php
84+
$translated_text = NLP::translate("Mange er opprørt etter avsløringene om at persondata for 87 millioner Facebook-brukere skal være på avveie", null, 'pt');
85+
// 'Muitas pessoas estão chateadas após a divulgação de que os dados pessoais de 87 milhões de usuários do Facebook devem estar fora de ordem'
86+
```
5487

5588
### Concepts
5689
### Embeddings

0 commit comments

Comments
 (0)