参考链接:

https://github.com/HIT-SCIR/ltp/blob/master/doc/install.rst

http://www.xfyun.cn/index.php/services/ltp/detail?&app_id=NTZmYzg5ZWE=

http://www.ltp-cloud.com/document/#api_rest_format_json

其他分词算法参考链接:

NLPIR:http://www.nlpir.org/    http://www.datatang.com/data/13483

bosonnlp: http://bosonnlp.com/

下面针对LTP分词算法 实践

1.登录官网 获取授权码api_key

2.分词接口操作

接口参数:

 StringBuilder sb = new StringBuilder();
sb.Append(" 本报讯 (记者 王少勇)3月28日,国土资源部部长、党组书记、国家土地总督察姜大明主持召开第10次部党组会议,传达学习习xx总书记在北京市考察工作时的重要讲话精神。会议提出,要深刻理解习xx总书记重要讲话精神,充分发挥国土资源部门的服务和保障作用,推进京津冀协同发展。 xx平总书记高度重视北京发展和京津冀协同发展,今年2月下旬专程到北京市调研考察,并发表重要讲话,从做好北京发展和管理工作、推动京津冀协同发展两个方面进行了深刻阐述。会议指出,习xx总书记的重要讲话,对于实现京津冀优势互补、促进环渤海经济区发展、带动北方腹地发展,意义重大、影响深远,要认真学习,深刻领会。 会议提出,国土资源部门要进一步解放思想,加大改革创新力度,");
string url = "http://ltpapi.voicecloud.cn/analysis/";
string data = "api_key=xxx&text=" + sb.ToString() + "&pattern=ws&format=xml";
string returnValue= HttpHelper.HttpPost(url,data);
Console.WriteLine(returnValue);
Console.ReadKey();
 /// <summary>
/// Post请求 webClient
/// </summary>
/// <param name="Url">地址</param>
/// <param name="postString">这里即为传递的参数,可以用工具抓包分析,也可以自己分析,主要是form里面每一个name都要加进来 </param>
/// <returns></returns>
public static string HttpPost(string url, string postString)
{
byte[] postData = Encoding.UTF8.GetBytes(postString);//编码,尤其是汉字,事先要看下抓取网页的编码方式
WebClient webClient = new WebClient();
webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");//采取POST方式必须加的header,如果改为GET方式的话就去掉这句话即可
byte[] responseData = webClient.UploadData(url, "POST", postData);//得到返回字符流
string srcString = Encoding.UTF8.GetString(responseData);//解码
return srcString;
}

3.测试结果

<?xml version="1.0" encoding="utf-8" ?>
<xml4nlp>
<note sent="y" word="y" pos="n" ne="n" parser="n" wsd="n" srl="n" />
<doc>
<para id="">
<sent id="" cont="本报讯 (记者 王少勇)3月28日,国土资源部部长、党
组书记、国家土地总督察姜大明主持召开第10次部党组会议,传达学习习xx总书记在北京
市考察工作时的重要讲话精神。">
<word id="" cont="本报" />
<word id="" cont="讯" />
<word id="" cont="(" />
<word id="" cont="记者" />
<word id="" cont="王少勇" />
<word id="" cont=")" />
<word id="" cont="3月" />
<word id="" cont="28日" />
<word id="" cont="," />
<word id="" cont="国土" />
<word id="" cont="资源部" />
<word id="" cont="部长" />
<word id="" cont="、" />
<word id="" cont="党组" />
<word id="" cont="书记" />
<word id="" cont="、" />
<word id="" cont="国家" />
<word id="" cont="土地" />
<word id="" cont="总督" />
<word id="" cont="察姜" />
<word id="" cont="大明" />
<word id="" cont="主持" />
<word id="" cont="召开" />
<word id="" cont="第10" />
<word id="" cont="次" />
<word id="" cont="部党组" />
<word id="" cont="会议" />
<word id="" cont="," />
<word id="" cont="传达" />
<word id="" cont="学习" />
<word id="" cont="习" />
<word id="" cont="近平" />
<word id="" cont="总书记" />
<word id="" cont="在" />
<word id="" cont="北京市" />
<word id="" cont="考察" />
<word id="" cont="工作" />
<word id="" cont="时" />
<word id="" cont="的" />
<word id="" cont="重要" />
<word id="" cont="讲话" />
<word id="" cont="精神" />
<word id="" cont="。" />
</sent>
<sent id="" cont="会议提出,要深刻理解习xx总书记重要讲话精神,充
分发挥国土资源部门的服务和保障作用,推进京津冀协同发展。">
<word id="" cont="会议" />
<word id="" cont="提出" />
<word id="" cont="," />
<word id="" cont="要" />
<word id="" cont="深刻" />
<word id="" cont="理解" />
<word id="" cont="习" />
<word id="" cont="近平" />
<word id="" cont="总书记" />
<word id="" cont="重要" />
<word id="" cont="讲话" />
<word id="" cont="精神" />
<word id="" cont="," />
<word id="" cont="充分" />
<word id="" cont="发挥" />
<word id="" cont="国土" />
<word id="" cont="资源" />
<word id="" cont="部门" />
<word id="" cont="的" />
<word id="" cont="服务" />
<word id="" cont="和" />
<word id="" cont="保障" />
<word id="" cont="作用" />
<word id="" cont="," />
<word id="" cont="推进" />
<word id="" cont="京" />
<word id="" cont="津" />
<word id="" cont="冀" />
<word id="" cont="协同" />
<word id="" cont="发展" />
<word id="" cont="。" />
</sent>
<sent id="" cont="习xx总书记高度重视北京发展和京津冀协同发展,今
年2月下旬专程到北京市调研考察,并发表重要讲话,从做好北京发展和管理工作、推动京
津冀协同发展两个方面进行了深刻阐述。">
<word id="" cont="习" />
<word id="" cont="近平" />
<word id="" cont="总书记" />
<word id="" cont="高度" />
<word id="" cont="重视" />
<word id="" cont="北京" />
<word id="" cont="发展" />
<word id="" cont="和" />
<word id="" cont="京" />
<word id="" cont="津" />
<word id="" cont="冀" />
<word id="" cont="协同" />
<word id="" cont="发展" />
<word id="" cont="," />
<word id="" cont="今年" />
<word id="" cont="2月" />
<word id="" cont="下旬" />
<word id="" cont="专程" />
<word id="" cont="到" />
<word id="" cont="北京市" />
<word id="" cont="调研" />
<word id="" cont="考察" />
<word id="" cont="," />
<word id="" cont="并" />
<word id="" cont="发表" />
<word id="" cont="重要" />
<word id="" cont="讲话" />
<word id="" cont="," />
<word id="" cont="从" />
<word id="" cont="做好" />
<word id="" cont="北京" />
<word id="" cont="发展" />
<word id="" cont="和" />
<word id="" cont="管理" />
<word id="" cont="工作" />
<word id="" cont="、" />
<word id="" cont="推动" />
<word id="" cont="京" />
<word id="" cont="津" />
<word id="" cont="冀" />
<word id="" cont="协同" />
<word id="" cont="发展" />
<word id="" cont="两" />
<word id="" cont="个" />
<word id="" cont="方面" />
<word id="" cont="进行" />
<word id="" cont="了" />
<word id="" cont="深刻" />
<word id="" cont="阐述" />
<word id="" cont="。" />
</sent>
<sent id="" cont="会议指出,习xx总书记的重要讲话,对于实现京津冀
优势互补、促进环渤海经济区发展、带动北方腹地发展,意义重大、影响深远,要认真学习
,深刻领会。">
<word id="" cont="会议" />
<word id="" cont="指出" />
<word id="" cont="," />
<word id="" cont="习xx" />
<word id="" cont="总书记" />
<word id="" cont="的" />
<word id="" cont="重要" />
<word id="" cont="讲话" />
<word id="" cont="," />
<word id="" cont="对于" />
<word id="" cont="实现" />
<word id="" cont="京" />
<word id="" cont="津" />
<word id="" cont="冀" />
<word id="" cont="优势" />
<word id="" cont="互补" />
<word id="" cont="、" />
<word id="" cont="促进" />
<word id="" cont="环" />
<word id="" cont="渤海" />
<word id="" cont="经济区" />
<word id="" cont="发展" />
<word id="" cont="、" />
<word id="" cont="带动" />
<word id="" cont="北方" />
<word id="" cont="腹地" />
<word id="" cont="发展" />
<word id="" cont="," />
<word id="" cont="意义" />
<word id="" cont="重大" />
<word id="" cont="、" />
<word id="" cont="影响" />
<word id="" cont="深远" />
<word id="" cont="," />
<word id="" cont="要" />
<word id="" cont="认真" />
<word id="" cont="学习" />
<word id="" cont="," />
<word id="" cont="深刻" />
<word id="" cont="领会" />
<word id="" cont="。" />
</sent>
<sent id="" cont="会议提出,国土资源部门要进一步解放思想,加大改革
创新力度,">
<word id="" cont="会议" />
<word id="" cont="提出" />
<word id="" cont="," />
<word id="" cont="国土" />
<word id="" cont="资源" />
<word id="" cont="部门" />
<word id="" cont="要" />
<word id="" cont="进一步" />
<word id="" cont="解放思想" />
<word id="" cont="," />
<word id="" cont="加大" />
<word id="" cont="改革" />
<word id="" cont="创新" />
<word id="" cont="力度" />
<word id="" cont="," />
</sent>
</para>
</doc>
</xml4nlp>

LTP 分词算法实践的更多相关文章

  1. 【NLP】中文分词:原理及分词算法

    一.中文分词 词是最小的能够独立活动的有意义的语言成分,英文单词之间是以空格作为自然分界符的,而汉语是以字为基本的书写单位,词语之间没有明显的区分标记,因此,中文词语分析是中文信息处理的基础与关键. ...

  2. Mmseg中文分词算法解析

    Mmseg中文分词算法解析 @author linjiexing 开发中文搜索和中文词库语义自己主动识别的时候,我採用都是基于mmseg中文分词算法开发的Jcseg开源project.使用场景涉及搜索 ...

  3. IK分词算法设计总结

    IK分词算法设计思考 加载词典 IK分词算法初始化时加载了“敏感词”.“主词典”.“停词”.“量词”,如果这些词语的数量很多,怎么保证加载的时候内存不溢出 分词缓冲区 在分词缓冲区中进行分词操作,怎么 ...

  4. 中文分词算法之最大正向匹配算法(Python版)

    最大匹配算法是自然语言处理中的中文匹配算法中最基础的算法,分为正向和逆向,原理都是一样的. 正向最大匹配算法,故名思意,从左向右扫描寻找词的最大匹配. 首先我们可以规定一个词的最大长度,每次扫描的时候 ...

  5. 机器学习算法实践:Platt SMO 和遗传算法优化 SVM

    机器学习算法实践:Platt SMO 和遗传算法优化 SVM 之前实现了简单的SMO算法来优化SVM的对偶问题,其中在选取α的时候使用的是两重循环通过完全随机的方式选取,具体的实现参考<机器学习 ...

  6. 算法实践——舞蹈链(Dancing Links)算法求解数独

    在“跳跃的舞者,舞蹈链(Dancing Links)算法——求解精确覆盖问题”一文中介绍了舞蹈链(Dancing Links)算法求解精确覆盖问题. 本文介绍该算法的实际运用,利用舞蹈链(Dancin ...

  7. 浅谈分词算法(5)基于字的分词方法(bi-LSTM)

    目录 前言 目录 循环神经网络 基于LSTM的分词 Embedding 数据预处理 模型 如何添加用户词典 前言 很早便规划的浅谈分词算法,总共分为了五个部分,想聊聊自己在各种场景中使用到的分词方法做 ...

  8. 浅谈分词算法(4)基于字的分词方法(CRF)

    目录 前言 目录 条件随机场(conditional random field CRF) 核心点 线性链条件随机场 简化形式 CRF分词 CRF VS HMM 代码实现 训练代码 实验结果 参考文献 ...

  9. 浅谈分词算法(3)基于字的分词方法(HMM)

    目录 前言 目录 隐马尔可夫模型(Hidden Markov Model,HMM) HMM分词 两个假设 Viterbi算法 代码实现 实现效果 完整代码 参考文献 前言 在浅谈分词算法(1)分词中的 ...

随机推荐

  1. 转-[Python 学习]2.5版yield之学习心得

    在 shhgs 发布了关于< Py 2.5 what’s new 之 yield>之后,原来我不是特别关注 yield 的用法,因为对于2.3中加入的yield相对来说功能简单,它是作为一 ...

  2. Keil C中全局变量的使用

    在KEIL C中,有多个源文件使用到全局变量时,可以在一个源文件中定义全局变量,在另外的源文件中用extern 声明该变量,说明该变量定义在别的文件中,将其作用域扩展到此文件. 例如:有以下两个源文件 ...

  3. wcf双工通讯遇到的问题

    1.向ChannelFactory提供的InstanceContext包含未实现CallbackContractType的问题 通过添加服务引用生成的客户端代码, public class Callb ...

  4. leetcode Longest Common Prefix 多个字符串的最长字串

    public class Solution { public String get(String a,String b) { if(a==""||b=="") ...

  5. bzoj 1188 [HNOI2007]分裂游戏(SG函数,博弈)

    1188: [HNOI2007]分裂游戏 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 733  Solved: 451[Submit][Status ...

  6. UVA 11762 Race to 1(记忆化+期望)

    题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=20869 [思路] DP+期望. 设f[x]表示从x转移到1的期望操 ...

  7. [zz]android的logcat详细用法

    Android日志系统提供了记录和查看系统调试信息的功能.日志都是从各种软件和一些系统的缓冲区中记录下来的,缓冲区可以通过 logcat 命令来查看和使用.      一.使用logcat命令的目的: ...

  8. Service的两种启动方法

    刚才看到一个ppt,介绍service的两种启动方法以及两者之间的区别. startService 和 bindService startService被形容为我行我素,而bindService被形容 ...

  9. springmvc报错 org.springframework.web.servlet.DispatcherServlet

    在写springMVC时,导入所有需要的包后,运行程序,控制台报以下错误: 严重: Servlet [springDispatcherServlet] in web application [/Spr ...

  10. SQL 存储过程 分页 分类: SQL Server 2014-05-16 15:11 449人阅读 评论(0) 收藏

    set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go -- ============================================= -- Au ...