<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>NLP on jeffcarp</title>
    <link>/categories/nlp/</link>
    <description>Recent content in NLP on jeffcarp</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 04 Jul 2020 10:44:41 -0800</lastBuildDate>
    <atom:link href="/categories/nlp/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>用20行Python构建Markov Chain语句生成器</title>
      <link>/posts/2020/markov-chain-python-zh/</link>
      <pubDate>Sat, 04 Jul 2020 10:44:41 -0800</pubDate>
      <guid>/posts/2020/markov-chain-python-zh/</guid>
      <description>&lt;blockquote&gt;&#xA;&lt;p&gt;A bot who can write a long letter with ease, cannot write ill.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;small&gt;&lt;em&gt;—Jane Austen, Pride and Prejudice&lt;/em&gt;&lt;/small&gt;&lt;/p&gt;&#xA;&lt;p&gt;这篇文章将引导您逐步学习如何使用Python从头开始编写马尔可夫链(&lt;a href=&#34;https://en.wikipedia.org/wiki/Markov_chain&#34;&gt;Markov&#xA;Chain&lt;/a&gt;)，以生成好像一个真实的人写的英语的全新句子。&#xA;简·奥斯丁的《傲慢与偏见》(&lt;a href=&#34;https://www.goodreads.com/book/show/1885.Pride_and_Prejudice&#34;&gt;Pride and Prejudice by Jane&#xA;Austen&lt;/a&gt;)&#xA;是我们用来构建马尔可夫链的文字。&#xA;&lt;a href=&#34;https://colab.research.google.com/drive/14KjFfYEVhFl3nyuGZtFi1vnv5hN88Qn2&#34;&gt;Colab&lt;/a&gt;&#xA;上有一篇可运行的笔记本版本。&lt;/p&gt;&#xA;&lt;p class=&#34;aside&#34;&gt;&#xA;Read&#xA;&lt;a href=&#34;/posts/2019/markov-chain-python/&#34;&gt;the English version of this post here&lt;/a&gt;.&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;setup&#34;&gt;Setup&lt;/h2&gt;&#xA;&lt;p&gt;首先下载“傲慢与偏见”的全文。&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 下载Pride and Prejudice和并切断头.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;!&lt;/span&gt;curl https:&lt;span style=&#34;color:#f92672&#34;&gt;//&lt;/span&gt;www&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;gutenberg&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;org&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;files&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1342&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1342&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0.&lt;/span&gt;txt &lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt; tail &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;n&lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;content&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;pride&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;prejudice&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;txt&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 预览文件.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;!&lt;/span&gt;head &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;n &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;content&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;pride&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;prejudice&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;txt&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;pre&gt;&lt;code&gt;  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current&#xA;                                 Dload  Upload   Total   Spent    Left  Speed&#xA;100  707k  100  707k    0     0  1132k      0 --:--:-- --:--:-- --:--:-- 1130k&#xA;PRIDE AND PREJUDICE&#xA;&#xA;By Jane Austen&#xA;&#xA;&#xA;&#xA;Chapter 1&#xA;&#xA;&#xA;It is a truth universally acknowledged, that a single man in possession&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;添加一些必要的导入。&lt;/p&gt;</description>
    </item>
    <item>
      <title>How are Words Represented in Machine Learning?</title>
      <link>/posts/2019/how-are-words-represented-in-machine-learning/</link>
      <pubDate>Sat, 13 Jul 2019 01:31:29 +0000</pubDate>
      <guid>/posts/2019/how-are-words-represented-in-machine-learning/</guid>
      <description>&lt;p class=&#34;aside&#34;&gt;&#xA;    &lt;b&gt;Note:&lt;/b&gt;This post had a good run, but it is now very out of date.&#xA;    Check out newer content around &lt;a href=&#34;https://huggingface.co/learn/llm-course/en/chapter2/4&#34;&gt;tokenizers&lt;/a&gt;&#xA;    for a more up-to-date view.&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Machine learning on human languages is a super exciting space right now.&#xA;Applications are exploding&amp;mdash;just think of how many natural language ML models&#xA;it takes to run a smart assistant, from transforming spoken audio to text,&#xA;to finding the exact part of a web page that answers your question, to choosing&#xA;the correct words with the correct grammar to reply to you.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Build a Markov Chain Sentence Generator in 20 lines of Python</title>
      <link>/posts/2019/markov-chain-python/</link>
      <pubDate>Wed, 16 Jan 2019 10:44:41 -0800</pubDate>
      <guid>/posts/2019/markov-chain-python/</guid>
      <description>&lt;blockquote&gt;&#xA;&lt;p&gt;A bot who can write a long letter with ease, cannot write ill.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;small&gt;&lt;em&gt;—Jane Austen, Pride and Prejudice&lt;/em&gt;&lt;/small&gt;&lt;/p&gt;&#xA;&lt;p&gt;This post walks you through how to write a &lt;a href=&#34;https://en.wikipedia.org/wiki/Markov_chain&#34;&gt;Markov&#xA;Chain&lt;/a&gt; from scratch with Python in&#xA;order to generate completely new sentences that resemble English.&lt;/p&gt;&#xA;&lt;p&gt;The text we&amp;rsquo;ll be using to build the Markov Chain is &lt;a href=&#34;https://www.goodreads.com/book/show/1885.Pride_and_Prejudice&#34;&gt;Pride and Prejudice by&#xA;Jane Austen&lt;/a&gt;. You&#xA;can follow along here or grab a runnable notebook version of this post on&#xA;&lt;a href=&#34;https://colab.research.google.com/drive/14KjFfYEVhFl3nyuGZtFi1vnv5hN88Qn2&#34;&gt;Colab&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
