定制 sadonsergey/yc-ml-translate 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sadonsergey/yc-ml-translate

Composer 安装命令:

composer require sadonsergey/yc-ml-translate

包简介

Yandex ML Translate for Yandex Cloud (AI API)

README 文档

README

Installation

composer require "sadonsergey/yc-ml-translate"

Usage

  • You must use one of two tokens, if an OAuth token is used then we will exchange it for an IAM token. However, we will have to do this every time we request a transfer, we recommend using the IAM token.
  • You can get an IAM token yourself here
  • $OAuthToken is optional if there is a $ IAMToken.
  • $folderId is required. The ID of the directory to which you have access. Required for authorization with a user account (see UserAccount resource). Do not use this field if you are making a request on behalf of a service account.

The lifetime of an IAM token is no more than 12 hours, but it is recommended to request it more often, for example, every hour.

$yandexTranslate = new ssadon\YandexTranslate($OAuthToken, $IAMToken, $folderId);

//Translating text
$text = $yandexTranslate->translate('en', 'ru', 'cat'); 
echo $text['text']; //кошка

//You can use multiple translation
$text = $yandexTranslate->translate('en', 'ru', ['cat', 'dog']); 
echo $text[0]['text']; //кошка
echo $text[1]['text']; //собака


//Detecting language
$detect = $yandexTranslate->detectLanguage('English text');
echo $detect; //en

You can also see how this works on the basis of tests. Do not forget to start them before you start working.

License

MIT

统计信息

  • 总下载量: 46
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固