Download the PHP package aflorea4/php-nlp-client without Composer
On this page you can find all versions of the php package aflorea4/php-nlp-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aflorea4/php-nlp-client
More information about aflorea4/php-nlp-client
Files in aflorea4/php-nlp-client
Package php-nlp-client
Short Description Library for accessing NLP apis (Fixed HTTP header interpretation)
License MIT
Informations about the package php-nlp-client
PHP NLP-Client
This is a simple PHP library for performing multilingual Natural Language tasks using Web64's NLP-Server https://github.com/web64/nlpserver and other providers.
NLP tasks available through Web64's NLP Server:
- Language detection
- Article Extraction from HTML or URL
- Entity Extraction (NER) - Multilingual
- Sentiment Analysis - Multilingual
- Embeddings / Neighbouring words - Multilingual
- Summarization
NLP Tasks Available through Stanford's CoreNLP Server:
- Entity Extraction (NER)
NLP Tasks Available through Microsoft Labs API:
- Concept Graph
Laravel Package
There is also a Laravel wrapper for this library available here: https://github.com/web64/laravel-nlp
Installation
NLP Server
Most NLP features in this package requires a running instance of the NLP Server, which is a simple python flask app providing web service api access to common python NLP libraries.
Installation instrcuctions: https://github.com/web64/nlpserver
Entity Extraction - Named Entity Recognition (NER)
This library provides access to three different methods for entity extraction.
Provider | Language Support | Programming Lang. | API Access |
---|---|---|---|
Polyglot | 40 languages | Python | NLP Server |
Spacy | 7 languages | Python | NLP Server |
CoreNLP | 6 languages | Java | CoreNLP Standalone server |
If you are dealing with text in English or one of the major European language you will get the best results with CoreNLP or Spacy.
The quality of extracted entities with Polyglot is not great, but for many languages it is the only available option at the moment.
Polyglot and Spacy NER is accessible thorough the NLP Server, CoreNLP requires its own standalone java server.
Usage
Language detection:
Article & Metadata Extraction
Entitiy Extraction & Sentiment Analysis (Polyglot)
This uses the Polyglot multilingual NLP library to return entities and a sentiment score for given text.Ensure the models for the required languages are downloaded for Polyglot.
Entity Extraction with Spacy
English is used by default. To use another language, ensure the Spacy language model is downloaded and add the language as the second parameter
Sentiment Analysis
Neighbouring words (Embeddings)
Summarization
Extract short summary from a long text
Readability
Article Extraction using python port of Readability.js
CoreNLP - Entity Extraction (NER)
CoreNLP has much better quality for NER that Polyglot, but only supports a few languages including English, French, German and Spanish.
Download CoreNLP server (Java) here: https://stanfordnlp.github.io/CoreNLP/index.html#download
Install CoreNLP
Running the CoreNLP server
When the CoreNLP server is running you can access it on port 9000: http://localhost:9000/
More info about running the CoreNLP Server: https://stanfordnlp.github.io/CoreNLP/corenlp-server.html
Concept Graph
Microsoft Concept Graph For Short Text Understanding: https://concept.research.microsoft.com/
Find related concepts to provided keyword
Python libraries
These are the python libraries used by the NLP Server for the NLP and data extraction tasks.
Library | URL | NLP Task used |
---|---|---|
langid.py | https://github.com/saffsd/langid.py | Language detection |
Newspaper | https://github.com/codelucas/newspaper | Article & metadata extraction |
Spacy | https://spacy.io/ | Entity extraction |
Polyglot | https://github.com/aboSamoor/polyglot | Multilingual NLPprocessing toolkit |
Gensim | https://radimrehurek.com/gensim/ | Summarization |
Readability | https://github.com/buriy/python-readability | Article extraction |
Other PHP NLP projects
Contribute
Get in touch if you have any feedback or ideas on how to improve this package or the documentation.