A PHP wrapper for the Tinq.ai API - an easy-to-use text analysis and natural language processing toolkit.
Find the full API documentation here
- PHP 8.0 or Higher
Install the package with:
composer require tinq-ai/tinq-php
To use the bindings, load it via Autoload:
require_once('vendor/autoload.php');
- Authentication
- Rewriter
- Summarizer
- Classifier
- Article Extractor
- Sentiment Analysis
- Plagiarism Checker
Please note that all methods return associative arrays. Responses can be found in the developer documentation here.
Get the API key for your project in Tinq.ai and then instantiate a new client.
$tinq = new Tinq\TinqClient("your_api_key");
Alternatively, set the API key and your username in an environment variable named TINQ_API_KEY
and TINQ_USERNAME
, respectively.
$tinq = new Tinq\TinqClient();
Rewrites or paraphrases a given text.
$text
- The content to rewrite.$params
(optional) - A list of accepted parameters is available here.
$text = "The process of learning a new piece of music is fantastic...";
$rewritten = $tinq->rewrite($text, $params = []);
Summarizes a given text.
$text
- The content to summarize.$params
(optional) - A list of accepted parameters is available here.
$text = "Bernal’s case study is Tullis Mason, a chap who sports...";
$summary = $tinq->summarize($text, $params = []);
Classifies a given text according to a specified classifier.
$text
- The content to classify.$classifier
- The classifier ID.$params
(optional) - A list of accepted parameters is available here.
$text = "Hi, I need help with my website.";
$classifier = "fjew833"; // Your classifier ID on Tinq.ai
$classification = $tinq->classify($text, $classifier, $params = []);
Extracts clean text from an article given its URL.
$url
- The URL to extract an article from.$params
(optional) - A list of accepted parameters is available here.
$url = "https://longreads.com/2021/08/19/bringing-species-back-from-the-brink/";
$article = $tinq->extractArticle($url, $params = []);
Performs sentiment analysis on a given text.
$text
- The content to analyze.$params
(optional) - A list of accepted parameters is available here.
$text = "I really like you.";
$sentimentAnalysis = $tinq->sentiments($text, $params = []);
Checks for plagiarism and finds online sources for given content.
$text
- The content to check for plagiarism.$params
(optional) - A list of accepted parameters is available here.
$text = "Bernal’s case study is Tullis Mason, a chap who sports...";
$plagiarismCheck = $tinq->checkPlagiarism($text, $params = []);
Bug reports and pull requests are welcome on GitHub at https://github.com/tinq-ai/tinq-php.
The package is available as open source under the terms of the MIT License.