strays/baidu-ai

百度自然语言处理、内容审核等...

1.0.1 2019-02-22 02:13 UTC

This package is auto-updated.

Last update: 2024-09-23 15:10:32 UTC


README

免费强大的百度 AI 处理技术

Build Status Scrutinizer Code Quality Code Intelligence Status StyleCI Latest Stable Version License

安装

$ composer require strays/baidu-ai -vvv

用法

基本使用(以服务端为例)

<?php

use Strays\BaiDuAi\Factory;

$config = [
    'apiKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
    'secretKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
    'ssl' => false,
];

$app = Factory::language($config);

$result = $app->lexer->send('百度是一个伟大的公司');

API

百度自然语言处理:

  • $app->lexer->send() 词法分析,对应百度AI开放平台中自然语言中 词法分析 API
  • $app->lexer->custom() 词法分析(定制版),对应百度AI开放平台中自然语言中 词法分析 API
  • $app->depParser->send() 依存句法分析,对应百度AI开放平台中自然语言中 依存句法分析 API
  • $app->wordEmbedding->send() 词向量表示,对应百度AI开放平台中自然语言中 词向量表示 API
  • $app->dnnlm->send() DNN语言模型,对应百度AI开放平台中自然语言中 DNN语言模型 API
  • $app->wordSimEmbedding->send() 词义相似度,对应百度AI开放平台中自然语言中 词义相似度 API
  • $app->simnet->send() 短文本相似度,对应百度AI开放平台中自然语言中 短文本相似度 API
  • $app->comment->send() 评论观点抽取,对应百度AI开放平台中自然语言中 评论观点抽取 API
  • $app->sentimentClassify->send() 情感倾向分析,对应百度AI开放平台中自然语言中 情感倾向分析 API
  • $app->keyword->send() 文章标签,对应百度AI开放平台中自然语言中 文章标签 API
  • $app->topic->send() 文章分类,对应百度AI开放平台中自然语言中 文章分类 API

内容审核:

<?php

use Strays\BaiDuAi\Factory;

$config = [
    'apiKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
    'secretKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
    'ssl' => false,
];

$app = Factory::review($config);

$result = $app->text->send('百度是一个伟大的公司');
  • $app->text->send() 文本审核,对应百度AI开放平台中内容审核中 文本审核 API
  • $app->image->antiPornGif() Gif 图片审核,对应百度AI开放平台中内容审核中 Gif 图片审核 API
  • $app->image->faceAudit() 用户头像审核,对应百度AI开放平台中内容审核中 用户头像审核 API
  • $app->image->imageCensorComb() 组合服务接口,对应百度AI开放平台中内容审核中 组合服务接口 API
  • $app->image->imageCensorUserDefined() 自定义图像审核,对应百度AI开放平台中内容审核中 自定义图像审核 API

文档

百度开发平台

贡献

你可以通过以下三种方式之一进行贡献

  1. 使用 问题跟踪器 提交错误报告。
  2. 问题跟踪器 上回答问题或修复错误。
  3. 贡献新功能或更新维基。

代码贡献过程并不非常正式。你只需确保遵循PSR-0、PSR-1和PSR-2编码指南。任何新的代码贡献都必须附有适用的单元测试。

许可

MIT