tinq-ai/tinq-php

Tinq.ai API 的 PHP 封装 - 即用型自然语言处理工具包

dev-main 2024-09-09 12:38 UTC

This package is auto-updated.

Last update: 2024-09-09 12:38:14 UTC


README

Tinq.ai logo

A PHP wrapper for the Tinq.ai API - an easy-to-use text analysis and natural language processing toolkit.

文档

完整的 API 文档在此可以找到。

需求

  • PHP 8.0 或更高版本

安装

使用以下命令安装包

composer require tinq-ai/tinq-php

要使用绑定,通过 Autoload 加载它

require_once('vendor/autoload.php');

用法

目录

请注意,所有方法都返回关联数组。响应可以在开发人员文档中找到此处

身份验证

在 Tinq.ai 中获取您项目的 API 密钥,然后实例化一个新的客户端。

$tinq = new Tinq\TinqClient("your_api_key");

或者,将 API 密钥和您的用户名分别设置在名为 TINQ_API_KEYTINQ_USERNAME 的环境变量中。

$tinq = new Tinq\TinqClient();

重写器

重写或改写给定文本。

  • $text - 要重写的文本内容。
  • $params (可选) - 可接受的参数列表在此
$text = "The process of learning a new piece of music is fantastic...";
$rewritten = $tinq->rewrite($text, $params = []);

摘要生成器

摘要给定文本。

  • $text - 要摘要的文本内容。
  • $params (可选) - 可接受的参数列表在此
$text = "Bernal’s case study is Tullis Mason, a chap who sports...";
$summary = $tinq->summarize($text, $params = []);

分类器

根据指定的分类器对给定文本进行分类。

  • $text - 要分类的文本内容。
  • $classifier - 分类器 ID。
  • $params (可选) - 可接受的参数列表在此
$text = "Hi, I need help with my website.";
$classifier = "fjew833"; // Your classifier ID on Tinq.ai
$classification = $tinq->classify($text, $classifier, $params = []);

文章提取器

从给定文章的 URL 提取干净的文本。

  • $url - 提取文章的 URL。
  • $params (可选) - 可接受的参数列表在此
$url = "https://longreads.com/2021/08/19/bringing-species-back-from-the-brink/";
$article = $tinq->extractArticle($url, $params = []);

情感分析

对给定文本进行情感分析。

  • $text - 要分析的文本内容。
  • $params (可选) - 可接受的参数列表在此
$text = "I really like you.";
$sentimentAnalysis = $tinq->sentiments($text, $params = []);

抄袭检测器

检查抄袭并查找给定内容的在线来源。

  • $text - 要检查抄袭的文本内容。
  • $params (可选) - 可接受的参数列表在此
$text = "Bernal’s case study is Tullis Mason, a chap who sports...";
$plagiarismCheck = $tinq->checkPlagiarism($text, $params = []);

贡献

欢迎在 GitHub 上提交错误报告和拉取请求https://github.com/tinq-ai/tinq-php

许可证

该软件包作为开源软件提供,遵循MIT 许可协议