最近更新时间:2021-03-12
通过分析语言单位内成分之间的依存关系揭示其句法结构。 直观来讲,依存句法分析识别句子中的“主谓宾”、“定状补”这些语法成分,并分析各成分之间的关系。
调用地址:https://apim.unicloud.com/api/nlp/dependency/1.0.0/
请求方式:POST
返回类型:JSON
Header如下:
| 参数 | 值 | 说明 |
|---|---|---|
| Content-Type | application/json | -- |
| Authorization | Bearer | 参考Token获取 |
Body如下:
| 参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
|---|---|---|---|---|
| text | true | string | - | 待分析文本,长度建议不超过300个汉字,超过上限则报错 |
注:Body是raw-json格式
curl -H "Authorization:Bearer 2735fbc9-b797-31ad-812c-d8e9e903f6e3" \
-H "Content-Type:application/json" \
-d '{"text": "我喜欢小猫"}' \
https://apim.unicloud.com/api/nlp/dependency/1.0.0/
curl -H "Authorization:Bearer 2735fbc9-b797-31ad-812c-d8e9e903f6e3" \
-H "Content-Type:application/json" \
-d '{"text": "我喜欢小猫"}' \
https://apim.unicloud.com/api/nlp/dependency/1.0.0/
curl -H "Authorization:Bearer 2735fbc9-b797-31ad-812c-d8e9e903f6e3" -H "Content-Type:application/json" -d '{"text": "我喜欢小猫"}' https://apim.unicloud.com/api/nlp/dependency/1.0.0/
| 字段 | 类型 | 说明 |
|---|---|---|
| data | dict | 返回结果数据 |
| +text | string | 待分析文本 |
| +dependency | array of objects | 依存句法分析结果 |
| ++id | int | 词的ID |
| ++word | string | 词 |
| ++pos | string | 词性 |
| ++head | int | 词的父节点ID |
| ++deplabel | string | 词与父节点的依存关系 |
| code | int | 返回码: 0表示成功 1001表示错误的命令请求格式:如JSON格式错误 2000 表示请求的操作超时终止:如模块处理超时 2001 表示未执行请求的操作:如文本超过指定长度 |
| message | string | 返回信息 |
{
"data": {
"text": "我喜欢小猫",
"dependency": [
{
"id": 1,
"word": "我",
"pos": "r",
"deplabel": "SBV",
"head": 2
},
{
"id": 2,
"word": "喜欢",
"pos": "v",
"deplabel": "HED",
"head": 0
},
{
"id": 3,
"word": "小猫",
"pos": "n",
"deplabel": "VOB",
"head": 2
}
]
},
"code": 0,
"message": "success"
}{
"data": {
"text": "我喜欢小猫",
"dependency": [
{
"id": 1,
"word": "我",
"pos": "r",
"deplabel": "SBV",
"head": 2
},
{
"id": 2,
"word": "喜欢",
"pos": "v",
"deplabel": "HED",
"head": 0
},
{
"id": 3,
"word": "小猫",
"pos": "n",
"deplabel": "VOB",
"head": 2
}
]
},
"code": 0,
"message": "success"
}{ "data": { "text": "我喜欢小猫", "dependency": [
{ "id": 1, "word": "我",
"pos": "r", "deplabel": "SBV",
"head": 2
},
{ "id": 2, "word": "喜欢",
"pos": "v", "deplabel": "HED",
"head": 0
},
{ "id": 3, "word": "小猫",
"pos": "n", "deplabel": "VOB",
"head": 2
}
]
}, "code": 0, "message": "success"}| 关系类型 | Tag | Description | Example |
|---|---|---|---|
| 主谓关系 | SBV | subject-verb 主语 | 我送她一束花 (我 <-- 送) |
| 动宾关系 | VOB | verb-object 直接宾语 | 我送她一束花 (送 --> 花) |
| 间宾关系 | IOB | indirect-object 间接宾语 | 我送她一束花 (送 --> 她) |
| 前置宾语 | FOB | fronting-object 前置宾语 | 1. 他什么书都读 (书 <-- 读) 2. 啤酒喝完了(啤酒 <-- 喝) |
| 兼语 | DBL | Double 兼语短语是指由动宾短语和主谓短语部分重合在一起,其中动宾短语的宾语兼做主谓短语的主语 | 1. 他请我吃饭 (请 --> 我) 2. 老板嘱咐张主任处理此事 (嘱咐 --> 张主任) (张主任 <-- 处理) |
| 定中关系 | ATT | Attribute 名词性成分前面带的修饰语(也就是“定语”) | 1. 红苹果 (红 <-- 苹果) 2. 漂亮衣服(漂亮 <-- 衣服) |
| 状中结构 | ADV | Adverbial 动词性成分前面带的修饰语(也就是“状语”) | 1. 非常美丽 (非常 <-- 美丽) 2. 努力学习(努力 <-- 学习) |
| 动补结构 | CMP | Complement 动词后带各种补语来对动词作补充说明 | 做完了作业 (做 --> 完) |
| 并列关系 | COO | Coordinate 两个以上的词组有平等地位 | 大山和大海 (大山 --> 大海) |
| 介宾关系 | POB | preposition-object 介词与宾语中的主语的关系 | 我在贸易区内做展览 ( 在 --> 内 ) |
| 左附加关系 | LAD | left adjunct | 大山和大海 (和 <-- 大海) |
| 右附加关系 | RAD | right adjunct | 孩子们 (孩子 --> 们) |
| 独立结构 | IS | independent structure 两个单句在结构上彼此独立 | |
| 标点 | WP | punctuation | 。 |
| 核心关系 | HED | Head 整个句子的核心,须是动词 | 我吃苹果(吃= Head) |
注意:
名词性成分:名词(方位名词,时间名词)、数词、量词、代词;
动词性成分:动词、形容词、代谓词;
方位名词:内、上、下、前、后、以内、之内、东、西、南、北等。
| Tag | Description | Example |
|---|---|---|
| a | adjective | 美丽 |
| b | other noun-modifier | 大型, 西式 |
| c | conjunction | 和, 虽然 |
| d | adverb | 很 |
| e | exclamation | 哎 |
| g | morpheme | 茨 , 甥 |
| h | prefix | 阿 , 伪 |
| i | idiom | 百花齐放 |
| j | abbreviation | 公检法 |
| k | suffix | 界 , 率 |
| m | number | 一, 第一 |
| n | general noun | 苹果 |
| nd | direction noun | 右侧 |
| nh | person name | 杜甫, 汤姆 |
| ni | organization name | -- |
| nl | location noun | -- |
| ns | geographical name | -- |
| nt | temporal noun | -- |
| nz | other proper noun | -- |
| o | onomatopoeia | -- |
| p | preposition | -- |
| q | quantity | -- |
| r | pronoun | -- |
| u | auxiliary | -- |
| v | verb | -- |
| wp | punctuation | -- |
| ws | foreign words | -- |
| x | non-lexeme | -- |