google / cloud-natural-language
Cloud Natural Language Client for PHP
Requires
- php: ^8.0
- google/cloud-core: ^1.52.7
- google/gax: ^1.34.0
Requires (Dev)
- erusev/parsedown: ^1.6
- google/cloud-storage: ^1.3
- phpdocumentor/reflection: ^5.3.3
- phpdocumentor/reflection-docblock: ^5.3
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: 2.*
Suggests
- ext-grpc: The gRPC extension enables use of the performant gRPC transport
- ext-protobuf: Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions.
- google/cloud-storage: Analyze documents stored in Google Cloud Storage
- dev-main
- v0.34.0
- v0.33.0
- v0.32.7
- v0.32.6
- v0.32.5
- v0.32.4
- v0.32.3
- v0.32.2
- v0.32.1
- v0.32.0
- v0.31.3
- v0.31.2
- v0.31.1
- v0.31.0
- v0.30.2
- v0.30.1
- v0.30.0
- v0.29.0
- v0.28.5
- v0.28.4
- v0.28.3
- v0.28.2
- v0.28.1
- v0.28.0
- v0.27.0
- v0.26.8
- v0.26.7
- v0.26.6
- v0.26.5
- v0.26.4
- v0.26.3
- v0.26.2
- v0.26.1
- v0.26.0
- v0.25.0
- v0.24.7
- v0.24.6
- v0.24.5
- v0.24.4
- v0.24.3
- v0.24.2
- v0.24.1
- v0.24.0
- v0.23.0
- v0.22.5
- v0.22.4
- v0.22.3
- v0.22.2
- v0.22.1
- v0.22.0
- v0.21.0
- v0.20.0
- v0.19.4
- v0.19.3
- v0.19.2
- v0.19.1
- v0.19.0
- v0.18.0
- v0.17.0
- v0.16.5
- v0.16.4
- v0.16.3
- v0.16.2
- v0.16.1
- v0.16.0
- v0.15.5
- v0.15.4
- v0.15.3
- v0.15.2
- v0.15.1
- v0.15.0
- v0.14.1
- v0.14.0
- v0.13.4
- v0.13.3
- v0.13.2
- v0.13.1
- v0.13.0
- v0.12.3
- v0.12.2
- v0.12.1
- v0.12.0
- v0.11.2
- v0.11.1
- v0.11.0
- v0.10.0
- v0.9.1
- v0.9.0
- v0.8.0
- v0.7.0
- v0.6.0
- v0.5.0
- v0.4.1
- v0.4.0
- v0.3.0
- v0.2.0
- v0.1.0
This package is auto-updated.
Last update: 2024-09-28 04:28:43 UTC
README
Idiomatic PHP client for Cloud Natural Language.
NOTE: This repository is part of Google Cloud PHP. Any support requests, bug reports, or development contributions should be directed to that project.
Provides natural language understanding technologies to developers, including sentiment analysis, entity analysis, entity sentiment analysis, content classification, and syntax analysis. This API is part of the larger Cloud Machine Learning API family.
Installation
To begin, install the preferred dependency manager for PHP, Composer.
Now install this component:
$ composer require google/cloud-language
Authentication
Please see our Authentication guide for more information on authenticating your client. Once authenticated, you'll be ready to start making requests.
Sample
require 'vendor/autoload.php'; use Google\Cloud\Language\LanguageClient; $language = new LanguageClient(); // Analyze a sentence. $annotation = $language->annotateText('Greetings from Michigan!'); // Check the sentiment. if ($annotation->sentiment() > 0) { echo "This is a positive message.\n"; } // Detect entities. $entities = $annotation->entitiesByType('LOCATION'); foreach ($entities as $entity) { echo $entity['name'] . "\n"; } // Parse the syntax. $tokens = $annotation->tokensByTag('NOUN'); foreach ($tokens as $token) { echo $token['text']['content'] . "\n"; }
Version
This component is considered beta. As such, it should be expected to be mostly stable and we're working towards a release candidate. We will address issues and requests with a higher priority.
Next Steps
- Understand the official documentation.
- Take a look at in-depth usage samples.