import com.baidubce.http.ApiExplorerClient; import com.baidubce.http.AppSigner; import com.baidubce.http.HttpMethodName; import com.baidubce.model.ApiExplorerRequest; import com.baidubce.model.ApiExplorerResponse; // 中文分词 Java示例代码 public class RequestDemo { public static void main(String[] args) { String path = "http://gwgp-ux3dz4sqrmr.n.bdcloudapi.com/wordsSplit"; ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.POST, path); request.setCredentials("您的 access key", "您的 secret key"); request.addHeaderParameter("Content-Type", "application/json;charset=UTF-8"); request.addQueryParameter("text", ""); ApiExplorerClient client = new ApiExplorerClient(new AppSigner()); try { ApiExplorerResponse response = client.sendRequest(request); // 返回结果格式为Json字符串 System.out.println(response.getResult()); } catch (Exception e) { e.printStackTrace(); } } }
点击复制代码
{
"showapi_res_code": 0,
"showapi_res_error": "",
"showapi_res_id":"ce135f6739294c63be0c021b76b6fbff",
"showapi_res_body": {
"ret_code": 0,
"list": [
"易源",
"接口",
"api",
"插拔",
"总线"
]
}
}
将长段中文智能切开,分隔。用于中文词义分析、推广营销、用户消费捕捉等场景,如全文检索的时候需要把文本切词;对博客标题进行分词,提取其中的名词作为文章关键词;对用户搜索条件进行分词,提取其中关键词语进行搜索。
导入文本即可自动分词
特征词选择,构建专题词库
一键情感分析,情感词典可定义
自定义标签词匹配,一键实现文本分类