发布版本:
  httpcws 1.0.0 (最新版本:2009-08-10发布)

  程序网址:http://code.google.com/p/httpcws

  安装使用手册:http://blog.zyan.cc/httpcws_v100/

  下载地址(32位版):http://httpcws.googlecode.com/files/httpcws-1.0.0-i386-bin.tar.gz

  下载地址(64位版):http://httpcws.googlecode.com/files/httpcws-1.0.0-x86_64-bin.tar.gz

  中文分词在线演示:http://blog.zyan.cc/demo/httpcws/

  PHP演示程序下载:http://blog.zyan.cc/demo/httpcws/httpcws-php-demo.zip



  httpcws 中文简介
  1、什么是 httpcws ?
  HTTPCWS 是一款基于HTTP协议的开源中文分词系统,目前仅支持Linux系统。HTTPCWS 使用“ICTCLAS 3.0 2009共享版中文分词算法”的API进行分词处理,得出分词结果。HTTPCWS 将取代本人之前开发的 PHPCWS 中文分词扩展

  ICTCLAS(Institute of Computing Technology, Chinese Lexical Analysis System)是中国科学院计算技术研究所在多年研究工作积累的基础上,基于多层隐马模型研制出的汉语词法分析系统,主要功能包括中文分词;词性标注;命名实体识别;新词识别;同时支持用户词典。ICTCLAS经过五年精心打造,内核升级6次,目前已经升级到了ICTCLAS3.0,分词精度98.45%,各种词典数据压缩后不到3M。ICTCLAS在国内973专家组组织的评测中活动获得了第一名,在第一届国际中文处理研究机构SigHan组织的评测中都获得了多项第一名,是当前世界上最好的汉语词法分析器。

  ICTCLAS 3.0 商业版是收费的,而免费提供的 ICTCLAS 3.0 共享版不开源,词库是根据人民日报一个月的语料得出的,很多词语不存在。所以本人补充的一个19万条词语的自定义词库,对ICTCLAS分词结果进行合并处理,输出最终分词结果。

  由于 ICTCLAS 3.0 2009 共享版只支持GBK编码,因此,如果是UTF-8编码的字符串,可以先用iconv函数转换成GBK编码,再用httpcws进行分词处理,最后转换回UTF-8编码。

  HTTPCWS 软件自身(包括httpcws.cpp源文件、dict/httpcws_dict.txt自定义词库)采用NewBSD开源协议,可以自由修改。HTTPCWS 使用的 ICTCLAS 共享版 API 及 dict/Data/ 目录内的语料库,版权及著作权归中国科学院计算技术研究所、ictclas.org所有,使用需遵循其相关协议。



  2、httpcws 中文分词在线演示
  演示网址:http://blog.zyan.cc/demo/httpcws/



  3、httpcws 中文分词下载安装
  32位版:
cd /usr/local/
wget http://httpcws.googlecode.com/files/httpcws-1.0.0-i386-bin.tar.gz
tar zxvf httpcws-1.0.0-i386-bin.tar.gz
rm -f httpcws-1.0.0-i386-bin.tar.gz
cd httpcws-1.0.0-i386-bin/
ulimit -SHn 65535
/usr/local/httpcws-1.0.0-i386-bin/httpcws -d -x /usr/local/httpcws-1.0.0-i386-bin/dict/


  64位版:
cd /usr/local/
wget http://httpcws.googlecode.com/files/httpcws-1.0.0-x86_64-bin.tar.gz
tar zxvf httpcws-1.0.0-x86_64-bin.tar.gz
rm -f httpcws-1.0.0-x86_64-bin.tar.gz
cd httpcws-1.0.0-x86_64-bin/
ulimit -SHn 65535
/usr/local/httpcws-1.0.0-x86_64-bin/httpcws -d -x /usr/local/httpcws-1.0.0-x86_64-bin/dict/


  命令行启动参数:

  点击在新窗口中浏览此图片



  4、httpcws 使用方法
  GET方法(文本长度受URL的长度限制,需要分词的文本为GBK编码,最好采用urlencode对文本进行编码):


  POST方法(文本长度无限制,适用于大文本分词,需要分词的文本为GBK编码,最好采用urlencode对文本进行编码):
curl -d "有人的地方就有江湖" http://192.168.8.42:1985
curl -d "%D3%D0%C8%CB%B5%C4%B5%D8%B7%BD%BE%CD%D3%D0%BD%AD%BA%FE" http://192.168.8.42:1985


  PHP 调用 HTTPCWS 示例:

  ①、对GBK编码的字符串进行中文分词处理(HTTP POST方式):
<?php
@header('Content-Type: text/html; charset=gb2312');
$text = "有人的地方就有江湖";
$text = urlencode($text);
$opts = array(
  'http'=>array(
    'method'=>"POST",
    'header'=>"Content-type: application/x-www-form-urlencoded\r\n".
              "Content-length:".strlen($data)."\r\n" .
              "Cookie: foo=bar\r\n" .
              "\r\n",
    'content' => $text,
  )
);
$context = stream_context_create($opts);
$result = file_get_contents("http://127.0.0.1:1985", false, $context);
echo $result;
?>


  ②、对UTF-8编码的字符串进行中文分词处理(HTTP POST方式):
<?php
@header('Content-Type: text/html; charset=utf-8');
$text = "有人的地方就有江湖";
$text = iconv("UTF-8", "GBK//IGNORE", $text);
$text = urlencode($text);
$opts = array(
  'http'=>array(
    'method'=>"POST",
    'header'=>"Content-type: application/x-www-form-urlencoded\r\n".
              "Content-length:".strlen($data)."\r\n" .
              "Cookie: foo=bar\r\n" .
              "\r\n",
    'content' => $text,
  )
);
$context = stream_context_create($opts);
$result = file_get_contents("http://127.0.0.1:1985", false, $context);
$result = iconv("GBK", "UTF-8//IGNORE", $result);
echo $result;
?>


  ③、对GBK编码的字符串进行中文分词处理(HTTP GET方式):
<?php
@header('Content-Type: text/html; charset=gb2312');
$text = "有人的地方就有江湖";
$text = urlencode($text);
$result = file_get_contents("http://127.0.0.1:1985/?w=".$text);
echo $result;
?>


  ④、对UTF-8编码的字符串进行中文分词处理(HTTP GET方式):
<?php
@header('Content-Type: text/html; charset=utf-8');
$text = "有人的地方就有江湖";
$text = iconv("UTF-8", "GBK//IGNORE", $text);
$text = urlencode($text);
$result = file_get_contents("http://127.0.0.1:1985/?w=".$text);
$result = iconv("GBK", "UTF-8//IGNORE", $result);
echo $result;
?>




  5、httpcws 分词速度及用途

  局域网内 HTTPCWS 接口中文分词平均处理速度(Wait时间):0.001秒。HTTPCWS 基于 libevent + epoll 网络IO模型开发,经测试,每秒可处理5000~20000次请求。

  点击在新窗口中浏览此图片

  HTTPCWS 属于《[http://blog.zyan.cc/post/385.htm 亿级数据的高并发通用搜索引擎架构设计]》的一部分,用作“搜索查询接口”的关键字分词处理。在此架构中,Sphinx索引引擎对于CJK(中日韩)语言支持一元切分,假设【反恐行动是国产主视角射击网络游戏】这段文字,Sphinx会将其切成【反 恐 行 动 是 国 产 主 视 角 射 击 网 络 游 戏】,然后对每个字建立反向索引。如果用这句话中包含的字组成一个不存在的词语,例如【恐动】,也会被搜索到,所以搜索时,需要加引号,例如搜索【"反恐行动"】,就能完全匹配连在一起的四个字,不连续的【"恐动"】就不会被搜索到。但是,这样还有一个问题,搜索【"反恐行动游戏"】或【"国产网络游戏"】就会搜索不到。所以,我在搜索层写了个PHP中文分词扩展,搜索“反恐行动游戏”、“国产网络游戏”,会被httpcws中文分词函数分别切分为“反恐行动 游戏”、“国产 网络游戏”,这时候,用PHP函数给以空格分隔的词语加上引号,去搜索【"反恐行动" "游戏"】或【"国产" "网络游戏"】,就能搜索到这条记录了。由于httpcws位于搜索层,中文分词词库发生增、删、改,只需重启httpcws进程即可,无需重建搜索索引。

  根据上述情况,对于那些采用二元交叉切分的搜索引擎,httpcws用在前端搜索层对用户输入的搜索关键字、短语进行分词处理,同样适合。httpcws开发的目的正在于此,对于短句、小文本中文分词切分,速度非常之快。



  6、自定义词库
  修改dict/httpcws_dict.txt文件,可以自由增加自己需要的词语。重启httpcws即可生效。





技术大类 » 搜索引擎技术 | 评论(409) | 引用(1) | 阅读(160264)
take my online exam for me Email Homepage
2021-9-5 19:06
Don't be too concerned now if you suffer from the homework problem and are too concerned with your studies as a student. There are many options for solving this problem; Pay Someone To Do My Homework is one of them. When the Internet makes it simple and workable, you're so concerned in the digital era. Just ask someone to do your homework to get rid of all your problems,  take my online exam for mehttps://www.allassignmenthelp.com/pay-someone-to-take-my-online-exam-for-me.html
pg slot auto Email Homepage
2021-9-15 17:36
Play this game make free money, free credit, free trial, win real money, play online games. World-class web, long fun, fun guaranteed.
pg Email Homepage
2021-9-15 21:06
pg Email Homepage
2021-9-15 21:13
เราคือผู้ให้บริการเกมสล็อตออนไลน์อันดับหนึ่ง pg slot game เกมสล็อตออนไลน์มาแรง 2021 สล็อตออนไลน์น่าเล่น เกมใหม่มาแรง ที่เราได้คัดสรรมารวมไว้ที่เดียวให้คุณได้สัมผัสก่อนใคร สุดยอดเกมทีทันสมัย
pg Email Homepage
2021-9-15 21:20
ทดลองเล่นสล็อตทุกค่าย ตัวเกมทดลองเล่น สล็อตออนไลน์ ที่มีเกมสล็อตคุณภาพดี ๆ อย่างมากมาย ทดลองเล่นสล็อตฟรีทุกค่าย โดยเฉพาะเกมสล็อตออนไลน์ จากค่าย PG SLOT แต่ค่ายเกมอื่นก็ไม่น้อยหน้ากัน มีเกมสล็อตออนไลน์ดัง ๆ อย่างมากมาย
pg Email Homepage
2021-9-15 21:22
ทดลองเล่นสล็อตทุกค่าย ตัวเกมทดลองเล่น สล็อตออนไลน์ ที่มีเกมสล็อตคุณภาพดี ๆ อย่างมากมาย ทดลองเล่นสล็อตฟรีทุกค่าย โดยเฉพาะเกมสล็อตออนไลน์ จากค่าย PG SLOT แต่ค่ายเกมอื่นก็ไม่น้อยหน้ากัน มีเกมสล็อตออนไลน์ดัง ๆ อย่างมากมาย
pg Email Homepage
2021-9-15 21:22
PG แตกง่าย 2021 เกมส์ PGSLOT GAME แตกง่ายที่เล่นได้จริง เว็บสล็อต pg แตกง่าย 2021 เว็บสล็อต pg แตกง่าย 2021 เว็บที่มีความนิยมมากที่สุดในเวลานี้ ที่มีคนเล่นมากที่สุด และแจ็คพอตแตกง่าย แตกบ่อยมาก โบนัสก็มีมากมายเลยทีเดียว
pg Email Homepage
2021-9-15 21:24
สูตรสแกนสล็อต pgฟรี และยังทำให้เราเสียเงินอีกด้วย พร้อมกับอาการหัวร้อนตามมาถ้าเราได้มีการจัดการเล่นที่ดี มีโปรแกรมช่วยในการเล่นสล็อต โอกาสที่เราจะทำกำไรได้จากการเล่น PGSLOT นั้น ก็คงไม่ใช่เรื่องยากอีกต่อไปแล้ว สูตรสล็อต pg
joker123
2021-9-23 13:26
<a href="https://joker123-download.net/">ทางเข้าjoker123</a> Easy to apply for membership with us, get free credits, free bonuses anytime, anywhere in top-up. There are promotions for both new and old members. Deposit and withdraw with an automatic system, do not waste time waiting for a long time. SLOTSUPERWALLET.COM, a new online slot website that is ready to serve you 24 hours a day, will have a service to respond to all problems and questions from the administrators quickly.
Joker123 Homepage
2021-9-23 16:39
<a href="https://joker123-download.net/">ดาวน์โหลดjoker123</a> , mobile online slots games that can be played for real money No minimum deposit Each game has many interesting things. Whether it's game graphics, background music, rules of play There are also a variety of winning styles and a full range of games to choose from.
Joker123 Homepage
2021-9-25 15:44
A mobile online slots game provider with a variety of games to choose from. It is a new type of game that allows players to win real money. <a href="https://joker123-download.net/">ดาวน์โหลดjoker123</a>  easy game play There is a tutorial on how to play online slots games for beginners. Beautiful graphics in every game Make it not boring and exciting with unique in-game effects. Become a new millionaire with the most frequent jackpot online slots game. Even small bets get rewards.
fullslot com สมัคร Email Homepage
2021-9-25 16:47
Free credit, free trial, win real money Play this game make money free
fullslot com สมัคร Email Homepage
2021-9-25 16:49
Popular slot websites that are easy to play, easy to break, have a chance to win big prizes, get rich easily Apply for free credit  fullslot com สมัคร
fullslot com สมัคร Email Homepage
2021-9-25 16:51
Popular slot websites that are easy to play, easy to break, have a chance to win big prizes, get rich easily Apply for free credit fullslot com สมัคร
fullslot com สมัคร Email Homepage
2021-9-25 16:53
Popular slot websites that are easy to play, easy to break, have a chance to win big prizes, get rich easily Apply for free credit   fullslot com สมัคร
fullslot com สมัคร Email Homepage
2021-9-25 16:57
Apply now, free credit, can play for a long time, slots, good deeds, popular, there are many games. fullslot com สมัคร
fullslot com สมัคร Email Homepage
2021-9-25 16:59
Apply now, free credit, can play for a long time, slots, good deeds, popular, there are many games.  fullslot com สมัคร
fullslot com สมัคร Email Homepage
2021-9-25 17:00
Good web slots, free credit, free play, free trial Free credit, free trial, win real money Play this game make money free  fullslot com สมัคร
ทางเข้า joker Email Homepage
2021-9-27 06:47
pgslot Email Homepage
2021-10-11 17:32
pgslot  Thank you for giving me the opportunity to read good articles from your website.
分页: 7/21 第一页 上页 2 3 4 5 6 7 8 9 10 11 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]