<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="https://surrender2xyz.github.io/atom.xml" rel="self" type="application/atom+xml" /><link href="https://surrender2xyz.github.io/" rel="alternate" type="text/html" /><updated>2021-04-27T07:42:52+00:00</updated><id>https://surrender2xyz.github.io/atom.xml</id><title type="html">会思考的芦苇</title><subtitle>日有所思，日有所进</subtitle><author><name>Surrender</name></author><entry><title type="html">NLP baseline paper，你读過了吗</title><link href="https://surrender2xyz.github.io/nlp/2020/08/14/NLP-paper/" rel="alternate" type="text/html" title="NLP baseline paper，你读過了吗" /><published>2020-08-14T00:00:00+00:00</published><updated>2020-08-14T00:00:00+00:00</updated><id>https://surrender2xyz.github.io/nlp/2020/08/14/NLP%20paper</id><content type="html" xml:base="https://surrender2xyz.github.io/nlp/2020/08/14/NLP-paper/">&lt;p&gt;&lt;img src=&quot;https://media-exp1.licdn.com/dms/image/C561BAQGEbzpXZ34-gQ/company-background_10000/0?e=2159024400&amp;amp;v=beta&amp;amp;t=o3vOn3Ye-qpqlDH64A1of1_aRAQ8TunahPQ4ZWuISRI&quot; alt=&quot;nlp词云图&quot; title=&quot;LOVE NLP 2&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;第一部分-nlp-baseline&quot;&gt;第一部分 NLP baseline&lt;/h1&gt;
&lt;ol&gt;
  &lt;li&gt;NLP综述&lt;/li&gt;
  &lt;li&gt;Efficient Estimation of Word Representation in Vector Space &lt;a href=&quot;https://arxiv.org/pdf/1301.3781.pdf&quot;&gt;arxiv原文&lt;/a&gt;  ICLR2013，词向量扛鼎之作&lt;/li&gt;
  &lt;li&gt;GloVe: Global Vectors for Word Representation &lt;a href=&quot;https://nlp.stanford.edu/pubs/glove.pdf&quot;&gt;stanfordNLP原文&lt;/a&gt;  EMNLP2014，最著名的词向量训练模型之一&lt;/li&gt;
  &lt;li&gt;Compositional character models for open vocabulary word representation &lt;a href=&quot;https://arxiv.org/pdf/1508.02096.pdf&quot;&gt;arxiv原文&lt;/a&gt;  EMNLP2015，第一篇介绍字符嵌入&lt;/li&gt;
  &lt;li&gt;Convolutional Neural Network for Sentence Classification &lt;a href=&quot;https://arxiv.org/pdf/1408.5882.pdf&quot;&gt;arxiv原文&lt;/a&gt;  EMNLP2014，CNN文本分类扛鼎之作&lt;/li&gt;
  &lt;li&gt;Character-level Convolutional Networks for TextClassification &lt;a href=&quot;https://arxiv.org/pdf/1509.01626.pdf&quot;&gt;arxiv原文&lt;/a&gt;  NIPS2015，第一篇字符级别的文本分类&lt;/li&gt;
  &lt;li&gt;Bag of Tricks for Efficient Text Classification &lt;a href=&quot;https://arxiv.org/pdf/1607.01759.pdf&quot;&gt;arxiv原文&lt;/a&gt;  EACL2017，细粒度文本分类模型&lt;/li&gt;
  &lt;li&gt;Sequence to Sequence Learning with Neural Networks &lt;a href=&quot;https://arxiv.org/pdf/1409.3215.pdf&quot;&gt;arxiv原文&lt;/a&gt;  NIPS2014，深度LSTM做神经枳器翻译&lt;/li&gt;
  &lt;li&gt;Neural Machine Translation by Jointly Learning to Align and Translate &lt;a href=&quot;https://arxiv.org/pdf/1409.0473.pdf&quot;&gt;arxiv原文&lt;/a&gt;  ICLR2015，第一篇提出注意力机制的论文&lt;/li&gt;
  &lt;li&gt;Hierarchical Attention Networks forDocument Classification &lt;a href=&quot;https://www.aclweb.org/anthology/N16-1174.pdf&quot;&gt;ACL原文&lt;/a&gt;  NAACL2016，HanAttention用于文本分类&lt;/li&gt;
  &lt;li&gt;
    &lt;h2 id=&quot;sgm-sequence-generation-model-for-multi-label-classification-arxiv原文--coling2018第一篇使用序列生成做多标签文本分类的论文&quot;&gt;SGM: Sequence Generation Model for Multi-label Classification &lt;a href=&quot;https://arxiv.org/pdf/1806.04822.pdf&quot;&gt;arxiv原文&lt;/a&gt;  Coling2018，第一篇使用序列生成做多标签文本分类的论文&lt;/h2&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;u&gt;以下未完成&lt;/u&gt;&lt;/p&gt;

&lt;h1 id=&quot;第二部分-nlp细分专题&quot;&gt;第二部分 NLP细分专题&lt;/h1&gt;

&lt;h2 id=&quot;part1预训练模型&quot;&gt;Part1预训练模型&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;预训练模型综述&lt;/li&gt;
  &lt;li&gt;transformer–预训练模型的基石&lt;/li&gt;
  &lt;li&gt;transformer-xl–文本生成任务经典模型&lt;/li&gt;
  &lt;li&gt;elmo–经典动态词向量，预训练模型三巨头之一&lt;/li&gt;
  &lt;li&gt;GPT–文本生成任务上的巨人&lt;/li&gt;
  &lt;li&gt;bert–预训练模型最耀眼的那颗星&lt;/li&gt;
  &lt;li&gt;ulmfit–少量样本训练的预训练模型&lt;/li&gt;
  &lt;li&gt;alber–轻量级bert的代表之作&lt;/li&gt;
  &lt;li&gt;mass–包含gpt和bert的预训练模型&lt;/li&gt;
  &lt;li&gt;xlnet–自回归预训练模型代表之作&lt;/li&gt;
  &lt;li&gt;electra–轻量级新生代预训练模型&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;part2文本匹配&quot;&gt;Part2文本匹配&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;文本匹配综述&lt;/li&gt;
  &lt;li&gt;DSSM–第一篇深度学习领域文本匹配文章&lt;/li&gt;
  &lt;li&gt;SiamseNet–利用孪生网络计算文本相似度&lt;/li&gt;
  &lt;li&gt;Compare-Aggreaget–多角度提取文本特征，利用CNN特征融合&lt;/li&gt;
  &lt;li&gt;ESIM–最流行、经典的文本匹配模型，优秀的baseline&lt;/li&gt;
  &lt;li&gt;BiMPM–多诵道、多角度匹配，充分挖掘文本特征&lt;/li&gt;
  &lt;li&gt;CSRAN–扩展CAFE算法、多层注意力交互的深层模型&lt;/li&gt;
  &lt;li&gt;DMAN-模型加入了迁移学习和强化学习技巧&lt;/li&gt;
  &lt;li&gt;DRCN–融合DenseNet和注意力机制的深度网络模型&lt;/li&gt;
  &lt;li&gt;DRr．Net–模型通过对重点内容的反复阅读来提升对文本的理解&lt;/li&gt;
  &lt;li&gt;MT-DNN–基于多任务的联合训练模型&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;part3图神经网络&quot;&gt;Part3图神经网络&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;图神经网络综述&lt;/li&gt;
  &lt;li&gt;Node2vec–平衡同质性和结构性&lt;/li&gt;
  &lt;li&gt;LINE–1阶+2阶相似度&lt;/li&gt;
  &lt;li&gt;SDNE–多层自编码器&lt;/li&gt;
  &lt;li&gt;metapath2vec–异构图网络&lt;/li&gt;
  &lt;li&gt;TransE–知识图谱奠基&lt;/li&gt;
  &lt;li&gt;GCN–开山之作&lt;/li&gt;
  &lt;li&gt;GAT–attention机制&lt;/li&gt;
  &lt;li&gt;MPNN–空域卷积消息传递框架&lt;/li&gt;
  &lt;li&gt;GGNN–门控图神经网络&lt;/li&gt;
  &lt;li&gt;GraphSAGE–归纳式字习框架&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;part4信息抽取&quot;&gt;Part4信息抽取&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;信息抽取综述&lt;/li&gt;
  &lt;li&gt;BiLSTM-CRF–深度学习应用NER的经典模型&lt;/li&gt;
  &lt;li&gt;Lattice-LSTM–融合字词向量的中文NER&lt;/li&gt;
  &lt;li&gt;FALT-Transformer应用NER&lt;/li&gt;
  &lt;li&gt;CNN-LSTM-CRF–加入分词任务的联合训练NER&lt;/li&gt;
  &lt;li&gt;PretrainedEmbeddings–基于字符语言模型的NER&lt;/li&gt;
  &lt;li&gt;End-to-EndRelationExtraction–关系抽取经典论文&lt;/li&gt;
  &lt;li&gt;Few-ShotRelationClassification–基于小样本的领域自适应关系分类&lt;/li&gt;
  &lt;li&gt;BERT-based Relation learning–基于Bert实现关系抽取&lt;/li&gt;
  &lt;li&gt;Adaptive SCaling–解决正负例不平衡的系数检测问题&lt;/li&gt;
  &lt;li&gt;Nugget Proposal Networks–解决信息抽取中的分词依赖问题&lt;/li&gt;
  &lt;li&gt;Cost-sensitive Regularization–解决事件检测中的易混淆类别问题&lt;/li&gt;
  &lt;li&gt;Anchor-Region Networks–解决命名实体识别中的嵌套实体问题
    &lt;h1 id=&quot;参考&quot;&gt;参考&lt;/h1&gt;
    &lt;ul&gt;
      &lt;li&gt;[1] &lt;a href=&quot;http://link&quot;&gt;name&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;</content><author><name>surrender</name></author><category term="NLP" /><category term="2020年" /><summary type="html"></summary></entry><entry><title type="html">测试博客对Markdown语法的支持</title><link href="https://surrender2xyz.github.io/test/2020/08/09/%E6%B8%B2%E6%9F%93%E6%B5%8B%E8%AF%95Cmd-Markdown-%E7%AE%80%E6%98%8E%E8%AF%AD%E6%B3%95%E6%89%8B%E5%86%8C/" rel="alternate" type="text/html" title="测试博客对Markdown语法的支持" /><published>2020-08-09T00:00:00+00:00</published><updated>2020-08-09T00:00:00+00:00</updated><id>https://surrender2xyz.github.io/test/2020/08/09/%E6%B8%B2%E6%9F%93%E6%B5%8B%E8%AF%95Cmd%20Markdown%20%E7%AE%80%E6%98%8E%E8%AF%AD%E6%B3%95%E6%89%8B%E5%86%8C</id><content type="html" xml:base="https://surrender2xyz.github.io/test/2020/08/09/%E6%B8%B2%E6%9F%93%E6%B5%8B%E8%AF%95Cmd-Markdown-%E7%AE%80%E6%98%8E%E8%AF%AD%E6%B3%95%E6%89%8B%E5%86%8C/">&lt;h1 id=&quot;cmd-markdown-简明语法手册&quot;&gt;Cmd Markdown 简明语法手册&lt;/h1&gt;

&lt;p&gt;标签： Cmd-Markdown&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;1-斜体和粗体&quot;&gt;1. 斜体和粗体&lt;/h3&gt;

&lt;p&gt;使用 * 和 ** 表示斜体和粗体。&lt;/p&gt;

&lt;p&gt;示例：&lt;/p&gt;

&lt;p&gt;这是 &lt;em&gt;斜体&lt;/em&gt;，这是 &lt;strong&gt;粗体&lt;/strong&gt;。&lt;/p&gt;

&lt;h3 id=&quot;2-分级标题&quot;&gt;2. 分级标题&lt;/h3&gt;

&lt;p&gt;使用 === 表示一级标题，使用 — 表示二级标题。&lt;/p&gt;

&lt;p&gt;示例：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;这是一个一级标题
============================

这是一个二级标题
--------------------------------------------------

### 这是一个三级标题
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;你也可以选择在行首加井号表示不同级别的标题 (H1-H6)，例如：# H1, ## H2, ### H3，#### H4。&lt;/p&gt;

&lt;h3 id=&quot;3-外链接&quot;&gt;3. 外链接&lt;/h3&gt;

&lt;p&gt;使用 [描述](链接地址) 为文字增加外链接。&lt;/p&gt;

&lt;p&gt;示例：&lt;/p&gt;

&lt;p&gt;这是去往 &lt;a href=&quot;http://ghosertblog.github.com&quot;&gt;本人博客&lt;/a&gt; 的链接。&lt;/p&gt;

&lt;h3 id=&quot;4-无序列表&quot;&gt;4. 无序列表&lt;/h3&gt;

&lt;p&gt;使用 *，+，- 表示无序列表。&lt;/p&gt;

&lt;p&gt;示例：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;无序列表项 一&lt;/li&gt;
  &lt;li&gt;无序列表项 二&lt;/li&gt;
  &lt;li&gt;无序列表项 三&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;5-有序列表&quot;&gt;5. 有序列表&lt;/h3&gt;

&lt;p&gt;使用数字和点表示有序列表。&lt;/p&gt;

&lt;p&gt;示例：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;有序列表项 一&lt;/li&gt;
  &lt;li&gt;有序列表项 二&lt;/li&gt;
  &lt;li&gt;有序列表项 三&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;6-文字引用&quot;&gt;6. 文字引用&lt;/h3&gt;

&lt;p&gt;使用 &amp;gt; 表示文字引用。&lt;/p&gt;

&lt;p&gt;示例：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;野火烧不尽，春风吹又生。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;7-行内代码块&quot;&gt;7. 行内代码块&lt;/h3&gt;

&lt;p&gt;使用 `代码` 表示行内代码块。&lt;/p&gt;

&lt;p&gt;示例：&lt;/p&gt;

&lt;p&gt;让我们聊聊 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;html&lt;/code&gt;。&lt;/p&gt;

&lt;h3 id=&quot;8--代码块&quot;&gt;8.  代码块&lt;/h3&gt;

&lt;p&gt;使用 四个缩进空格 表示代码块。&lt;/p&gt;

&lt;p&gt;示例：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;这是一个代码块，此行左侧有四个不可见的空格。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;9--插入图像&quot;&gt;9.  插入图像&lt;/h3&gt;

&lt;p&gt;使用 ![描述](图片链接地址) 插入图像。&lt;/p&gt;

&lt;p&gt;示例：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://www.zybuluo.com/static/img/my_head.jpg&quot; alt=&quot;我的头像&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;cmd-markdown-高阶语法手册&quot;&gt;Cmd Markdown 高阶语法手册&lt;/h1&gt;

&lt;h3 id=&quot;1-内容目录&quot;&gt;1. 内容目录&lt;/h3&gt;

&lt;p&gt;在段落中填写 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[TOC]&lt;/code&gt; 以显示全文内容的目录结构。&lt;/p&gt;

&lt;p&gt;[TOC]&lt;/p&gt;

&lt;h3 id=&quot;2-标签分类&quot;&gt;2. 标签分类&lt;/h3&gt;

&lt;p&gt;在编辑区任意行的列首位置输入以下代码给文稿标签：&lt;/p&gt;

&lt;p&gt;标签： 数学 英语 Markdown&lt;/p&gt;

&lt;p&gt;或者&lt;/p&gt;

&lt;p&gt;Tags： 数学 英语 Markdown&lt;/p&gt;

&lt;h3 id=&quot;3-删除线&quot;&gt;3. 删除线&lt;/h3&gt;

&lt;p&gt;使用 ~~ 表示删除线。&lt;/p&gt;

&lt;p&gt;&lt;del&gt;这是一段错误的文本。&lt;/del&gt;&lt;/p&gt;

&lt;h3 id=&quot;4-注脚&quot;&gt;4. 注脚&lt;/h3&gt;

&lt;p&gt;使用 [^keyword] 表示注脚。&lt;/p&gt;

&lt;p&gt;这是一个注脚&lt;sup id=&quot;fnref:footnote&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:footnote&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;的样例。&lt;/p&gt;

&lt;p&gt;这是第二个注脚&lt;sup id=&quot;fnref:footnote2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:footnote2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;的样例。&lt;/p&gt;

&lt;h3 id=&quot;5-latex-公式&quot;&gt;5. LaTeX 公式&lt;/h3&gt;

&lt;p&gt;$ 表示行内公式：&lt;/p&gt;

&lt;p&gt;质能守恒方程可以用一个很简洁的方程式 $E=mc^2$ 来表达。&lt;/p&gt;

&lt;p&gt;$$ 表示整行公式：&lt;/p&gt;

\[\sum_{i=1}^n a_i=0\]

\[f(x_1,x_x,\ldots,x_n) = x_1^2 + x_2^2 + \cdots + x_n^2\]

\[\sum^{j-1}_{k=0}{\widehat{\gamma}_{kj} z_k}\]

&lt;p&gt;访问 &lt;a href=&quot;http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference&quot;&gt;MathJax&lt;/a&gt; 参考更多使用方法。&lt;/p&gt;

&lt;h3 id=&quot;6-加强的代码块&quot;&gt;6. 加强的代码块&lt;/h3&gt;

&lt;p&gt;支持四十一种编程语言的语法高亮的显示，行号显示。&lt;/p&gt;

&lt;p&gt;非代码示例：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo apt-get install vim-gnome
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Python 示例：&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;@&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;requires_authorization&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;somefunc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;param1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;param2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;'''A docstring'''&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;param1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;param2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# interesting
&lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'Greater'&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;param2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;param1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;SomeClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;pass&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'''interpreter
... prompt'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;JavaScript 示例：&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cm&quot;&gt;/**
* nth element in the fibonacci series.
* @param n &amp;gt;= 0
* @return the nth element, &amp;gt;= 0.
*/&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fib&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;tmp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fib&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;7-流程图&quot;&gt;7. 流程图&lt;/h3&gt;

&lt;h4 id=&quot;示例&quot;&gt;示例&lt;/h4&gt;

&lt;pre&gt;&lt;code class=&quot;language-flow&quot;&gt;st=&amp;gt;start: Start:&amp;gt;https://www.zybuluo.com
io=&amp;gt;inputoutput: verification
op=&amp;gt;operation: Your Operation
cond=&amp;gt;condition: Yes or No?
sub=&amp;gt;subroutine: Your Subroutine
e=&amp;gt;end

st-&amp;gt;io-&amp;gt;op-&amp;gt;cond
cond(yes)-&amp;gt;e
cond(no)-&amp;gt;sub-&amp;gt;io
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&quot;更多语法参考流程图语法参考&quot;&gt;更多语法参考：&lt;a href=&quot;http://adrai.github.io/flowchart.js/&quot;&gt;流程图语法参考&lt;/a&gt;&lt;/h4&gt;

&lt;h3 id=&quot;8-序列图&quot;&gt;8. 序列图&lt;/h3&gt;

&lt;h4 id=&quot;示例-1&quot;&gt;示例 1&lt;/h4&gt;

&lt;pre&gt;&lt;code class=&quot;language-seq&quot;&gt;Alice-&amp;gt;Bob: Hello Bob, how are you?
Note right of Bob: Bob thinks
Bob--&amp;gt;Alice: I am good thanks!
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&quot;示例-2&quot;&gt;示例 2&lt;/h4&gt;

&lt;pre&gt;&lt;code class=&quot;language-seq&quot;&gt;Title: Here is a title
A-&amp;gt;B: Normal line
B--&amp;gt;C: Dashed line
C-&amp;gt;&amp;gt;D: Open arrow
D--&amp;gt;&amp;gt;A: Dashed open arrow
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&quot;更多语法参考序列图语法参考&quot;&gt;更多语法参考：&lt;a href=&quot;http://bramp.github.io/js-sequence-diagrams/&quot;&gt;序列图语法参考&lt;/a&gt;&lt;/h4&gt;

&lt;h3 id=&quot;9-甘特图&quot;&gt;9. 甘特图&lt;/h3&gt;

&lt;p&gt;甘特图内在思想简单。基本是一条线条图，横轴表示时间，纵轴表示活动（项目），线条表示在整个期间上计划和实际的活动完成情况。它直观地表明任务计划在什么时候进行，及实际进展与计划要求的对比。&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-gantt&quot;&gt;    title 项目开发流程
    section 项目确定
        需求分析       :a1, 2016-06-22, 3d
        可行性报告     :after a1, 5d
        概念验证       : 5d
    section 项目实施
        概要设计      :2016-07-05  , 5d
        详细设计      :2016-07-08, 10d
        编码          :2016-07-15, 10d
        测试          :2016-07-22, 5d
    section 发布验收
        发布: 2d
        验收: 3d
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&quot;更多语法参考甘特图语法参考&quot;&gt;更多语法参考：&lt;a href=&quot;https://knsv.github.io/mermaid/#gant-diagrams&quot;&gt;甘特图语法参考&lt;/a&gt;&lt;/h4&gt;

&lt;h3 id=&quot;10-mermaid-流程图&quot;&gt;10. Mermaid 流程图&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;language-graphLR&quot;&gt;    A[Hard edge] --&amp;gt;|Link text| B(Round edge)
    B --&amp;gt; C{Decision}
    C --&amp;gt;|One| D[Result one]
    C --&amp;gt;|Two| E[Result two]
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&quot;更多语法参考mermaid-流程图语法参考&quot;&gt;更多语法参考：&lt;a href=&quot;https://knsv.github.io/mermaid/#flowcharts-basic-syntax&quot;&gt;Mermaid 流程图语法参考&lt;/a&gt;&lt;/h4&gt;

&lt;h3 id=&quot;11-mermaid-序列图&quot;&gt;11. Mermaid 序列图&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&quot;language-sequence&quot;&gt;    Alice-&amp;gt;John: Hello John, how are you?
    loop every minute
        John--&amp;gt;Alice: Great!
    end
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&quot;更多语法参考mermaid-序列图语法参考&quot;&gt;更多语法参考：&lt;a href=&quot;https://knsv.github.io/mermaid/#sequence-diagrams&quot;&gt;Mermaid 序列图语法参考&lt;/a&gt;&lt;/h4&gt;

&lt;h3 id=&quot;12-表格支持&quot;&gt;12. 表格支持&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;项目&lt;/th&gt;
      &lt;th style=&quot;text-align: right&quot;&gt;价格&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;数量&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;计算机&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;$1600&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;手机&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;$12&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;管线&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;$1&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;234&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;13-定义型列表&quot;&gt;13. 定义型列表&lt;/h3&gt;

&lt;dl&gt;
  &lt;dt&gt;名词 1&lt;/dt&gt;
  &lt;dd&gt;定义 1（左侧有一个可见的冒号和四个不可见的空格）&lt;/dd&gt;
  &lt;dt&gt;代码块 2&lt;/dt&gt;
  &lt;dd&gt;这是代码块的定义（左侧有一个可见的冒号和四个不可见的空格）

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;代码块（左侧有八个不可见的空格）
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/dd&gt;
&lt;/dl&gt;

&lt;h3 id=&quot;14-html-标签&quot;&gt;14. Html 标签&lt;/h3&gt;

&lt;p&gt;本站支持在 Markdown 语法中嵌套 Html 标签，譬如，你可以用 Html 写一个纵跨两行的表格：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;table&amp;gt;
    &amp;lt;tr&amp;gt;
        &amp;lt;th rowspan=&quot;2&quot;&amp;gt;值班人员&amp;lt;/th&amp;gt;
        &amp;lt;th&amp;gt;星期一&amp;lt;/th&amp;gt;
        &amp;lt;th&amp;gt;星期二&amp;lt;/th&amp;gt;
        &amp;lt;th&amp;gt;星期三&amp;lt;/th&amp;gt;
    &amp;lt;/tr&amp;gt;
    &amp;lt;tr&amp;gt;
        &amp;lt;td&amp;gt;李强&amp;lt;/td&amp;gt;
        &amp;lt;td&amp;gt;张明&amp;lt;/td&amp;gt;
        &amp;lt;td&amp;gt;王平&amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;table&gt;
    &lt;tr&gt;
        &lt;th rowspan=&quot;2&quot;&gt;值班人员&lt;/th&gt;
        &lt;th&gt;星期一&lt;/th&gt;
        &lt;th&gt;星期二&lt;/th&gt;
        &lt;th&gt;星期三&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;李强&lt;/td&gt;
        &lt;td&gt;张明&lt;/td&gt;
        &lt;td&gt;王平&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;

&lt;h3 id=&quot;15-内嵌图标&quot;&gt;15. 内嵌图标&lt;/h3&gt;

&lt;p&gt;本站的图标系统对外开放，在文档中输入&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;i class=&quot;icon-weibo&quot;&amp;gt;&amp;lt;/i&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;即显示微博的图标： &lt;i class=&quot;icon-weibo icon-2x&quot;&gt;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;替换 上述 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i 标签&lt;/code&gt; 内的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;icon-weibo&lt;/code&gt; 以显示不同的图标，例如：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;i class=&quot;icon-renren&quot;&amp;gt;&amp;lt;/i&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;即显示人人的图标： &lt;i class=&quot;icon-renren icon-2x&quot;&gt;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;更多的图标和玩法可以参看 &lt;a href=&quot;http://fortawesome.github.io/Font-Awesome/3.2.1/icons/&quot;&gt;font-awesome&lt;/a&gt; 官方网站。&lt;/p&gt;

&lt;h3 id=&quot;16-待办事宜-todo-列表&quot;&gt;16. 待办事宜 Todo 列表&lt;/h3&gt;

&lt;p&gt;使用带有 [ ] 或 [x] （未完成或已完成）项的列表语法撰写一个待办事宜列表，并且支持子列表嵌套以及混用Markdown语法，例如：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;- [ ] **Cmd Markdown 开发**
    - [ ] 改进 Cmd 渲染算法，使用局部渲染技术提高渲染效率
    - [ ] 支持以 PDF 格式导出文稿
    - [x] 新增Todo列表功能 [语法参考](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments)
    - [x] 改进 LaTex 功能
        - [x] 修复 LaTex 公式渲染问题
        - [x] 新增 LaTex 公式编号功能 [语法参考](http://docs.mathjax.org/en/latest/tex.html#tex-eq-numbers)
- [ ] **七月旅行准备**
    - [ ] 准备邮轮上需要携带的物品
    - [ ] 浏览日本免税店的物品
    - [x] 购买蓝宝石公主号七月一日的船票
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;对应显示如下待办事宜 Todo 列表：&lt;/p&gt;

&lt;ul class=&quot;task-list&quot;&gt;
  &lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;task-list-item-checkbox&quot; disabled=&quot;disabled&quot; /&gt;&lt;strong&gt;Cmd Markdown 开发&lt;/strong&gt;
    &lt;ul class=&quot;task-list&quot;&gt;
      &lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;task-list-item-checkbox&quot; disabled=&quot;disabled&quot; /&gt;改进 Cmd 渲染算法，使用局部渲染技术提高渲染效率&lt;/li&gt;
      &lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;task-list-item-checkbox&quot; disabled=&quot;disabled&quot; /&gt;支持以 PDF 格式导出文稿&lt;/li&gt;
      &lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;task-list-item-checkbox&quot; disabled=&quot;disabled&quot; checked=&quot;checked&quot; /&gt;新增Todo列表功能 &lt;a href=&quot;https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments&quot;&gt;语法参考&lt;/a&gt;&lt;/li&gt;
      &lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;task-list-item-checkbox&quot; disabled=&quot;disabled&quot; checked=&quot;checked&quot; /&gt;改进 LaTex 功能
        &lt;ul class=&quot;task-list&quot;&gt;
          &lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;task-list-item-checkbox&quot; disabled=&quot;disabled&quot; checked=&quot;checked&quot; /&gt;修复 LaTex 公式渲染问题&lt;/li&gt;
          &lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;task-list-item-checkbox&quot; disabled=&quot;disabled&quot; checked=&quot;checked&quot; /&gt;新增 LaTex 公式编号功能 &lt;a href=&quot;http://docs.mathjax.org/en/latest/tex.html#tex-eq-numbers&quot;&gt;语法参考&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;task-list-item-checkbox&quot; disabled=&quot;disabled&quot; /&gt;&lt;strong&gt;七月旅行准备&lt;/strong&gt;
    &lt;ul class=&quot;task-list&quot;&gt;
      &lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;task-list-item-checkbox&quot; disabled=&quot;disabled&quot; /&gt;准备邮轮上需要携带的物品&lt;/li&gt;
      &lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;task-list-item-checkbox&quot; disabled=&quot;disabled&quot; checked=&quot;checked&quot; /&gt;浏览日本免税店的物品&lt;/li&gt;
      &lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;task-list-item-checkbox&quot; disabled=&quot;disabled&quot; checked=&quot;checked&quot; /&gt;购买蓝宝石公主号七月一日的船票&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:footnote&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;这是一个 &lt;em&gt;注脚&lt;/em&gt; 的 &lt;strong&gt;文本&lt;/strong&gt;。 &lt;a href=&quot;#fnref:footnote&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:footnote2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;这是另一个 &lt;em&gt;注脚&lt;/em&gt; 的 &lt;strong&gt;文本&lt;/strong&gt;。 &lt;a href=&quot;#fnref:footnote2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;</content><author><name>surrender</name></author><category term="test" /><category term="2020年" /><summary type="html">Cmd Markdown 简明语法手册</summary></entry><entry><title type="html">TF-IDF</title><link href="https://surrender2xyz.github.io/nlp/2020/05/24/TF-IDF/" rel="alternate" type="text/html" title="TF-IDF" /><published>2020-05-24T00:00:00+00:00</published><updated>2020-05-24T00:00:00+00:00</updated><id>https://surrender2xyz.github.io/nlp/2020/05/24/TF-IDF</id><content type="html" xml:base="https://surrender2xyz.github.io/nlp/2020/05/24/TF-IDF/">&lt;p&gt;[TOC]&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;TF-IDF 算法主要适用于英文，而中文首先要分词，分词后要解决多词一义、一词多义问题，这两个问题通过简单的tf-idf方法不能很好的解决。于是就有了后来的词嵌入方法，用向量来表征一个词。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;0-tf-idf的历史&quot;&gt;0 tf-idf的历史&lt;/h1&gt;

&lt;p&gt;把查询关键字（Query）和文档（Document）都转换成 “向量”，并且尝试用线性代数等数学工具来解决&lt;strong&gt;信息检索&lt;/strong&gt;问题，这样的努力至少可以追溯到 20 世纪 70 年代。&lt;/p&gt;

&lt;p&gt;1971 年，美国康奈尔大学教授杰拉德 · 索尔顿（Gerard Salton）发表了《SMART 检索系统：自动文档处理实验》（The SMART Retrieval System—Experiments in Automatic Document Processing）一文，文中首次提到了把查询关键字和文档都转换成 “向量”，并且给这些向量中的元素赋予不同的值。这篇论文中描述的 SMART 检索系统，特别是其中对 TF-IDF 及其变种的描述成了后续很多工业级系统的重要参考。&lt;/p&gt;

&lt;p&gt;1972 年，英国的计算机科学家卡伦 · 琼斯（Karen Spärck Jones）在《从统计的观点看词的特殊性及其在文档检索中的应用》（A Statistical Interpretation of Term Specificity and Its Application in Retrieval） 一文中第一次详细地阐述了 IDF 的应用。其后卡伦又在《检索目录中的词赋值权重》（Index Term Weighting）一文中对 TF 和 IDF 的结合进行了论述。可以说，卡伦是第一位从理论上对 TF-IDF 进行完整论证的计算机科学家，因此后世也有很多人把 TF-IDF 的发明归结于卡伦。&lt;/p&gt;

&lt;h1 id=&quot;1-tf-idf算法&quot;&gt;1 tf-idf算法&lt;/h1&gt;

&lt;p&gt;算法步骤：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;TF （Term Frequency）—— “单词频率”&lt;/p&gt;

    &lt;p&gt;对于词项 t，根据其在文档 d 中的权重来计算它的得分。最简单的方式是将权重设置为 t 在文档中的出现次数。这种权重计算的结果为词频，基本公式记为 $TF={tf}_{t,d}$，其中的两个下标分别对应词项和文档。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;IDF（Inverse Document Frequency）—— “逆文档频率”&lt;/p&gt;

    &lt;p&gt;词频 TF 会面临这样一个严重问题，即在进行相关度计算时，所有的词项都被认为是同等重要的。实际上，某些词项对于相关度计算来说几乎没有或很少区分能力。例如，在一个有关汽车工业的文档集中，几乎所有的文档都会包含 auto，此时，auto 就没有区分能力。&lt;/p&gt;

    &lt;p&gt;逆文档频率（inverse document frequency，IDF）是一个词语普遍重要性的度量，可用于解决上述问题。一个罕见词的 IDF 往往很高，而高频词的 IDF 就可能较低。IDF 基本公式可表示为：$IDF =log\frac{N}{n_t}$&lt;/p&gt;

    &lt;p&gt;其中，N为文档的数目，${n}_{t}$ 出现词项 t 的文档数目。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;计算TF-IDF值
 $ tfidf(t,d,D)=TF(t,d)*IDF(t,D) $&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;2-tf-idf变种&quot;&gt;2 tf-idf变种&lt;/h1&gt;

&lt;h3 id=&quot;21-tf变种&quot;&gt;2.1 tf变种&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/img/postPic/image-20200524155659219.png&quot; alt=&quot;image-20200524155659219&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;22-idf变种&quot;&gt;2.2 idf变种&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/img/postPic/image-20200524155802600-1596953546762.png&quot; alt=&quot;name&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;23-推荐的tfidf加权方案&quot;&gt;2.3 推荐的tf–idf加权方案&lt;/h3&gt;

&lt;p&gt;在整个文档集合中，词语（term）的较高频率（在给定文档中）和较低的文档频率都可以达到较高的tf–idf权重；因此权重往往会滤除常用词语。由于idf的对数函数内的比率始终大于或等于1，因此idf（和tf–idf）的值大于或等于0。随着一个词语在更多文档中出现，对数内的比率接近1 ，使idf和tf–idf接近0。&lt;/p&gt;

&lt;p&gt;因此推荐使用如下的计算方式：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/postPic/image-20200524160025460.png&quot; alt=&quot;image-20200524160025460&quot; /&gt;&lt;/p&gt;

&lt;p&gt;[1] &lt;a href=&quot;https://en.wikipedia.org/wiki/Tf–idf&quot;&gt;Wikipedia：Tf–idf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[2] [tfidf sklearn ] (http://link.cn)&lt;/p&gt;</content><author><name>surrender</name></author><category term="NLP" /><category term="2020年" /><summary type="html">[TOC]</summary></entry><entry><title type="html">关键词抽取概述</title><link href="https://surrender2xyz.github.io/%E8%83%8C%E6%99%AF%E7%9F%A5%E8%AF%86/nlp/2020/05/22/%E5%85%B3%E9%94%AE%E8%AF%8D%E6%8A%BD%E5%8F%96%E6%A6%82%E8%BF%B0/" rel="alternate" type="text/html" title="关键词抽取概述" /><published>2020-05-22T00:00:00+00:00</published><updated>2020-05-22T00:00:00+00:00</updated><id>https://surrender2xyz.github.io/%E8%83%8C%E6%99%AF%E7%9F%A5%E8%AF%86/nlp/2020/05/22/%E5%85%B3%E9%94%AE%E8%AF%8D%E6%8A%BD%E5%8F%96%E6%A6%82%E8%BF%B0</id><content type="html" xml:base="https://surrender2xyz.github.io/%E8%83%8C%E6%99%AF%E7%9F%A5%E8%AF%86/nlp/2020/05/22/%E5%85%B3%E9%94%AE%E8%AF%8D%E6%8A%BD%E5%8F%96%E6%A6%82%E8%BF%B0/">&lt;h1 id=&quot;nlp-关键词抽取&quot;&gt;NLP-关键词抽取&lt;/h1&gt;

&lt;p&gt;[toc]&lt;/p&gt;

&lt;h1 id=&quot;0-概述&quot;&gt;0 概述&lt;/h1&gt;
&lt;p&gt;在自然语言处理领域，我们有一种类型的问题：如何在一堆文本中中提取出核心词/句子。而无论是对于长文本还是短文本，往往可以通过几个关键词窥探整个文本的主题思想。&lt;/p&gt;

&lt;p&gt;与此同时，不管是基于文本的推荐还是基于文本的搜索，对于文本关键词的依赖也很大，关键词提取的准确程度直接关系到推荐系统或者搜索系统的最终效果。&lt;/p&gt;

&lt;h1 id=&quot;1-无监督算法&quot;&gt;1 无监督算法&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;不需要人工标注的语料，利用某些方法发现文本中比较重要的词作为关键词，进行关键词抽取。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;11-基于统计特征的关键词抽取&quot;&gt;1.1 基于统计特征的关键词抽取&lt;/h2&gt;

&lt;p&gt;基于于统计特征的关键词抽取算法的思想是&lt;strong&gt;利用文档中词语的统计信息抽取文档的关键词。&lt;/strong&gt;通常将文本经过预处理得到候选词语的集合，然后采用特征值量化的方式从候选集合中得到关键词。基于统计特征的关键词抽取方法的关键是采用什么样的特征值量化指标的方式，目前常用的有三类：&lt;/p&gt;

&lt;h3 id=&quot;1基于词权重的特征量化&quot;&gt;（1）基于词权重的特征量化&lt;/h3&gt;

&lt;p&gt;主要包括词性、词频、逆向文档频率、相对词频、词长等&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;词性&lt;/p&gt;

    &lt;p&gt;通过分词、语法分析后得到的结果。现有的关键词中，绝大多数关键词为名词或者动名词。一般情况下，名词与其他词性相比更能表达一篇文章的主要思想。但是，词性作为特征量化的指标，一般与其他指标结合使用。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;词频&lt;/p&gt;

    &lt;p&gt;词频表示一个词在文本中出现的频率。一般我们认为，如果一个词在文本中出现的越是频繁，那么这个词就越有可能作为文章的核心词。词频简单地统计了词在文本中出现的次数，但是，只依靠词频所得到的关键词有很大的不确定性，对于长度比较长的文本，这个方法会有很大的噪音。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;位置信息&lt;/p&gt;

    &lt;p&gt;一般情况下，词出现的位置对于词来说有着很大的价值。例如，标题、摘要本身就是作者概括出的文章的中心思想，因此出现在这些地方的词具有一定的代表性，更可能成为关键词。但是，因为每个作者的习惯不同，写作方式不同，关键句子的位置也会有所不同，所以这也是一种很宽泛的得到关键词的方法，一般情况下不会单独使用。&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;2基于词的文档位置的特征量化&quot;&gt;（2）基于词的文档位置的特征量化&lt;/h3&gt;

&lt;p&gt;这种特征量化方式是根据文章不同位置的句子对文档的重要性不同的假设来进行的。通常，文章的前N个词、后N个词、段首、段尾、标题、引言等位置的词具有代表性，这些词作为关键词可以表达整个的主题。&lt;/p&gt;

&lt;h3 id=&quot;3-基于词的关联信息的特征量化&quot;&gt;（3 ）基于词的关联信息的特征量化&lt;/h3&gt;

&lt;p&gt;词的关联信息是指词与词、词与文档的关联程度信息，包括互信息、hits值、贡献度、依存度、TF-IDF值等&lt;/p&gt;

&lt;h2 id=&quot;12-基于词图模型的关键词抽取&quot;&gt;1.2 基于词图模型的关键词抽取&lt;/h2&gt;

&lt;p&gt;基于词图模型的关键词抽取首先要构建文档的语言网络图，然后对语言进行网络图分析，在这个图上寻找具有重要作用的词或者短语，这些短语就是文档的关键词。语言网络图中节点基本上都是词，根据&lt;strong&gt;词的链接方式&lt;/strong&gt;不同，语言网络的主要形式分为四种：&lt;strong&gt;共现网络图、语法网络图、语义网络图和其他网络图。&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;在语言网络图的构建过程中，都是以预处理过后的词作为节点，词与词之间的关系作为边。语言网络图中，边与边之间的权重一般用词之间的关联度来表示。在使用语言网络图获得关键词的时候，需要评估各个节点的重要性，然后根据重要性将节点进行排序，选取TopK个节点所代表的词作为关键词。节点的重要性计算方法有以下几种方法。&lt;/p&gt;

&lt;h3 id=&quot;1-特征综合法aka社会网络中心性分析方法&quot;&gt;（1） 特征综合法（aka社会网络中心性分析方法）&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;核心思想&lt;/strong&gt;：节点重要性等于节点的显著性，以不破坏网络的整体性为基础。此方法就是从网络的局部属性和全局属性角度去定量分析网络结构的拓扑性质。&lt;/p&gt;

&lt;p&gt;常用的定量计算方法如下。&lt;/p&gt;

&lt;h3 id=&quot;2-系统科学法&quot;&gt;（2） 系统科学法&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;核心思想&lt;/strong&gt;：节点重要性等价于该节点被删除后对于整个语言网络图的破坏程度。&lt;/p&gt;

&lt;p&gt;重要的节点被删除后会对网络的连通性等产生变化。如果我们在网络图中删除某一个节点，图的某些指定特性产生了改变，可以根据特性改变的大小计算节点的重要性，从而对节点进行筛选。&lt;/p&gt;

&lt;h3 id=&quot;3随机游走法&quot;&gt;（3）随机游走法&lt;/h3&gt;

&lt;p&gt;网络图上的随机游走(random walk)是指给定图和出发点,随机地选择邻居节点,移动到邻居节点上,然后把 当前节点作为出发点,重复以上过程.那些被随机选出的节点序列就构成了一个在图上的随机游走过程。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;核心思想&lt;/strong&gt;：在有向图中,当一个节点指向另一个节点时,相当于由 弧的起点给弧的终点投上一票,节点得票越多,说明该节点在有向图中越重要,但同时,还跟给它投票的节点的 重要程度相关,即,一个节点的重要程度取决于它的票数和给它投票的节点本身的重要程度。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;随机游走算法一个很出名的应用是大名鼎鼎的PageRank算法，PageRank算法是整个google搜索的核心算法，是一种通过网页之间的超链接来计算网页重要性的技术，其关键的思想是重要性传递。&lt;/strong&gt;Mihalcea 等人将 PageRank 应用于关键词抽取领域,并命名为 &lt;strong&gt;TextRank&lt;/strong&gt;。&lt;/p&gt;

&lt;h2 id=&quot;13-基于主题模型的关键词抽取&quot;&gt;1.3 基于主题模型的关键词抽取&lt;/h2&gt;

&lt;p&gt;对于一篇文章，我们的构思思路是先确定几个主题，然后根据主题想好描述主题的词汇，将词汇按照语法规则组成句子，段落，最后生成一篇文章。主题模型也是基于这个&lt;strong&gt;思想&lt;/strong&gt;，它认为:① 文档是若干主题的混合分布;② 每个主题又是词语的概率分布。&lt;/p&gt;

&lt;p&gt;PLSA模型就是第一个根据这个想法构建的模型，该模型认为：一篇文档中的每一个词都是通过一定概率选取某个主题，然后再按照一定的概率从主题中选取得到这个词语，这个词语的计算公式为：
\(P(\frac{词语}{文档})=\sum_{主题}P(\frac{词语}{文档})\times P(\frac{主题}{文档})\)
一些贝叶斯学派的研究者对于PLSA模型进行了改进，他们认为，文章对应主题的概率以及主题对应词语的概率不是一定的，也服从一定的概率，于是就有了现阶段常用的主题模型–&lt;strong&gt;LDA&lt;/strong&gt;主题模型。LDA模型下次再细讲。&lt;/p&gt;

&lt;p&gt;基于主题模型的关键词抽取算法的步骤如下：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;获取候选关键词&lt;/strong&gt;（将文本分词，也可以再根据词性选取候选关键词）&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;语料学习&lt;/strong&gt;（大规模预料学习得到主题模型）&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;计算文章主题分布&lt;/strong&gt;（根据得到的隐含主题模型，计算文章主题分布和候选关键词分布）&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;排序&lt;/strong&gt;（计算文档和候选关键词的主题相似度并排序，选取前n个词作为关键词）&lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;2-有监督算法&quot;&gt;2 有监督算法&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;它是将关键词抽取算法看作是二分类问题，通过构建一个较为丰富和完善的词表，然后通过判断文档与词表中每个词的匹配程度，来判断文档中的词或者短语是或者不是关键词。既然是分类问题，就需要提供已经标注好的训练语料，利用训练语料训练关键词提取模型，根据模型对需要抽取关键词的文档进行关键词抽取。&lt;/p&gt;

  &lt;p&gt;有监督的方法能够获取到较高的精度，但缺点是需要大批量的标注 数据，人工成本过高。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;无监督的方法&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;有基于统计机器翻译 SMT 的方法（转换成翻译问题，可以采用 IBM Model 1）&lt;/li&gt;
  &lt;li&gt;基于序列标注模型的方法（转换成核心成分识别问题，类似 NER，状态只有0和1，即是否是核心成分，较适用于短文本）&lt;/li&gt;
  &lt;li&gt;基于排序学习LTR的方法（转换成候选词排序问题，采用 pairwise 方法，或者深度语义匹配方法，如 DSSM）&lt;/li&gt;
  &lt;li&gt;基于传统机器学习分类方法（转换成二元或多元分类问题）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;有监督方法依赖一定规模的标注数据，效果通常会显著好于无监督方法&lt;/p&gt;

&lt;p&gt;参考文献&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td&gt;[1] [达观数据，技术干货&lt;/td&gt;
          &lt;td&gt;如何做好文本关键词提取？从三种算法说起](https://baijiahao.baidu.com/s?id=1591759412102633028&amp;amp;wfr=spider&amp;amp;for=pc)&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/li&gt;
  &lt;li&gt;[2] &lt;a href=&quot;https://www.zhihu.com/question/21104071&quot;&gt;知乎，关键词」提取都有哪些方案？&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;[3] &lt;a href=&quot;https://www.zhihu.com/question/21104071/answer/291420205&quot;&gt;小Fan的回答,关键词」提取都有哪些方案？&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>surrender</name></author><category term="背景知识" /><category term="NLP" /><category term="关键词抽取" /><category term="2020年" /><summary type="html">NLP-关键词抽取</summary></entry><entry><title type="html">《华冰聊专利》读后感</title><link href="https://surrender2xyz.github.io/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/2020/04/30/%E5%8D%8E%E5%86%B0%E8%81%8A%E4%B8%93%E5%88%A9%E8%AF%BB%E5%90%8E%E6%84%9F/" rel="alternate" type="text/html" title="《华冰聊专利》读后感" /><published>2020-04-30T00:00:00+00:00</published><updated>2020-04-30T00:00:00+00:00</updated><id>https://surrender2xyz.github.io/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/2020/04/30/%E5%8D%8E%E5%86%B0%E8%81%8A%E4%B8%93%E5%88%A9%E8%AF%BB%E5%90%8E%E6%84%9F</id><content type="html" xml:base="https://surrender2xyz.github.io/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/2020/04/30/%E5%8D%8E%E5%86%B0%E8%81%8A%E4%B8%93%E5%88%A9%E8%AF%BB%E5%90%8E%E6%84%9F/">&lt;h1 id=&quot;0-介绍&quot;&gt;0 介绍&lt;/h1&gt;

&lt;p&gt;正如本书的副标题：普及专利知识，评论热点时间事所言，本书重在普及，以专利的视角看待一些热点时事（例如屠呦呦发明的青蒿素丧失专利申请机会），以通俗易懂的方式解释那些看起来复杂的术语（例如将专利许可的各种方式与租房类比），非常适合每一个想了解什么是专利、怎么申请专利、专利有什么作用的朋友。&lt;/p&gt;

&lt;p&gt;阅读本书不需要任何先修知识，因为本书本就是中国科学报上连载文字的合集。&lt;/p&gt;

&lt;h1 id=&quot;1-读后感&quot;&gt;1 读后感&lt;/h1&gt;

&lt;p&gt;读完最后一文“爱，是穿透一切的力量”，了解到了作者的IP历程，也感受到了作者和知乾的目标：专利能起到真正的作用，而不只是荣誉证书、绣花枕头，不是权利人弃之可惜、用之无利的鸡肋。专利应该是企业发展的护身符，是创新技术持有人为自己争取利益的有力工具。&lt;/p&gt;

&lt;p&gt;以及原则：绝不多垃圾专利、绝不在中国庞大的专利数量上再添负担、绝不以专利数量为目标。&lt;/p&gt;

&lt;p&gt;实际情况如何呢？好奇的我对作者及其代理机构的专利申请情况进行了检索：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;以”智乾”为关键字搜索代理机构，过滤掉重复信息，可查询到大约665件专利申请（2014~2020）；&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;华冰老师所在代理机构（现名：北京智乾知识产权代理事务所）现有代理人约为12名；&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;粗略计算：665/6年/12人≈9.2，即每人每月大约申请一件专利！&lt;/p&gt;

    &lt;p&gt;真的是在&lt;strong&gt;慢工出细活&lt;/strong&gt;、打造&lt;strong&gt;高质量的专利&lt;/strong&gt;！&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;联想到网上常见到的专利外包招标通过降价提高竞争力、代理机构（代理人）在网上发布包授权、编专利等不断拉低下限之事，满足甲方爸爸既省钱又申请了专利的诉求，就越发觉得华冰对待专利、知识产权的热爱与初心难能可贵。&lt;/p&gt;

&lt;p&gt;希望劣币驱逐良币的现象在专利代理行业越来越少，像华冰老师这样真正热爱专利、用心做专利的代理人越来越多，中国的技术创新能够真正得到保护！&lt;/p&gt;

&lt;h1 id=&quot;3-摘录&quot;&gt;3 摘录&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;专利，专是手段，利是目的。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;专利应该成为国与国之间经济实力比拼的子弹。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;专利/知识产权是话语权，使用了证明某项技术、某种产品、某项设计专属于权利人的道具，是用来将他人限定在权力范围外的栅栏，是用来不许他人抄袭的工具。&lt;/p&gt;
&lt;/blockquote&gt;</content><author><name>surrender</name></author><category term="读书笔记" /><category term="2020年" /><summary type="html">0 介绍</summary></entry><entry><title type="html">USBkey特点及其应用介绍</title><link href="https://surrender2xyz.github.io/%E8%83%8C%E6%99%AF%E7%9F%A5%E8%AF%86/2020/04/05/USBkey%E7%89%B9%E7%82%B9%E5%8F%8A%E5%85%B6%E5%BA%94%E7%94%A8%E4%BB%8B%E7%BB%8D/" rel="alternate" type="text/html" title="USBkey特点及其应用介绍" /><published>2020-04-05T00:00:00+00:00</published><updated>2020-04-05T00:00:00+00:00</updated><id>https://surrender2xyz.github.io/%E8%83%8C%E6%99%AF%E7%9F%A5%E8%AF%86/2020/04/05/USBkey%E7%89%B9%E7%82%B9%E5%8F%8A%E5%85%B6%E5%BA%94%E7%94%A8%E4%BB%8B%E7%BB%8D</id><content type="html" xml:base="https://surrender2xyz.github.io/%E8%83%8C%E6%99%AF%E7%9F%A5%E8%AF%86/2020/04/05/USBkey%E7%89%B9%E7%82%B9%E5%8F%8A%E5%85%B6%E5%BA%94%E7%94%A8%E4%BB%8B%E7%BB%8D/">&lt;blockquote&gt;
  &lt;p&gt;USB可以最常见的应用是作为网银U盾。&lt;/p&gt;

  &lt;p&gt;那是淘宝刚兴起的时候，为了能方便地购物，我在柜员的帮助（忽悠）下办理了人生中的第一个U盾…&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;1-usbkey特点&quot;&gt;1 USBKEY特点&lt;/h2&gt;
&lt;p&gt;USBKEY是一种USB接口的硬件设备，形状与常见的u盘没有什么两样，但内部结构不简单。USBKEY内置单片机或智能卡芯片，有一定的存储空间，可以存储用户数字证书信息，利用USBKEY内置的公钥算法实现对用户身份的认证。&lt;/p&gt;

&lt;p&gt;USB Key是国内很多银行采用的客户端认证方案，用户的私钥在高度安全的USB Key内产生，并且终身不可导出到USB Key外部，交易签名也在USB Key内进行，所以安全强度非常高。用户私钥保存在密码锁中，理论上使用任何方式都无法读取，因此保证了用户认证信息的安全性。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;双因子认证&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;每个USB key都有一个硬件PIN码，PIN码可以理解为使用USB key所需的密码。USB Key的硬件和PIN码构成了可以使用证书的两个必要因素，这就是双因子认证。&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;带有安全存储空间
USB key内置了CPU或智能卡芯片，芯片中集成了数据加解密、签名验签、消息摘要等各种密码算法。硬件实现密码算法相比于软件实现密码算法，最大的好处是密码运算在key中进行，保证了密钥永不出key，不会出现在计算机的内存中，这也就防止了黑客获取密钥，保证了密钥的安全性。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;硬件实现密码算法
USB key内置了CPU或智能卡芯片，芯片中集成了数据加解密、签名验签、消息摘要等各种密码算法。硬件实现密码算法相比于软件实现密码算法，最大的好处是密码运算在key中进行，保证了密钥永不出key，不会出现在计算机的内存中，这也就防止了黑客获取密钥，保证了密钥的安全性。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;便于携带、安全可靠
USB key类似于U盘，非常的小巧，便于携带。并且key中的证书和密钥不可导出，key的硬件不可复制，更加安全可靠。&lt;/p&gt;
    &lt;h2 id=&quot;2-usbkey应用&quot;&gt;2 USBkey应用&lt;/h2&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;现在USBKey主要有三个方向的应用。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;第一，当加密狗使用&lt;/strong&gt;。刚开始的时候，加密狗使用的是串口，当USB接口普及了之后，就改成了USB接口。在应该说，USBKey是从加密狗发展过来的，加密狗的作用是防止未授权的用户对软件进行复制和破解。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;第二，当电脑开机的钥匙使用&lt;/strong&gt;。此时，USBKey是用来验证用户的身份，和智能卡的作用差不多。与生物识别（比如指纹识别）的系统对比来说，USBKey的实现更简单，费用也更低。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;第三、用来存储数字证书以及私钥，实现保密通信和身份验证&lt;/strong&gt;。这也是现在用的最多的USBKey的应用。比如建设银行的网银就要使用USBKey才能进行转账等操作。&lt;/p&gt;

&lt;h4 id=&quot;reference&quot;&gt;reference：&lt;/h4&gt;
&lt;p&gt;[1] &lt;a href=&quot;https://blog.csdn.net/qq_36412715/article/details/83538445?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1&amp;amp;utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1&quot;&gt;USB KEY了解&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[2] &lt;a href=&quot;https://www.ezloo.com/2008/10/usbkey.html&quot;&gt;曙光博客，USB KEY&lt;/a&gt;&lt;/p&gt;</content><author><name>surrender</name></author><category term="背景知识" /><category term="USBkey" /><category term="硬件" /><category term="2020年" /><summary type="html">USB可以最常见的应用是作为网银U盾。 那是淘宝刚兴起的时候，为了能方便地购物，我在柜员的帮助（忽悠）下办理了人生中的第一个U盾…</summary></entry><entry><title type="html">智能卡起源及分类</title><link href="https://surrender2xyz.github.io/%E8%83%8C%E6%99%AF%E7%9F%A5%E8%AF%86/2020/04/05/%E6%99%BA%E8%83%BD%E5%8D%A1/" rel="alternate" type="text/html" title="智能卡起源及分类" /><published>2020-04-05T00:00:00+00:00</published><updated>2020-04-05T00:00:00+00:00</updated><id>https://surrender2xyz.github.io/%E8%83%8C%E6%99%AF%E7%9F%A5%E8%AF%86/2020/04/05/%E6%99%BA%E8%83%BD%E5%8D%A1</id><content type="html" xml:base="https://surrender2xyz.github.io/%E8%83%8C%E6%99%AF%E7%9F%A5%E8%AF%86/2020/04/05/%E6%99%BA%E8%83%BD%E5%8D%A1/">&lt;h1 id=&quot;0-前言&quot;&gt;0 前言&lt;/h1&gt;
&lt;hr /&gt;

&lt;blockquote&gt;
  &lt;p&gt;本文介绍了智能卡（IC卡）的起源以及智能卡的不同分类方式&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1 id=&quot;1-什么是智能卡&quot;&gt;1 什么是智能卡？&lt;/h1&gt;
&lt;hr /&gt;

&lt;h3 id=&quot;起源&quot;&gt;起源&lt;/h3&gt;
&lt;p&gt;智能卡的最初设想是由日本人提出来的。1969年12月，日本的有村国孝提出一种制造安全可靠的信用卡方法，并于1970年获得专利，那时叫ID卡。1974年，法国的罗兰— 莫雷诺发明了带集成电路芯片的塑料卡片，并取得了专利权，这就是早期的智能卡。1976年法国布尔公司研制出世界第一枚智能卡。1984年，法国的PTT将智能卡用于电话卡，由于智能卡良好的安全性和可靠性，获得了意想不到的成功。&lt;/p&gt;

&lt;p&gt;智能卡最早是在法国问世的。1974年，法国人罗兰德·莫瑞诺(Roland Moreno)第一次将可进行编程设置的IC( Integrated Circuit)芯片放于卡片中，使卡片具有更多的功能，并取得了专利权（早期的智能卡）。当时他在专利申请书中有如下阐述：卡片上具有可进行自我保护的存储器。就这样，世界上第一张IC卡诞生了。&lt;/p&gt;

&lt;p&gt;1976年法国布尔公司研制出世界第一枚智能卡。&lt;/p&gt;

&lt;p&gt;1984年，法国的PTT将智能卡用于电话卡，由于智能卡良好的安全性和可靠性，获得了意想不到的成功。&lt;/p&gt;

&lt;h3 id=&quot;名称&quot;&gt;名称&lt;/h3&gt;

&lt;p&gt;自IC卡出现后，国际上对它有多种叫法。英文名称有“Smart Card”、“IC Card”等；港、台地区，则多称为“聪明卡”、“智慧卡”及“智能卡”等；而在内地，人们一般称之为“&lt;strong&gt;IC卡&lt;/strong&gt;”或“&lt;strong&gt;智能卡&lt;/strong&gt;”。这么多种叫法，总要有一个是标准。所以，国际标准化组织使用ICC(Integrated Circuit Card)，也就是 “&lt;strong&gt;集成电路卡&lt;/strong&gt;”来涵盖所有符合定义的“智能卡”。&lt;/p&gt;

&lt;h1 id=&quot;2-智能卡的分类&quot;&gt;2 智能卡的分类&lt;/h1&gt;
&lt;hr /&gt;

&lt;h3 id=&quot;根据是否和读卡器接触可分为&quot;&gt;根据是否和读卡器接触可分为：&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;接触式智能卡&lt;/strong&gt;：通过读写设备的出点与IC卡的出点接触后进行数据读写。典型的如磁条卡（银行卡）、芯片卡。
    &lt;ul&gt;
      &lt;li&gt;存储卡或记忆卡（Memory Card）&lt;/li&gt;
      &lt;li&gt;带有CPU的智能卡（Smart Card）&lt;/li&gt;
      &lt;li&gt;带有显示器及键盘、CPU的超级智能卡&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;非接触式智能卡&lt;/strong&gt;（又称射频卡）：与IC卡设备无电路接触，而是通过非接触式的RFID读写技术尽心读写。由于非接触式智能卡的无源和免接触特性，卡的使用寿命和安全性大大提高，目前应用越来越广泛。一般用在使用频繁、信息量相对较少、可靠性要求较高的场合，典型的如二代身份证、门禁卡。
    &lt;ul&gt;
      &lt;li&gt;射频加密式(RF ID)：通常称为ID卡。射频卡的信息存取是通过无线电波完成的。主机和射频之间没有机械接触点。&lt;/li&gt;
      &lt;li&gt;射频存储卡(RF IC)：通常称为非接触IC卡。射频储存卡也是通过无线电来存取信息。它是在存储卡基础上增加了射频收发电路。&lt;/li&gt;
      &lt;li&gt;射频CPU卡(RF CPU)：通常称为有源卡，是在CPU卡的基础上增加了射频收发电路。CPU卡拥有自己的操作系统COS，才称得上是真正的智能卡。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;双界面卡&lt;/strong&gt;(也称复合卡)：将接触式IC卡与非接触式IC卡组合到一张卡片中，同时具有接触和非接触式接口，操作独立，但共用CPU和存储空间。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;根据结构可分为&quot;&gt;根据&lt;strong&gt;结构&lt;/strong&gt;可分为：&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;非加密存储器卡&lt;/strong&gt;：卡内的集成电路芯片主要是EEPROM，具有数据存储功能，不具有数据处理功能和硬件加密功能。&lt;/p&gt;

    &lt;p&gt;就像一个无人看守且大门敞开的仓库，什么人都可以随便在卡中存取数据；&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;逻辑加密存储器卡&lt;/strong&gt;:在非加密存储器卡的基础上增加了加密逻辑电路，加密逻辑电路通过校验密码方式来保护卡内的数据对于外部访问是否开放，但只是低层次的安全保护，无法防范恶意性的攻击。&lt;/p&gt;

    &lt;p&gt;给仓库加了一把锁，只有有钥匙（密码）的人才能打开使用。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;CPU卡&lt;/strong&gt;:也称智能卡，卡内的集成电路中带有微处理器CPU、存储单元（包括随机存储器RAM、程序存储器ROM（FLASH）、用户数据存储器EEPROM）以及芯片操作系统COS。装有COS的CPU卡相当于一台微型计算机，不仅具有数据存储功能，同时具有命令处理和数据安全保护等功能。&lt;/p&gt;

    &lt;p&gt;如同安排了专人看守仓库，卡里面有CPU芯片，存储数据要验证口令，且可能不同的应用有不同口令，存取数据受到更加严格的控制，安全性最高。&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;==备注==：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;IC卡根据内部封装的集成电路是否有处理器可以分为：存储卡、智能卡。因此，前文所述“智能卡”并非真正的智能，而一般认为拥有CPU的IC卡才是真正意义上的智能卡。&lt;/li&gt;
  &lt;li&gt;初稿完成于2020.04.05&lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;3-refernence&quot;&gt;3 REFERNENCE&lt;/h1&gt;
&lt;hr /&gt;

&lt;p&gt;[1] &lt;a href=&quot;https://blog.csdn.net/Ceekin/article/details/81335230?ops_request_misc=%7B%22request%5Fid%22%3A%22158606532219726867827442%22%2C%22scm%22%3A%2220140713.130056874..%22%7D&amp;amp;request_id=158606532219726867827442&amp;amp;biz_id=0&amp;amp;utm_source=distribute.pc_search_result.none-task-blog-blog_SOOPENSEARCH-13&quot;&gt;智能卡简介、分类以及程序开发用到的协议&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[2] &lt;a href=&quot;https://mp.weixin.qq.com/s/wEKFNwUegeqosDsMSaxYbA&quot;&gt;IC卡根据使用方式不同分为不同的种类 胡记面 &lt;em&gt;2014-02-27&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[3] &lt;a href=&quot;https://mp.weixin.qq.com/s?src=3&amp;amp;timestamp=1586065035&amp;amp;ver=1&amp;amp;signature=FDIa09PW3nKTzHPgNabnBz8t-U2FgCTGGKPaDMP5gJAdRfeBg-W1qK*OBEfbiliMQCeCSse9oyN-IeyG7q239HJuIQ3btEjsmMX87txz9mBA6upgjQ6VsuvKeLRmDxRfBsRXmATvyu4T7LfiyrskKAJEYEUL9p*-JEpuNiwdG-4=&quot;&gt;一卡通天下, 带你走进智能卡的前世今生 &lt;em&gt;2017-05-10&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[4] &lt;a href=&quot;https://blog.csdn.net/u012599619/article/details/44812751?depth_1-utm_source=distribute.pc_relevant.none-task-blog-OPENSEARCH-10&amp;amp;utm_source=distribute.pc_relevant.none-task-blog-OPENSEARCH-10&quot;&gt;L-yh 2-1, 简述智能卡的发展，以及射频电子标签在其中所处的位置 &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[5] &lt;a href=&quot;https://baike.baidu.com/item/非接触式IC卡&quot;&gt;百度文库，非接触式IC卡&lt;/a&gt;&lt;/p&gt;</content><author><name>surrender</name></author><category term="背景知识" /><category term="智能卡" /><category term="IC卡" /><category term="硬件" /><category term="2020年" /><summary type="html">0 前言</summary></entry><entry><title type="html">Hello, 2020, THIS IS MY FIRST BLOG!</title><link href="https://surrender2xyz.github.io/2020/04/04/Hello-2020/" rel="alternate" type="text/html" title="Hello, 2020, THIS IS MY FIRST BLOG!" /><published>2020-04-04T22:46:49+00:00</published><updated>2020-04-04T22:46:49+00:00</updated><id>https://surrender2xyz.github.io/2020/04/04/Hello-2020</id><content type="html" xml:base="https://surrender2xyz.github.io/2020/04/04/Hello-2020/">&lt;blockquote&gt;
  &lt;p&gt;“🙉🙉🙉 ”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;前言&quot;&gt;前言&lt;/h2&gt;

&lt;hr /&gt;

&lt;p&gt;在一次偶然间，看到好基友 &lt;strong&gt;蒋彦祖&lt;/strong&gt; 分享的个人博客&lt;a href=&quot;https://hailangjiang.top/&quot;&gt;浪里个浪&lt;/a&gt;，用的还是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.top&lt;/code&gt;这种帅气的顶级域名，于是萌生了必须建站的想法:smile:.&lt;/p&gt;

&lt;p&gt;再者，很久以前就跟着Oeasy老师学习建站，老师讲的非常好，但我…惭愧惭愧…总之，后来因为各种原因不了了之:cry:。&lt;/p&gt;

&lt;p&gt;最近一直在学习新的知识(PHP你敢信？)，会搜集、整理很多资料。因此有必要倒腾出一个Blog来呈现、收纳，以便日后回顾。&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;正文&quot;&gt;正文&lt;/h2&gt;

&lt;hr /&gt;

&lt;p&gt;接下来说说搭建这个博客的技术细节。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://pages.github.com/&quot;&gt;GitHub Pages&lt;/a&gt; + &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt; 快速 Building Blog 的技术方案，非常轻松时尚。&lt;/p&gt;

&lt;p&gt;其优点非常明显：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;对不爱折腾党十分友好&lt;/li&gt;
  &lt;li&gt;支持&lt;strong&gt;Markdown&lt;/strong&gt; 优雅写作体验&lt;/li&gt;
  &lt;li&gt;利用 GitHub Pages 的域名和免费无限空间，不用自己折腾主机
    &lt;ul&gt;
      &lt;li&gt;如果需要自定义域名，也只需要简单改改 DNS 加个 CNAME&lt;/li&gt;
      &lt;li&gt;免费域名一般为username.github.io，本blog的域名就是&lt;a href=&quot;https://surrender2xyz.github.io/&quot;&gt;surrender2xyz.github.io&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Jekyll 是一个非常好的模版，可以自由定制blog的外观、功能。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;致谢&quot;&gt;致谢&lt;/h2&gt;

&lt;hr /&gt;

&lt;p&gt;博客能够搭建，首先感谢以下几位:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;table&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td&gt;主要参考了[柏荧的博客&lt;/td&gt;
          &lt;td&gt;BY Blog](http://qiubaiying.github.io/)，半小时到一小时你就可以搭建成功！&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;归档功能&lt;/strong&gt;参考了&lt;a href=&quot;https://github.com/lucienhsu/lucienhsu.github.io&quot;&gt;lucienhsu&lt;/a&gt;。如果你也想增加此功能，请参考issue&lt;a href=&quot;https://github.com/qiubaiying/qiubaiying.github.io/issues/178&quot;&gt;能否增加访问量显示功能和归档的功能？&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;访客统计功能&lt;/strong&gt;如访问量人数、人次、单页访问次数等，参考了&lt;a href=&quot;https://github.com/yizibi/yizibi.github.io&quot;&gt;yizibi&lt;/a&gt;。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;评论功能&lt;/strong&gt;使用了Gitalk，参考了&lt;a href=&quot;http://qiubaiying.vip/2017/12/19/为博客添加-Gitalk-评论插件/&quot;&gt;为博客添加 Gitalk 评论插件&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;如果你恰好逛到了这里，希望你也能喜欢这个博客主题，感兴趣的话可以自己动手搭建一个。&lt;/p&gt;

&lt;p&gt;—— surrender 后记于 2020.04&lt;/p&gt;</content><author><name>surrender</name></author><category term="生活" /><summary type="html">“🙉🙉🙉 ”</summary></entry><entry><title type="html">Gallery Post</title><link href="https://surrender2xyz.github.io/photo/test/2014/11/18/gallery-post/" rel="alternate" type="text/html" title="Gallery Post" /><published>2014-11-18T15:45:20+00:00</published><updated>2014-11-18T15:45:20+00:00</updated><id>https://surrender2xyz.github.io/photo/test/2014/11/18/gallery-post</id><content type="html" xml:base="https://surrender2xyz.github.io/photo/test/2014/11/18/gallery-post/">&lt;p&gt;Nunc dignissim volutpat enim, non sollicitudin purus dignissim id. Nam sit amet urna eu velit lacinia eleifend. Proin auctor rhoncus ligula nec aliquet. Donec sodales molestie lacinia. Curabitur dictum faucibus urna at convallis. Aliquam in lectus at urna rutrum porta. In lacus arcu, molestie ut vestibulum ut, rhoncus sed eros. Sed et elit vitae risus pretium consectetur vel in mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi tempus turpis quis lectus rhoncus adipiscing. Proin pulvinar placerat suscipit. Maecenas imperdiet, quam vitae varius auctor, enim mauris vulputate sapien, nec laoreet neque diam non quam.&lt;/p&gt;

&lt;!-- more --&gt;

&lt;p&gt;&lt;img src=&quot;http://ww1.sinaimg.cn/large/81b78497jw1emfgts2pt4j21hc0u0k1c.jpg&quot; alt=&quot;Wallbase - dgnfly (wallbase.cc/wallpaper/1384450)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Etiam luctus mauris at mi sollicitudin quis malesuada nibh porttitor. Vestibulum non dapibus magna. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin feugiat hendrerit viverra. Phasellus sit amet nunc mauris, eu ultricies tellus. Sed a mi tortor, eleifend varius erat. Proin consectetur molestie tortor eu gravida. Cras placerat orci id arcu tristique ut rutrum justo pulvinar. Maecenas lacinia fringilla diam non bibendum. Aenean vel viverra turpis. Integer ut leo nisi. Pellentesque vehicula quam ut sapien convallis consequat. Aliquam ut arcu purus, eget tempor purus. Integer eu tellus quis erat tristique gravida eu vel lorem.&lt;/p&gt;</content><author><name>Surrender</name></author><category term="[&quot;Photo&quot;, &quot;test&quot;]" /><category term="consectetur" /><summary type="html">Nunc dignissim volutpat enim, non sollicitudin purus dignissim id. Nam sit amet urna eu velit lacinia eleifend. Proin auctor rhoncus ligula nec aliquet. Donec sodales molestie lacinia. Curabitur dictum faucibus urna at convallis. Aliquam in lectus at urna rutrum porta. In lacus arcu, molestie ut vestibulum ut, rhoncus sed eros. Sed et elit vitae risus pretium consectetur vel in mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi tempus turpis quis lectus rhoncus adipiscing. Proin pulvinar placerat suscipit. Maecenas imperdiet, quam vitae varius auctor, enim mauris vulputate sapien, nec laoreet neque diam non quam.</summary></entry><entry><title type="html">MathJax with Jekyll</title><link href="https://surrender2xyz.github.io/test/2014/02/16/Mathjax-with-jekyll/" rel="alternate" type="text/html" title="MathJax with Jekyll" /><published>2014-02-16T00:00:00+00:00</published><updated>2014-02-16T00:00:00+00:00</updated><id>https://surrender2xyz.github.io/test/2014/02/16/Mathjax-with-jekyll</id><content type="html" xml:base="https://surrender2xyz.github.io/test/2014/02/16/Mathjax-with-jekyll/">&lt;p&gt;One of the rewards of switching my website to &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt; is the
ability to support &lt;strong&gt;MathJax&lt;/strong&gt;, which means I can write LaTeX-like equations that get
nicely displayed in a web browser, like this one \( \sqrt{\frac{n!}{k!(n-k)!}} \) or
this one \( x^2 + y^2 = r^2 \).&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;&lt;img class=&quot;centered&quot; src=&quot;https://www.mathjax.org/badge/mj-logo.svg&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;whats-mathjax&quot;&gt;What’s MathJax?&lt;/h3&gt;

&lt;p&gt;If you check MathJax website &lt;a href=&quot;http://www.mathjax.org/&quot;&gt;(www.mathjax.org)&lt;/a&gt; you’ll see
that it &lt;em&gt;is an open source JavaScript display engine for mathematics that works in all
browsers&lt;/em&gt;.&lt;/p&gt;

&lt;h3 id=&quot;how-to-implement-mathjax-with-jekyll&quot;&gt;How to implement MathJax with Jekyll&lt;/h3&gt;

&lt;p&gt;I followed the instructions described by Dason Kurkiewicz for
&lt;a href=&quot;http://dasonk.github.io/blog/2012/10/09/Using-Jekyll-and-Mathjax/&quot;&gt;using Jekyll and Mathjax&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here are some important details. I had to modify the Ruby library for Markdown in
my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_config.yml&lt;/code&gt; file. Now I’m using redcarpet so the corresponding line in the
configuration file is: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;markdown: redcarpet&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To load the MathJax javascript, I added the following lines in my layout &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;post.html&lt;/code&gt;
(located in my folder &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_layouts&lt;/code&gt;)&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-r&quot; data-lang=&quot;r&quot;&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Of course you can choose a different file location in your jekyll layouts.&lt;/p&gt;

&lt;p&gt;Note that by default, the &lt;strong&gt;tex2jax&lt;/strong&gt; preprocessor defines the
LaTeX math delimiters, which are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\\(...\\)&lt;/code&gt; for in-line math, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\\[...\\]&lt;/code&gt; for
displayed equations. It also defines the TeX delimiters &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$$...$$&lt;/code&gt; for displayed
equations, but it does not define &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$...$&lt;/code&gt; as in-line math delimiters. To enable in-line math delimiter with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$...$&lt;/code&gt;, please use the following configuration:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-r&quot; data-lang=&quot;r&quot;&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;text/x-mathjax-config&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MathJax.Hub.Config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tex2jax&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;inlineMath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'$'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'$'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\\('&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'\\)'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;processEscapes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;a-couple-of-examples&quot;&gt;A Couple of Examples&lt;/h3&gt;

&lt;p&gt;Here’s a short list of examples. To know more about the details behind MathJax, you can
always checked the provided documentation available at
&lt;a href=&quot;http://docs.mathjax.org/en/latest/&quot;&gt;http://docs.mathjax.org/en/latest/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s try a first example. Here’s a dummy equation:&lt;/p&gt;

\[a^2 + b^2 = c^2\]

&lt;p&gt;How do you write such expression? Very simple: using &lt;strong&gt;double dollar&lt;/strong&gt; signs&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-r&quot; data-lang=&quot;r&quot;&gt;&lt;span class=&quot;o&quot;&gt;$$&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;$$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To display inline math use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\\( ... \\)&lt;/code&gt; like this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\\( sin(x^2) \\)&lt;/code&gt; which gets
rendered as \( sin(x^2) \)&lt;/p&gt;

&lt;p&gt;Here’s another example using type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\mathsf&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-r&quot; data-lang=&quot;r&quot;&gt;&lt;span class=&quot;o&quot;&gt;$$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mathsf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Data&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PCs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;times&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mathsf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Loadings&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;$$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;which gets displayed as&lt;/p&gt;

\[\mathsf{Data = PCs} \times \mathsf{Loadings}\]

&lt;p&gt;Or even better:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-r&quot; data-lang=&quot;r&quot;&gt;&lt;span class=&quot;err&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mathbf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;X&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mathbf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Z&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mathbf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;P&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mathsf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;is displayed as&lt;/p&gt;

&lt;p&gt;\[ \mathbf{X} = \mathbf{Z} \mathbf{P^\mathsf{T}} \]&lt;/p&gt;

&lt;p&gt;If you want to use subscripts like this \( \mathbf{X}_{n,p} \) you need to scape the
underscores with a backslash like so &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\mathbf{X}\_{n,p}&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-r&quot; data-lang=&quot;r&quot;&gt;&lt;span class=&quot;o&quot;&gt;$$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mathbf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;X&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mathbf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mathbf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;$$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;will be displayed as&lt;/p&gt;

&lt;p&gt;\[ \mathbf{X}_{n,p} = \mathbf{A}_{n,k} \mathbf{B}_{k,p} \]&lt;/p&gt;</content><author><name>Surrender</name></author><category term="test" /><category term="resources" /><category term="jekyll" /><summary type="html">One of the rewards of switching my website to Jekyll is the ability to support MathJax, which means I can write LaTeX-like equations that get nicely displayed in a web browser, like this one \( \sqrt{\frac{n!}{k!(n-k)!}} \) or this one \( x^2 + y^2 = r^2 \).</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://gastonsanchez.com/images/blog/mathjax_logo.png" /><media:content medium="image" url="http://gastonsanchez.com/images/blog/mathjax_logo.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>