strays/baidu-ai

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

1.0.1 2019-02-22 02:13 UTC

This package is auto-updated.

Last update: 2024-04-23 14:15:46 UTC


README

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

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

Installing

$ composer require strays/baidu-ai -vvv

Usage

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

<?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

Documentation

百度开发平台

Contributing

You can contribute in one of three ways:

  1. File bug reports using the issue tracker.
  2. Answer questions or fix bugs on the issue tracker.
  3. Contribute new features or update the wiki.

The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.

License

MIT