## 中文分词 ![](https://img.kancloud.cn/a3/a1/a3a15ce27ec3644a5bc31775f3df0848_200x200.png) > 效率极高的中文分词接口,支持NLP智能分词 ## 接口费用( [点击购买](https://market.topthink.com/product/184)) > 最低 0.001元/次 ## 接口调用([调用须知](https://docs.topthink.com/think-api/1835086)) ## 接口1:中文抽取关键词 ### 请求地址 ``` GET https://api.topthink.com/word/segment ``` ### 请求参数 | 名称 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | appCode| string| 是|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) | | content| string | 是 | 内容| | num| string | 否 | 返回数量,默认为10,最大5100 ### 返回`data`参数 | 名称 | 类型 | 示例值 | 说明 | | --- | --- | --- | --- | |参考返回示例 ## SDK调用 ``` $client = new Client("YourAppCode"); $result = $client->wordSegment() ->withContent('今天我们去上海外滩和南京东路玩') ->request(); ``` 返回示例: ~~~ { "code":0, "message": "成功", "data": [ "上海", "外滩", "南京东路" ] } ~~~ ## 接口2:中文智能分词 NLP智能分词,快速把一段文本切分为一个个词组,并标注了词性。大文本分词时,应该使用post请求方式。且最大不能超过800个字符。 ### 请求地址 ``` GET https://api.topthink.com/word/nlp ``` ### 请求参数 | 名称 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | appCode| string| 是|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) | | content| string | 是 | 内容| ### 返回`data`参数 | 名称 | 类型 | 示例值 | 说明 | | --- | --- | --- | --- | | word | string | 今天 | 词语 | | word_tag | string | 132 | 词性代码 | | index | string | 0 | 标号索引 | 词性代码释义如下: | 名称 | 代码 | | --- | --- | | 数词(例如:100、一亿) | 90 | | 名词(例如:妈妈、老师、手机) | 95 | | 人名(例如:马化腾、马小姐、小天) | 96 | | 机构团体名(例如:腾讯公司、北大、中科院) | 97 | | 地名词(例如:上海、外滩、南京东路) | 102 | | 数词开头的名词(例如:一个好人、三个和尚) | 103 | | 以代词开头的名词(例如:该同学、某人) | 104 | | 动量词(例如:次、遍、趟) | 111 | | 时间量词(例如:年、月、日) | 112 | | 货币量词(例如:美元、英镑) | 113 | | 历史量词(例如:唐朝、清初) | 133 | | 谓词(例如:理发、洗澡) | 171 | | 不及物谓词(例如:腰酸、头疼) | 200 | ## SDK调用 ``` $client = new Client("YourAppCode"); $result = $client->wordNlp() ->withContent('今天小天和kitty去上海外滩和南京东路玩') ->request(); ``` 返回示例: ~~~ { "code":0, "message": "成功", "data": [ { "word": "今天", "word_tag": "132", "index": "0" }, { "word": "小天", "word_tag": "96", "index": "1" }, { "word": "和", "word_tag": "108", "index": "2" }, { "word": "kitty", "word_tag": "95", "index": "3" }, { "word": "去", "word_tag": "170", "index": "4" }, { "word": "上海", "word_tag": "102", "index": "5" }, { "word": "外滩", "word_tag": "102", "index": "6" }, { "word": "和", "word_tag": "108", "index": "7" }, { "word": "南京东路", "word_tag": "102", "index": "8" }, { "word": "玩", "word_tag": "170", "index": "9" } ] } ~~~