You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More info about running the CoreNLP Server: https://stanfordnlp.github.io/CoreNLP/corenlp-server.html
25
32
## Usage
26
33
27
34
### Language detection:
@@ -50,7 +57,7 @@ Array
50
57
[meta_data] => Array()
51
58
[meta_description] => GitHub is where people build software. More than 27 million people use GitHub to discover, fork, and contribute to over 80 million projects.
52
59
[meta_lang] => en
53
-
[source_url] => ://
60
+
[source_url] =>
54
61
[text] => NLP Server. Python Flask web service for easy access to multilingual NLP tasks such as language detection, article extraction...
$nlp = new \Web64\Nlp\NlpClient('http://localhost:6400/');
72
-
$neighbours = $nlp->embeddings('obama', 'en');
79
+
$neighbours = $nlp->neighbours('obama', 'en');
73
80
/*
74
81
Array
75
82
(
@@ -87,4 +94,123 @@ Array
87
94
*/
88
95
```
89
96
97
+
### Spacy Entities
98
+
```php
99
+
$text = "Harvesters is a 1905 oil painting on canvas by the Danish artist Anna Ancher, a member of the artists' community known as the Skagen Painters.";
100
+
101
+
$nlp = new \Web64\Nlp\NlpClient('http://localhost:6400/');
102
+
$entities = $nlp->spacy_entities( $text );
103
+
/*
104
+
Array
105
+
(
106
+
[DATE] => Array
107
+
(
108
+
[0] => 1905
109
+
)
110
+
111
+
[NORP] => Array
112
+
(
113
+
[0] => Danish
114
+
)
115
+
116
+
[ORG] => Array
117
+
(
118
+
[0] => the Skagen Painters
119
+
)
120
+
121
+
[PERSON] => Array
122
+
(
123
+
[0] => Anna Ancher
124
+
)
125
+
)
126
+
*/
127
+
```
128
+
129
+
English is used by default. To use another language ensure Spacy language model is downloaded and add the language as the second parameter
$corenlp = new \Web64\Nlp\CoreNlp('http://localhost:9000/');
16
+
13
17
//echo PHP_EOL. PHP_EOL;
14
18
$text = "Catalonia: Ex-police chief Trapero charged with sedition. The former chief of Catalonia's police force, Josep Lluis Trapero, has been charged over events linked with last year's independence referendum.";
0 commit comments