摘要: 朴素贝叶斯应用文本分类的文章,网络上有很多例子。笔者认为比较典型有:洞庭散人先生的文章(http://www.cnblogs.com/phinecos/archive/2008/10/21/1315948.htmljava版);Liang Guo的文章(http://grepk.com/?p=704python版)waemz先生的文章(http://www.cnblogs.com/waemz/archive/2009/02/25/1397647.htmlC#版) 笔者不才,这个系列的文章是本人最近的学习笔记: 一、python与中文分词 二、用python调用ICTCLAS50进行中文分词 . 阅读全文
posted @ 2012-02-03 16:26 app_ 阅读(1061) 评论(0) 推荐(0) 编辑
摘要: 因项目需要输出中文统计图,选择matplotlib还不错。在其中使用中文发现有些问题。在网上找到的解决方案还不错。一、找到c:\python24\lib\site-packages\matplotlib\mpl-data\matplotlibrc (修改font.sans-serif、verbose.level两行代码)1、找到了matplotlibrc设置文件,是个文本文件,随便找个编辑器打开它,找到font.sans-serif一行,将后边直接改成一个nothing;(把 “:”后的“#......”都去掉)2、找到verbose.level一行,把默认的silent改成debug.二、找 阅读全文
posted @ 2012-04-23 14:46 app_ 阅读(3553) 评论(0) 推荐(0) 编辑
摘要: 我用操作系统是winxp sp2第一步:下载并安装python2.5(注:不管我用rdflib2.4.1还是2.4.2 + python2.6 安装是总是有问题,改成了python2.5就可以) 设置环境变量:path中添加:X:\Python25;(X代表安装python2.5时的路径)第二步:下载并安装mingw5.13(下载地址:http://prdownloads.sourceforge.net/mingw (MinGW-5.1.3.exe)) 安装时选择:MinGW base tools g++ compiler MinGW Make 设置环境变量:path中添加:X:\MinGW\ 阅读全文
posted @ 2012-02-24 13:46 app_ 阅读(482) 评论(0) 推荐(0) 编辑
摘要: Part 4 - Clustering by Color用颜色聚类We can also turnthe numbers into colors. For instance, here is a color display that correspondsto the first 3 dimensions of the Titles matrix that we showed above. Itcontains exactly the same information, except that blue shows negative numbers,red shows positive num 阅读全文
posted @ 2012-02-02 16:03 app_ 阅读(1712) 评论(0) 推荐(0) 编辑
摘要: Part 2 - Modify the Counts with TFIDF计算TFIDF替代简单计数In sophisticated Latent Semantic Analysis systems, the raw matrix countsare usually modified so that rare words are weighted more heavily than commonwords. For example, a word that occurs in only 5% of the documents shouldprobably be weighted more he 阅读全文
posted @ 2012-02-02 15:51 app_ 阅读(1668) 评论(1) 推荐(0) 编辑
摘要: 译:http://www.puffinwarellc.com/index.php/news-and-articles/articles/33.htmlWangBen 2011-09-16 beijing潜语义分析LSA介绍Latent Semantic Analysis (LSA), also known as Latent Semantic Indexing (LSI) literally means analyzing documents to find the underlying meaning or concepts of those documents. If each word 阅读全文
posted @ 2012-02-02 15:47 app_ 阅读(2925) 评论(0) 推荐(0) 编辑
摘要: 基于python的中文分词的实现及应用刘新亮 严姗姗(北京工商大学计算机学院,100037) 摘 要 中文分词的实现及应用属于自然语言处理范畴,完成的是中文分词在Python语言环境下的实现,以及利用这个实现的一个应用程序接口和一个中文文本处理的应用。设计共分为五个部分,分别是:分词模块、包装模块、应用程序接口、Nonsense模块,这个项目是为了下一步开放源代码的中文搜索引擎提供中文分词功能,同时通过表现代码的娱乐性达到促进公开源代码的发展。 关键词 中文分词;Python语言;程序接口1 引言 自然语言处理是研究实现人与计算机之间用自然语言进行有效通信的各种理论和方法的一个领域,是计算机科 阅读全文
posted @ 2012-02-02 15:20 app_ 阅读(16180) 评论(0) 推荐(0) 编辑
摘要: Python比较字符串大小时,根据的是ord函数得到的编码值。基于它的排序函数sort可以很容易为数字和英文字母排序,因为它们在编码表中就是顺序排列的。>> print ','< '1'<'A'<'a'<'阿'True但要很处理中文就没那么容易了。中文通常有拼音和笔画两种排序方式,在最常用中文标准字符集GB2312中,3755个一级中文汉字是按照拼音序进行编码的,而3008个二级汉字则是按部首笔画排列,>> print '曙'< '鲑&# 阅读全文
posted @ 2012-02-02 15:19 app_ 阅读(8346) 评论(0) 推荐(0) 编辑
摘要: 直接上源码吧tokenizer类:#_*_encoding:utf-8_*_from ctypes import *class tokenizer: def __init__(self): self._stext=['、','“','”',',','。','《','》',':',';','!','‘','’','?','?','!','·& 阅读全文
posted @ 2012-01-07 11:36 app_ 阅读(2619) 评论(1) 推荐(0) 编辑