- 浏览: 222819 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
synack:
写的很好,图文并茂,语言简单清晰,赞!
SkipList 跳表 -
king_c:
jiandandecaicai 写道你好,请教一下是如何通过E ...
从Hadoop URL 中读取数据 -
jiandandecaicai:
你好,请教一下是如何通过Eclipse来连接Hadop机群的, ...
从Hadoop URL 中读取数据
HTTP返回码中301与302的区别
- 博客分类:
- http
<p><span style="font-family: Arial; font-size: 14px; color: #333333; line-height: 26px;">
<p>支持向量机(Support Vector Machine)是Cortes和Vapnik于1995年首先提出的,它在解决<strong>小样本</strong> 、<strong>非线性</strong>及<strong>高维模式识别</strong> 中表现出许多特有的优势,并能够推广应用到函数拟合等其他机器学习问题中。支持向量机方法是建立在统计学习理论的<strong>VC 维理论和结构风险最小</strong> 原理基础上的,根据有限的样本信息在模型的复杂性(即对特定训练样本的学习精度,Accuracy)和学习能力(即无错误地识别任意样本的能力)之间寻求最佳折衷,以期获得最好的推广能力(或称泛化能力)。SVM理论的学习,请参考<a style="color: #336699; text-decoration: none;" href="http://www.blogjava.net/zhenandaci/category/31868.html">jasper的博客</a> 。</p>
<p> LIBSVM 是台湾大学林智仁(Chih-Jen Lin)博士等开发设计的一个操作简单、易于使用、快速有效的通用 SVM 软件包,可以解决分类问题(包括 C−SVC 、ν−SVC ), 回归问题(包括 ε − SVR 、v− SVR ) 以及分布估计(one − class − SVM ) 等问题,提供了线性、多项式、径向基和 S 形函数四种常用的核函数供选择,可以有效地解决多类问题、交叉验证选择参数、对不平衡样本加权、多类问题的概率估计等。<a style="color: #336699; text-decoration: none;" href="http://www.csie.ntu.edu.tw/~cjlin/libsvm/">LIBSVM</a> 是一个开源的软件包,。他不仅提供了 LIBSVM 的 C++语言的算法源代码,还提供了 Python、Java、R、MATLAB、Perl、Ruby、LabVIEW以及 C#.net 等各种语言的接口,可以方便的在 Windows 或 UNIX 平台下使用,也便于科研工作者根据自己的需要进行改进(譬如设计使用符合自己特定问题需要的核函数等)。</p>
<p> 文本分类,大致分为如下几件事情:<strong>样本</strong> ,<strong>分词</strong> ,<strong>特征提取</strong> ,<strong>向量计算</strong> ,<strong>分类训练</strong> ,<strong>测试和调试</strong> 。</p>
<p> </p>
<p><span style="font-size: medium;"><strong>1.样本选择</strong></span></p>
<p>搜狗语料 <a style="color: #336699; text-decoration: none;" href="http://www.sogou.com/labs/dl/c.html">http://www.sogou.com/labs/dl/c.html</a> ,下精简版吧,如果实验用用,这足够了,你要下107M的也可以。当然,你也可以自己找语料,不过麻烦点而已,把各大门户网站的对应频道下的文章都爬下来。</p>
<p> </p>
<p><span style="font-size: medium;">2.<strong>分词</strong></span></p>
<p>Bamboo分词,这是基于CRF++的分词模块,既然是研究统计学习,分词也得用基于统计的不是,如果还是用一字典来分词,那就太out啦。</p>
<p><a style="color: #336699; text-decoration: none;" href="http://code.google.com/p/nlpbamboo/wiki/GettingStarted">http://code.google.com/p/nlpbamboo/wiki/GettingStarted</a> 。安装完毕bamboo,还要下载训练好的模型(这个模型是基于人民日报1月语料)</p>
<p><a style="color: #336699; text-decoration: none;" href="http://code.google.com/p/nlpbamboo/downloads/list">http://code.google.com/p/nlpbamboo/downloads/list</a> ,下载index.tar.bz2, 解压到/opt/bamboo/index下。</p>
<p>因为咱主要目的是研究分类,不是分词,就不要去搞分词的训练了,如果想训练可以看我的另外一篇博客:<a style="color: #336699; text-decoration: none;" href="http://blog.csdn.net/marising/archive/2010/07/27/5769653.aspx">CRF++中文分词指南</a> 。</p>
<p>可以试试:/opt/bamboo/bin/bamboo -p crf_seg filename,如果成功证明装好了。</p>
<p> 稍微注意以下,搜狗的词库是gb2312的,所以,请转为utf8,再分词,这是python写的函数:输入一个文件名,转为utf8,再分词,分词文件以.seg为后缀。</p>
<div class="dp-highlighter bg_python" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #e7e5dc; width: 687px; margin-top: 18px !important; margin-right: 0px !important; margin-bottom: 18px !important; margin-left: 0px !important; padding-top: 1px;">
<div class="bar" style="padding-left: 45px;">
<div class="tools" style=""><a class="ViewSource" style="" title="view plain" href="http://blog.csdn.net/marising/article/details/5844063#">view plain</a></div>
</div>
<ol class="dp-py" style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 1px !important; margin-left: 45px !important; background-color: #ffffff; color: #5c5c5c; padding: 0px;">
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">def</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> seg(fn): </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">not</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> os.path.isfile(fn+</span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'.utf8'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">): </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> cmd = <span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'iconv -f gb2312 -t utf8 -c %s > %s.utf8'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> %(fn,fn) </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">print</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> cmd </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> os.system(cmd) </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> cmd = <span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'/opt/bamboo/bin/bamboo -p crf_seg %s.utf8 > %s.seg'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> % (fn,fn) </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">print</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> cmd </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> os.system(cmd) </span></li>
</ol>
</div>
<p> </p>
<p>分词结果如下:</p>
<p>一 家 刚刚 成立 两 年 的 网络 支付 公司 , 它 的 目标 是 成为 市值 100亿 美元 的 上市 公司 。<br>这家 公司 叫做 快 钱 , 说 这 句 话 的 是 快钱 的 CEO 关 国光 。 他 之前 曾 任 网易 的 高级 副 总裁 , 负责 过 网易 的 上市 工作 。 对于 为什么 选择 第三 方 支付 作为 创业 方向 , 他 曾经 对 媒体 这样 说 : “ 我 能 看到 这个 胡同 对面 是 什么 , 别人 只能 看到 这个 胡同 。 ” 自信 与 狂妄 只 有 一 步 之 遥 ―― 这 几乎 是 所有 创业者 的 共同 特征 , 是 自信 还是 狂妄 也许 需要 留待 时间 来 考证 。</p>
<p> </p>
<p><span style="font-size: medium;"><strong>3.特征提取</strong></span></p>
<p> svm不是在高维模式识别具有优势吗,咋还要特征提取呢,把所有词都当成特征不就行了吗?对于词库来说,十几万的词是很常见的,把对类别区分度(GDP,CPI,股票对经济类的区分度就高,其他一些高频词,如我们,大家,一起等就没有区分度)高的词挑选出来,一来可以减少计算量,二来应该是可以提高分类效果。</p>
<p> 据说,开方检验(CHI)信息增益(IG)对于挑选特征好,我选择的是CHI。两者的概念,请google。</p>
<p> 首先统计词在文档中的次数</p>
<p> </p>
<div class="dp-highlighter bg_python" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #e7e5dc; width: 687px; margin-top: 18px !important; margin-right: 0px !important; margin-bottom: 18px !important; margin-left: 0px !important; padding-top: 1px;">
<div class="bar" style="padding-left: 45px;">
<div class="tools" style=""><a class="ViewSource" style="" title="view plain" href="http://blog.csdn.net/marising/article/details/5844063#">view plain</a></div>
</div>
<ol class="dp-py" style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 1px !important; margin-left: 45px !important; background-color: #ffffff; color: #5c5c5c; padding: 0px;">
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="comment" style="color: #008200; background-color: inherit; padding: 0px; margin: 0px;">#ingore some term</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">def</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> ingore(s): </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">return</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'nbsp'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">' '</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">' '</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'/t'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'/n'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">','</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'。'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'!'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'、'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'―'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">/ </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'?'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'@'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">':'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'#'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'%'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'&'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'('</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">')'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'《'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'》'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'['</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">']'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'{'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'}'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'*'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">','</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'.'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'&'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'!'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'?'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">':'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">';'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">/ </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'-'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'&'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">/ </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'<'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'>'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'('</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">')'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'['</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">']'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'{'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'}'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="comment" style="color: #008200; background-color: inherit; padding: 0px; margin: 0px;">#term times</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">def</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> getterm(fn): </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> fnobj = open(fn,<span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'r'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">) </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> data = fnobj.read() </span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> fnobj.close() </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> arr = data.split(<span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">' '</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">) </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> docterm = dict() </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">for</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> a </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">in</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> arr: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> a = a.strip(<span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">' /n/t'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">) </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">not</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> ingore(a) </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">and</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> len( a.decode(</span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'utf-8'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">)) >=</span><span class="number" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">2</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> times = docterm.get(a) </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> times: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> docterm[a] = times + <span class="number" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">1</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">else</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> docterm[a] = <span class="number" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">1</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">return</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> docte </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="comment" style="color: #008200; background-color: inherit; padding: 0px; margin: 0px;">#cls_term:cls,term,artcount</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="comment" style="color: #008200; background-color: inherit; padding: 0px; margin: 0px;">#term_cls:term,cls,artcount</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">def</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> stat(</span><span class="special" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">cls</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">,fn,cls_term,term_cls): </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> docterm = getterm(fn) </span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> termdi = cls_term.get(<span class="special" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">cls</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">) </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">not</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> termdi: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> termdi = dict() </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> cls_term[<span class="special" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">cls</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">] = termdi </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="comment" style="color: #008200; background-color: inherit; padding: 0px; margin: 0px;">#term,times</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">for</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> t </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">in</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> docterm.iterkeys(): </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> artcount = termdi.get(t) </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">not</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> artcount: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> artcount = <span class="number" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">0</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> termdi[k] = artcount + <span class="number" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">1</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> clsdi = term_cls.get(t) </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">not</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> clsdi: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> clsdi = {} </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> term_cls[k] = clsdi </span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> artcount = clsdi.get(<span class="special" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">cls</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">) </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">not</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> artcount: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-ri
<p>支持向量机(Support Vector Machine)是Cortes和Vapnik于1995年首先提出的,它在解决<strong>小样本</strong> 、<strong>非线性</strong>及<strong>高维模式识别</strong> 中表现出许多特有的优势,并能够推广应用到函数拟合等其他机器学习问题中。支持向量机方法是建立在统计学习理论的<strong>VC 维理论和结构风险最小</strong> 原理基础上的,根据有限的样本信息在模型的复杂性(即对特定训练样本的学习精度,Accuracy)和学习能力(即无错误地识别任意样本的能力)之间寻求最佳折衷,以期获得最好的推广能力(或称泛化能力)。SVM理论的学习,请参考<a style="color: #336699; text-decoration: none;" href="http://www.blogjava.net/zhenandaci/category/31868.html">jasper的博客</a> 。</p>
<p> LIBSVM 是台湾大学林智仁(Chih-Jen Lin)博士等开发设计的一个操作简单、易于使用、快速有效的通用 SVM 软件包,可以解决分类问题(包括 C−SVC 、ν−SVC ), 回归问题(包括 ε − SVR 、v− SVR ) 以及分布估计(one − class − SVM ) 等问题,提供了线性、多项式、径向基和 S 形函数四种常用的核函数供选择,可以有效地解决多类问题、交叉验证选择参数、对不平衡样本加权、多类问题的概率估计等。<a style="color: #336699; text-decoration: none;" href="http://www.csie.ntu.edu.tw/~cjlin/libsvm/">LIBSVM</a> 是一个开源的软件包,。他不仅提供了 LIBSVM 的 C++语言的算法源代码,还提供了 Python、Java、R、MATLAB、Perl、Ruby、LabVIEW以及 C#.net 等各种语言的接口,可以方便的在 Windows 或 UNIX 平台下使用,也便于科研工作者根据自己的需要进行改进(譬如设计使用符合自己特定问题需要的核函数等)。</p>
<p> 文本分类,大致分为如下几件事情:<strong>样本</strong> ,<strong>分词</strong> ,<strong>特征提取</strong> ,<strong>向量计算</strong> ,<strong>分类训练</strong> ,<strong>测试和调试</strong> 。</p>
<p> </p>
<p><span style="font-size: medium;"><strong>1.样本选择</strong></span></p>
<p>搜狗语料 <a style="color: #336699; text-decoration: none;" href="http://www.sogou.com/labs/dl/c.html">http://www.sogou.com/labs/dl/c.html</a> ,下精简版吧,如果实验用用,这足够了,你要下107M的也可以。当然,你也可以自己找语料,不过麻烦点而已,把各大门户网站的对应频道下的文章都爬下来。</p>
<p> </p>
<p><span style="font-size: medium;">2.<strong>分词</strong></span></p>
<p>Bamboo分词,这是基于CRF++的分词模块,既然是研究统计学习,分词也得用基于统计的不是,如果还是用一字典来分词,那就太out啦。</p>
<p><a style="color: #336699; text-decoration: none;" href="http://code.google.com/p/nlpbamboo/wiki/GettingStarted">http://code.google.com/p/nlpbamboo/wiki/GettingStarted</a> 。安装完毕bamboo,还要下载训练好的模型(这个模型是基于人民日报1月语料)</p>
<p><a style="color: #336699; text-decoration: none;" href="http://code.google.com/p/nlpbamboo/downloads/list">http://code.google.com/p/nlpbamboo/downloads/list</a> ,下载index.tar.bz2, 解压到/opt/bamboo/index下。</p>
<p>因为咱主要目的是研究分类,不是分词,就不要去搞分词的训练了,如果想训练可以看我的另外一篇博客:<a style="color: #336699; text-decoration: none;" href="http://blog.csdn.net/marising/archive/2010/07/27/5769653.aspx">CRF++中文分词指南</a> 。</p>
<p>可以试试:/opt/bamboo/bin/bamboo -p crf_seg filename,如果成功证明装好了。</p>
<p> 稍微注意以下,搜狗的词库是gb2312的,所以,请转为utf8,再分词,这是python写的函数:输入一个文件名,转为utf8,再分词,分词文件以.seg为后缀。</p>
<div class="dp-highlighter bg_python" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #e7e5dc; width: 687px; margin-top: 18px !important; margin-right: 0px !important; margin-bottom: 18px !important; margin-left: 0px !important; padding-top: 1px;">
<div class="bar" style="padding-left: 45px;">
<div class="tools" style=""><a class="ViewSource" style="" title="view plain" href="http://blog.csdn.net/marising/article/details/5844063#">view plain</a></div>
</div>
<ol class="dp-py" style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 1px !important; margin-left: 45px !important; background-color: #ffffff; color: #5c5c5c; padding: 0px;">
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">def</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> seg(fn): </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">not</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> os.path.isfile(fn+</span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'.utf8'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">): </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> cmd = <span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'iconv -f gb2312 -t utf8 -c %s > %s.utf8'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> %(fn,fn) </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">print</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> cmd </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> os.system(cmd) </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> cmd = <span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'/opt/bamboo/bin/bamboo -p crf_seg %s.utf8 > %s.seg'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> % (fn,fn) </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">print</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> cmd </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> os.system(cmd) </span></li>
</ol>
</div>
<p> </p>
<p>分词结果如下:</p>
<p>一 家 刚刚 成立 两 年 的 网络 支付 公司 , 它 的 目标 是 成为 市值 100亿 美元 的 上市 公司 。<br>这家 公司 叫做 快 钱 , 说 这 句 话 的 是 快钱 的 CEO 关 国光 。 他 之前 曾 任 网易 的 高级 副 总裁 , 负责 过 网易 的 上市 工作 。 对于 为什么 选择 第三 方 支付 作为 创业 方向 , 他 曾经 对 媒体 这样 说 : “ 我 能 看到 这个 胡同 对面 是 什么 , 别人 只能 看到 这个 胡同 。 ” 自信 与 狂妄 只 有 一 步 之 遥 ―― 这 几乎 是 所有 创业者 的 共同 特征 , 是 自信 还是 狂妄 也许 需要 留待 时间 来 考证 。</p>
<p> </p>
<p><span style="font-size: medium;"><strong>3.特征提取</strong></span></p>
<p> svm不是在高维模式识别具有优势吗,咋还要特征提取呢,把所有词都当成特征不就行了吗?对于词库来说,十几万的词是很常见的,把对类别区分度(GDP,CPI,股票对经济类的区分度就高,其他一些高频词,如我们,大家,一起等就没有区分度)高的词挑选出来,一来可以减少计算量,二来应该是可以提高分类效果。</p>
<p> 据说,开方检验(CHI)信息增益(IG)对于挑选特征好,我选择的是CHI。两者的概念,请google。</p>
<p> 首先统计词在文档中的次数</p>
<p> </p>
<div class="dp-highlighter bg_python" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #e7e5dc; width: 687px; margin-top: 18px !important; margin-right: 0px !important; margin-bottom: 18px !important; margin-left: 0px !important; padding-top: 1px;">
<div class="bar" style="padding-left: 45px;">
<div class="tools" style=""><a class="ViewSource" style="" title="view plain" href="http://blog.csdn.net/marising/article/details/5844063#">view plain</a></div>
</div>
<ol class="dp-py" style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 1px !important; margin-left: 45px !important; background-color: #ffffff; color: #5c5c5c; padding: 0px;">
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="comment" style="color: #008200; background-color: inherit; padding: 0px; margin: 0px;">#ingore some term</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">def</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> ingore(s): </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">return</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'nbsp'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">' '</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">' '</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'/t'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'/n'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">','</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'。'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'!'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'、'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'―'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">/ </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'?'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'@'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">':'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'#'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'%'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'&'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'('</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">')'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'《'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'》'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'['</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">']'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'{'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'}'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'*'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">','</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'.'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'&'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'!'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'?'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">':'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">';'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">/ </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'-'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'&'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">/ </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'<'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'>'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'('</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">')'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> / </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'['</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">']'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'{'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">or</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> s == </span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'}'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="comment" style="color: #008200; background-color: inherit; padding: 0px; margin: 0px;">#term times</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">def</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> getterm(fn): </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> fnobj = open(fn,<span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'r'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">) </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> data = fnobj.read() </span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> fnobj.close() </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> arr = data.split(<span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">' '</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">) </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> docterm = dict() </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">for</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> a </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">in</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> arr: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> a = a.strip(<span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">' /n/t'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">) </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">not</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> ingore(a) </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">and</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> len( a.decode(</span><span class="string" style="color: blue; background-color: inherit; padding: 0px; margin: 0px;">'utf-8'</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">)) >=</span><span class="number" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">2</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> times = docterm.get(a) </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> times: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> docterm[a] = times + <span class="number" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">1</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">else</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> docterm[a] = <span class="number" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">1</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">return</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> docte </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="comment" style="color: #008200; background-color: inherit; padding: 0px; margin: 0px;">#cls_term:cls,term,artcount</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="comment" style="color: #008200; background-color: inherit; padding: 0px; margin: 0px;">#term_cls:term,cls,artcount</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">def</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> stat(</span><span class="special" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">cls</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">,fn,cls_term,term_cls): </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> docterm = getterm(fn) </span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> termdi = cls_term.get(<span class="special" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">cls</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">) </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">not</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> termdi: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> termdi = dict() </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> cls_term[<span class="special" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">cls</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">] = termdi </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="comment" style="color: #008200; background-color: inherit; padding: 0px; margin: 0px;">#term,times</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">for</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> t </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">in</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> docterm.iterkeys(): </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> artcount = termdi.get(t) </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">not</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> artcount: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> artcount = <span class="number" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">0</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> termdi[k] = artcount + <span class="number" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">1</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> clsdi = term_cls.get(t) </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">not</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> clsdi: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> clsdi = {} </span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> term_cls[k] = clsdi </span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> artcount = clsdi.get(<span class="special" style="color: black; background-color: inherit; padding: 0px; margin: 0px;">cls</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;">) </span></span></li>
<li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 18px; margin: 0px !important;"><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> <span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">if</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> </span><span class="keyword" style="color: #006699; background-color: inherit; font-weight: bold; padding: 0px; margin: 0px;">not</span><span style="color: black; background-color: inherit; padding: 0px; margin: 0px;"> artcount: </span></span></li>
<li class="alt" style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-ri
相关推荐
HTTP 请求方法与返回状态码 HTTP 是一个基于请求-响应模式的协议,客户端向服务器发送请求,服务器响应客户端的请求。HTTP 请求方法和返回状态码是 HTTP 协议的核心组成部分。 一、HTTP 请求方法 HTTP 请求方法是...
HTTP状态码是网络通信中用来标识客户端与服务器之间交互情况的重要信息。这些状态码由三位数字组成,分为五类,分别表示不同的响应状态。以下是各分类的详细解释: 1xx(临时响应):这些状态码表示服务器正在处理...
301(永久移动)和302(临时移动)用于页面迁移,301是永久性重定向,搜索引擎会更新索引,而302则是临时重定向,搜索引擎仍会抓取原始URL。303(查看其他位置)和307(临时重定向)类似于302,但推荐使用GET方法...
302(临时移动)与301类似,但只是临时的重定向。303(查看其他位置)建议请求者使用GET方法到新位置获取资源。304(未修改)表明资源自上次请求后未发生变化,服务器不会返回资源内容,以节省带宽。305(使用代理)...
- **303 See Other**:与301/302类似,区别在于原本通过POST请求的资源现在应通过GET方式获取。这是HTTP 1.1新增的状态码。 - **304 Not Modified**:客户端请求的资源自上次请求以来未发生变化,因此返回此状态码来...
与204的区别在于,这个状态码要求用户代理重置文档视图。 - **206 Partial Content**: 客户端发出了带有Range头字段的GET请求,服务器完成了它。 #### 3xx: 重定向状态码 这类状态码表示需要客户端采取进一步的操作...
服务器接收到请求后,返回一个HTTP状态码302(临时重定向)或301(永久重定向),并附带一个新的URL。客户端接收到这个响应后,会自动发起一个新的请求到新的URL,这意味着浏览器的地址栏会显示新的URL。由于是两个...
#### 三、301重定向与302重定向的区别 - **301重定向**表示网页已被永久移动,搜索引擎会更新索引,并将权重传递给新地址。 - **302重定向**通常表示网页暂时性移动,搜索引擎会继续索引原网页,而不更新其索引信息...
HTTP状态码是网络通信中非常重要的元素,它们用于表示服务器对客户端请求的响应状态。HTTP状态码由三位数字组成,并附带一个简短的原因短语,帮助开发者理解服务器的响应情况。以下是关于服务器返回的十四种常见HTTP...
例如,状态码301(永久移动)表示请求的资源已被永久转移到新的URL,而302(临时移动)则表示资源临时移到了新的URL。 4xx (请求错误):这些状态码意味着请求中有问题,阻碍了服务器的处理。例如,400(错误请求)...
#### GET与POST请求的区别 1. **数据传输方式**:GET请求通过URL传递参数,而POST则通过请求体传递数据。 2. **数据大小限制**:GET请求由于依赖URL,因此受到URL长度的限制,通常小于2KB;而POST请求没有此限制,...
* HTTP 协议,返回码,301 与 302 区别 多线程并发 * 多线程并发用过哪些? * 并发框架是否有了解? 应用服务器相关 * 应用服务器的 JVM 调优实际经验,如何做的,在哪里用到的? * 应用服务器相关,谈最熟悉的 ...
HTTP401错误和HTTP407错误经常出现在需要身份验证的网站中,区别在于401是直接请求被拒绝,而407是通过代理服务器时被拒绝。 总结来说,本文详细介绍了HTTP协议中各种状态码的含义,以及它们代表的客户端错误、...
302(临时移动)与301类似,但只是临时的重定向。303(查看其他位置)建议客户端使用GET方法重定向到新URL。304(未修改)表示资源自上次请求后未发生变化,客户端可以从缓存中获取。 4XX(请求错误):这类状态码...
"7-7.HTTP协议之重定向(301与302究竟有什么区别)-1080P 高清-AVC.mp4"这部分内容可能会深入探讨HTTP状态码中的重定向概念。HTTP协议允许服务器向客户端发送3xx状态码,告知浏览器资源已经移动或需要进一步操作。301 ...
请求重定向是通过`Response`对象来实现的,服务器在收到请求后,会返回一个状态码3xx(如301永久重定向,302临时重定向),并在响应头中设置`Location`字段,指示客户端应该去新的URL获取资源。浏览器接收到这样的...
- 实现方式:通过设置HTTP响应头中的`Location`字段,并且状态码为3xx(通常是302临时重定向或301永久重定向)来实现。 - 应用场景:通常用于需要改变访问路径的情况,比如登录后跳转到首页,或者页面地址永久更改...
- 301/302:重定向,告诉客户端请求的资源已被移动到新的URL。 - 400:错误的请求,客户端发送的请求无法被服务器解析。 - 404:未找到,服务器找不到请求的资源。 - 500:服务器内部错误,服务器无法完成请求。 五...