`

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

阅读更多

安装在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 协议 的 开源 中文 分词 系统

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics