安装试用基于HTTP协议的开源中文分词系统“HTTPCWS”

Friday, January 29, 2010

官方程序地址

安装在ubuntu9.10上:

cd /usr/local
sudo wget http://httpcws.googlecode.com/files/httpcws-1.0.0-i386-bin.tar.gz
sudo su
tar zxvf 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/ -p 2009

测试效果:

#!/usr/bin/env python
#encoding: utf-8
import urllib
def main():
    title = u'基于HTTP协议的开源中文分词系统'.encode('gbk','replace')
    data = urllib.urlencode({'w':title})
    url = 'http://192.168.15.50:2009/?%s'%data
    body = urllib.urlopen(url)
    print body.read().decode('gbk','replace')
if name == 'main':
    main()

输出结果:基于 HTTP 协议 的 开源 中文 分词 系统

This entry was tagged Python and Segmentation

comments powered by Disqus

© 2009-2013 lxneng.com. All rights reserved. Powered by Pyramid

go to Top