Properties

$accessTokenUrl

$accessTokenUrl : string

获取access token url

Type

string

$reportUrl

$reportUrl : string

反馈接口

Type

string

$appId

$appId : string

appId

Type

string

$apiKey

$apiKey : string

apiKey

Type

string

$secretKey

$secretKey : string

secretKey

Type

string

$scope

$scope : array

权限

Type

array

$lexerUrl

$lexerUrl : string

词法分析 lexer api url

Type

string

$lexerCustomUrl

$lexerCustomUrl : string

词法分析(定制版) lexer_custom api url

Type

string

$depParserUrl

$depParserUrl : string

依存句法分析 dep_parser api url

Type

string

$wordEmbeddingUrl

$wordEmbeddingUrl : string

词向量表示 word_embedding api url

Type

string

$dnnlmCnUrl

$dnnlmCnUrl : string

DNN语言模型 dnnlm_cn api url

Type

string

$wordSimEmbeddingUrl

$wordSimEmbeddingUrl : string

词义相似度 word_sim_embedding api url

Type

string

$simnetUrl

$simnetUrl : string

短文本相似度 simnet api url

Type

string

$commentTagUrl

$commentTagUrl : string

评论观点抽取 comment_tag api url

Type

string

$sentimentClassifyUrl

$sentimentClassifyUrl : string

情感倾向分析 sentiment_classify api url

Type

string

$keywordUrl

$keywordUrl : string

文章标签 keyword api url

Type

string

$topicUrl

$topicUrl : string

文章分类 topic api url

Type

string

$ecnetUrl

$ecnetUrl : string

文本纠错 ecnet api url

Type

string

$emotionUrl

$emotionUrl : string

对话情绪识别接口 emotion api url

Type

string

$newsSummaryUrl

$newsSummaryUrl : string

新闻摘要接口 news_summary api url

Type

string

$addressUrl

$addressUrl : string

地址识别接口 address api url

Type

string

Methods

__construct()

__construct(string  $appId, string  $apiKey, string  $secretKey) : mixed

Parameters

string $appId
string $apiKey
string $secretKey

Returns

mixed —

getVersion()

getVersion() : string

查看版本

Returns

string —

setConnectionTimeoutInMillis()

setConnectionTimeoutInMillis(int  $ms) : mixed

连接超时

Parameters

int $ms

毫秒

Returns

mixed —

setSocketTimeoutInMillis()

setSocketTimeoutInMillis(int  $ms) : mixed

响应超时

Parameters

int $ms

毫秒

Returns

mixed —

setProxies()

setProxies(mixed  $proxies) : string

代理

Parameters

mixed $proxies

Returns

string —

report()

report(mixed  $feedback) : array

反馈

Parameters

mixed $feedback

Returns

array —

post()

post(string  $url, array  $data, mixed  $headers = array()) : array

通用接口

Parameters

string $url
array $data
mixed $headers

Returns

array —

lexer()

lexer(string  $text, array  $options = array()) : array

词法分析接口

Parameters

string $text
  • 待分析文本(目前仅支持GBK编码),长度不超过65536字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

lexerCustom()

lexerCustom(string  $text, array  $options = array()) : array

词法分析(定制版)接口

Parameters

string $text
  • 待分析文本(目前仅支持GBK编码),长度不超过65536字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

depParser()

depParser(string  $text, array  $options = array()) : array

依存句法分析接口

Parameters

string $text
  • 待分析文本(目前仅支持GBK编码),长度不超过256字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

wordEmbedding()

wordEmbedding(string  $word, array  $options = array()) : array

词向量表示接口

Parameters

string $word
  • 文本内容(GBK编码),最大64字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

dnnlm()

dnnlm(string  $text, array  $options = array()) : array

DNN语言模型接口

Parameters

string $text
  • 文本内容(GBK编码),最大512字节,不需要切词
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

wordSimEmbedding()

wordSimEmbedding(string  $word1, string  $word2, array  $options = array()) : array

词义相似度接口

Parameters

string $word1
  • 词1(GBK编码),最大64字节
string $word2
  • 词1(GBK编码),最大64字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

simnet()

simnet(string  $text1, string  $text2, array  $options = array()) : array

短文本相似度接口

Parameters

string $text1
  • 待比较文本1(GBK编码),最大512字节
string $text2
  • 待比较文本2(GBK编码),最大512字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

commentTag()

commentTag(string  $text, array  $options = array()) : array

评论观点抽取接口

Parameters

string $text
  • 评论内容(GBK编码),最大10240字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

sentimentClassify()

sentimentClassify(string  $text, array  $options = array()) : array

情感倾向分析接口

Parameters

string $text
  • 文本内容(GBK编码),最大102400字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

keyword()

keyword(string  $title, string  $content, array  $options = array()) : array

文章标签接口

Parameters

string $title
  • 篇章的标题,最大80字节
string $content
  • 篇章的正文,最大65535字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

topic()

topic(string  $title, string  $content, array  $options = array()) : array

文章分类接口

Parameters

string $title
  • 篇章的标题,最大80字节
string $content
  • 篇章的正文,最大65535字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

ecnet()

ecnet(string  $text, array  $options = array()) : array

文本纠错接口

Parameters

string $text
  • 待纠错文本,输入限制511字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

emotion()

emotion(string  $text, array  $options = array()) : array

对话情绪识别接口接口

Parameters

string $text
  • 待识别情感文本,输入限制512字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

newsSummary()

newsSummary(string  $content, int  $maxSummaryLen, array  $options = array()) : array

新闻摘要接口接口

Parameters

string $content
  • 字符串(限3000字符数以内)字符串仅支持GBK编码,长度需小于3000字符数(即6000字节),请输入前确认字符数没有超限,若字符数超长会返回错误。正文中如果包含段落信息,请使用"\n"分隔,段落信息算法中有重要的作用,请尽量保留
int $maxSummaryLen
  • 此数值将作为摘要结果的最大长度。例如:原文长度1000字,本参数设置为150,则摘要结果的最大长度是150字;推荐最优区间:200-500字
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

address()

address(string  $text, array  $options = array()) : array

地址识别接口接口

Parameters

string $text
  • 待识别的文本内容,不超过1000字节
array $options
  • 可选参数对象,key: value都为string类型

Returns

array —

proccessRequest()

proccessRequest(string  $url, array  $params, array  $data, array  $headers) : mixed

处理请求参数

Parameters

string $url
array $params
array $data
array $headers

Returns

mixed —

request()

request(string  $url, mixed  $data, mixed  $headers = array()) : mixed

Api 请求

Parameters

string $url
mixed $data
mixed $headers

Returns

mixed —

multi_request()

multi_request(string  $url, mixed  $data) : mixed

Api 多个并发请求

Parameters

string $url
mixed $data

Returns

mixed —

validate()

validate(string  $url, array  $data) : \addons\getwords\library\lib\mix

格式检查

Parameters

string $url
array $data

Returns

\addons\getwords\library\lib\mix —

proccessResult()

proccessResult( $content) : mixed

格式化结果

Parameters

$content

string

Returns

mixed —

isPermission()

isPermission(array  $authObj) : bool

判断认证是否有权限

Parameters

array $authObj

Returns

bool —

getAuthFilePath()

getAuthFilePath() : string

返回 access token 路径

Returns

string —

writeAuthObj()

writeAuthObj(array  $obj) : void

写入本地文件

Parameters

array $obj

readAuthObj()

readAuthObj() : array

读取本地缓存

Returns

array —

auth()

auth(bool  $refresh = false) : array

认证

Parameters

bool $refresh

是否刷新

Returns

array —

getAuthHeaders()

getAuthHeaders(string  $method, string  $url, mixed  $params = array(), mixed  $headers = array()) : array

Parameters

string $method

HTTP method

string $url
mixed $params
mixed $headers

Returns

array —