<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>tokenization on S Anand</title>
    <link>https://www.s-anand.net/blog/tag/tokenization/</link>
    <description>Recent content in tokenization on S Anand</description>
    <generator>Hugo -- 0.164.0</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 25 Feb 2024 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.s-anand.net/blog/tag/tokenization/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Things I Learned - 25 Feb 2024</title>
      <link>https://www.s-anand.net/blog/things-i-learned-25-feb-2024/</link>
      <pubDate>Sun, 25 Feb 2024 00:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/things-i-learned-25-feb-2024/</guid>
      <description>&lt;p&gt;This week, I learned:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/rust-lang/rust-analyzer/blob/d7c99931d05e3723d878bea5dc26766791fa4e69/docs/dev/architecture.md&#34;&gt;Architecture.md&lt;/a&gt; is an &lt;a href=&#34;https://matklad.github.io/2021/02/06/ARCHITECTURE.md.html&#34;&gt;emerging standard&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing wealth requires training.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://leanrada.com/htmz/&#34;&gt;htmz&lt;/a&gt; is a fantastic way to load HTML into elements!&lt;/li&gt;
&lt;li&gt;Suguna Poultry is
&lt;ul&gt;
&lt;li&gt;Using robots to walk in their farms, use sound and bird eyes and movement to predict birth health over 1-2 weeks&lt;/li&gt;
&lt;li&gt;Light on the back of the bird&amp;rsquo;s back AND face =&amp;gt; lays eggs in 14 days, else takes days later (girls and mobile phones?)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Teknoturf is using Gen AI to
&lt;ul&gt;
&lt;li&gt;Improve prompts when teaching prompt engineering.&lt;/li&gt;
&lt;li&gt;Pronounce languages better, identifying which words Tamilians and Malayalis will mis-pronounce.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Explore IRBlaster. It can control AC and can automatically increase temperature at night.&lt;/li&gt;
&lt;li&gt;My view: LLMs are general purpose and more capable than SLMs. They&amp;rsquo;ll win, like CPUs won over special-purpose chips. GPUs will optimize for LLMs and as usage grows, cost will fall.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=zduSFxRajkE&amp;amp;t=6701s&#34;&gt;Andrej Karpathy&amp;rsquo;s summary of sharp edges in tokenization&lt;/a&gt; uses &lt;a href=&#34;https://tiktokenizer.vercel.app/&#34;&gt;tiktokenizer&lt;/a&gt; to explain:
&lt;ul&gt;
&lt;li&gt;Why LLMs can&amp;rsquo;t be used for spelling&lt;/li&gt;
&lt;li&gt;Why LLMs are better at English than other languages&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.beren.io/2023-02-04-Integer-tokenization-is-insane/&#34;&gt;Why LLMs are bad at math&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Why &lt;a href=&#34;https://www.lesswrong.com/posts/aPeJE8bSo6rAFoLqg/solidgoldmagikarp-plus-prompt-generation&#34;&gt;SolidGoldMagiKarp&lt;/a&gt; is a single token&lt;/li&gt;
&lt;li&gt;Why trailing spaces are bad&lt;/li&gt;
&lt;li&gt;Why YAML tokenizes more efficiently than JSON&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://ssyoutube.com&#34;&gt;ssyoutube.com&lt;/a&gt;: Just add &amp;ldquo;ss&amp;rdquo; to &amp;ldquo;youtube.com&amp;rdquo; on the video and you can download YouTube videos&lt;/li&gt;
&lt;li&gt;Discussions with Sachin, AMAT
&lt;ul&gt;
&lt;li&gt;Microsoft said Indigo, Air India uses LLM based bookings&lt;/li&gt;
&lt;li&gt;Meta invested $70bn in GPUs. Sam Altman is investing $7tn!&lt;/li&gt;
&lt;li&gt;NVIDIA has a price PREMIUM not discount for bulk GPUs!&lt;/li&gt;
&lt;li&gt;AMD is the next company to watch for&lt;/li&gt;
&lt;li&gt;Numenta - Subutai Ahmad - deploys AI models on CPUs&lt;/li&gt;
&lt;li&gt;#TODO Read A Thousand Brains by Subutai Ahmad&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.linkedin.com/in/sanjeevsharmaiitr/&#34;&gt;Sanjeev Sharma&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Swaayatt Robots: Autonomous driving in India&lt;/li&gt;
&lt;li&gt;Deepeigen: Education&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.linkedin.com/in/rohanshravan/&#34;&gt;Rohan Shravan&lt;/a&gt;, Bangalore.
&lt;ul&gt;
&lt;li&gt;Likes sharing knowledge. Amazing teacher. IIT KGP 2008. Interested in exploring quantum computing&lt;/li&gt;
&lt;li&gt;Tresa Motors, Inkers App, The School of AI&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;AMAT is working on
&lt;ul&gt;
&lt;li&gt;photon-based computing.&lt;/li&gt;
&lt;li&gt;science research models. AI for science. Like Google: Deepmind Genome, Microsoft: Metagen&lt;/li&gt;
&lt;li&gt;quantum: AMAT is actively in into this. Nagapati Banda is driving this&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;John Kelly is predicting a ChatGPT moment in quantum in a few years&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Adobe express has a forever free &lt;a href=&#34;https://new.express.adobe.com/tools/convert-to-gif&#34;&gt;video to GIF converter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Edge workspaces let me keep the same tabs open across laptops!&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://clig.dev/&#34;&gt;Command line interface guidelines&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;RAWGraphs has a &lt;a href=&#34;https://www.rawgraphs.io/custom-charts&#34;&gt;custom charts API&lt;/a&gt; that is worth learning from&lt;/li&gt;
&lt;li&gt;Python &lt;a href=&#34;https://fastpages.fast.ai/fastcore/&#34;&gt;fastcore&lt;/a&gt; has decorators like @typedispatch, Self, etc.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://huggingface.co/models?library=transformers&amp;amp;pipeline_tag=image-to-text&#34;&gt;All image-to-text models on HuggingFace&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://adamobeng.com/wddbfs-mount-a-sqlite-database-as-a-filesystem/&#34;&gt;wddbfs&lt;/a&gt; mounts SQLite as a file system. I had a bit of trouble, maybe with Python package versions.&lt;/li&gt;
&lt;li&gt;Google is using &lt;a href=&#34;https://security.googleblog.com/2023/08/ai-powered-fuzzing-breaking-bug-hunting.html&#34;&gt;LLM powered bug identification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://huggingface.co/chat/assistants&#34;&gt;HuggingFace Chat Assistants&lt;/a&gt; has open source system prompts!!&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://huggingface.co/datasets/teknium/OpenHermes-2.5&#34;&gt;OpenHermes training dataset&lt;/a&gt; is available. 1M prompts!&lt;/li&gt;
&lt;li&gt;Jio has made IPL free. They make money on data and ads. That&amp;rsquo;s Scale!&lt;/li&gt;
&lt;li&gt;Daniel Dennett &lt;a href=&#34;https://behavioralscientist.org/ive-been-thinking-daniel-dennett-what-if-im-wrong/&#34;&gt;outsources thinking to students&lt;/a&gt;. Reviewing his books.
&lt;ul&gt;
&lt;li&gt;BUT: I don&amp;rsquo;t take feedback. When someone sends a pull requests, I ignore it.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    <item>
      <title>Splitting a sentence into words</title>
      <link>https://www.s-anand.net/blog/splitting-a-sentence-into-words/</link>
      <pubDate>Thu, 26 Apr 2007 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/splitting-a-sentence-into-words/</guid>
      <description>&lt;p&gt;I often need to extract words out of sentences. It&amp;rsquo;s one of the things I used to build the &lt;a href=&#34;https://www.s-anand.net/blog/statistically-improbable-phrases-2/&#34;&gt;Statistically Improbable Phrases for Calvin and Hobbes&lt;/a&gt;. But splitting a sentence into words isn&amp;rsquo;t as easy as you think.&lt;/p&gt;
&lt;p&gt;Think about it. &lt;strong&gt;What is a word&lt;/strong&gt;?&lt;/p&gt;
&lt;p&gt;Something that has spaces around it? OK, let&amp;rsquo;s start with the simplest way to get words: &lt;strong&gt;split by spaces&lt;/strong&gt;. Consider this piece:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&amp;#34;I&amp;#39;d look at McDonald&amp;#39;s,&amp;#34; he said.
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&amp;#34;They sell over 3,000,000 burgers a day -- at $1.50 each.&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;High-fat foods were the rage. For e.g., margins in fries
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;were over 50%... and (except for R&amp;amp;M &amp;amp; Dyana [sic]) everyone
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;was at ~30% net margin; growing at 25% too!
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Splitting this by spaces (consider new lines, tabs, etc as spaces too.), we get the following:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&amp;#34;I&amp;#39;d
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;look
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;at
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;McDonald&amp;#39;s,&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now, some of these like &amp;ldquo;I&amp;rsquo;d&amp;rdquo; are words. But &amp;ldquo;McDonald&amp;rsquo;s&amp;rdquo; isn&amp;rsquo;t. I mean, there&amp;rsquo;s a full-stop and a double-quotes at the end. Clearly we need to remove the punctuation as well. But, if we do that, &lt;code&gt;I&#39;d&lt;/code&gt; becomes &lt;code&gt;Id&lt;/code&gt;. So we need to be careful about which punctuation to remove. Let&amp;rsquo;s take a closer look.&lt;/p&gt;
&lt;p&gt;The following punctuation marks are &lt;strong&gt;clear word separators&lt;/strong&gt;: spaces, the exclamation mark, the question mark, semicolon, brackets of any kind, and double-quotes (not single quotes). No word has these in the middle. If we use these as separators, our list of words is better, but we still have some words with punctuation:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;McDonald&amp;#39;s,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;e.g.,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;High-fat
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;R&amp;amp;M
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The issue is, these punctuation marks are &lt;strong&gt;ambiguous word separators&lt;/strong&gt;: comma, hyphen, single-quote, ampersand, period and slash. These usually separate words, but there are exceptions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Comma&lt;/strong&gt;: Not inside numbers: 3,000,000.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hyphen&lt;/strong&gt;: Not for hyphenated words: High-fat.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Single-quote&lt;/strong&gt;: Not for possessives: McDonald&amp;rsquo;s. Not for joint words: I&amp;rsquo;d.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ampersand&lt;/strong&gt;: Not for abbreviations: R&amp;amp;M&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Period&lt;/strong&gt;: Not for abbreviations: O.K. Not for URLs: &lt;a href=&#34;https://www.s-anand.net&#34;&gt;www.s-anand.net&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Slash&lt;/strong&gt;: Not for fractions: 3/4. Not for URLs: google.com/search&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Colon is ambiguous too. In normal English usage, it would be a separator. But URLs like &lt;a href=&#34;http://www.s-anand.net/&#34;&gt;http://www.s-anand.net/&lt;/a&gt; use these characters, and it doesn&amp;rsquo;t make sense to separate them.&lt;/p&gt;
&lt;p&gt;So here are my current rules for splitting a sentence into words. (It&amp;rsquo;s a &lt;a href=&#34;http://www.perl.com/doc/manual/html/pod/perlre.html&#34;&gt;Perl regular expression&lt;/a&gt;. Don&amp;rsquo;t worry. &lt;a href=&#34;http://forums.speedguide.net/showthread.php?t=166822&#34;&gt;Cooper&amp;rsquo;s Law&lt;/a&gt;: If you do not understand a particular word in a piece of technical writing, ignore it. The piece will make perfect sense without it.)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Split by clear word separators&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;/       &lt;span class=&#34;o&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;se&#34;&gt;\s&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\!&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\?&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\;\(\)\[\]\{\}\&amp;lt;\&amp;gt;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34; ]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;# ... by COMMA, unless it has numbers on both sides: 3,000,000
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;|       (?&amp;lt;=\D) ,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;|       , (?=\D)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;# ... by FULL-STOP, SINGLE-QUOTE, HYPHEN, AMPERSAND, unless it has a letter on both sides
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;|       (?&amp;lt;=\W) [\.\-\&amp;amp;]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;|       [\.\-\&amp;amp;] (?=\W)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;# ... by QUOTE, unless it follows a letter (e.g. McDonald&amp;#39;s, Holmes&amp;#39;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;|       (?&amp;lt;=\W) [&amp;#39;]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;# ... by SLASH, if it has spaces on at least one side. (URLs shouldn&amp;#39;t be split)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;|       \s \/
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;|       \/ \s
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;# ... by COLON, unless it&amp;#39;s a URL or a time (11:30am for e.g.)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;|       \:(?!\/\/|\d)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s2&#34;&gt;/x;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This doesn&amp;rsquo;t even scratch the surface of the issue, though. Here are some issues:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Lots of files &lt;strong&gt;split words&lt;/strong&gt; into two at the end of a line. How do we handle that?&lt;/li&gt;
&lt;li&gt;How do we handle &lt;strong&gt;incorrect punctuation&lt;/strong&gt;? For instance, if someone types &amp;ldquo;done.Yet,&amp;rdquo; without leaving a space after the full-stop, I&amp;rsquo;ll think it&amp;rsquo;s an abbreviation.&lt;/li&gt;
&lt;li&gt;What about &lt;strong&gt;other separators&lt;/strong&gt;? Like the ± symbol or the £ symbol for instance.&lt;/li&gt;
&lt;li&gt;What about &lt;strong&gt;other languages&lt;/strong&gt;?!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And you thought it was easy!&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Kasi&lt;/strong&gt; &lt;em&gt;27 Apr 2007 10:18 pm&lt;/em&gt;:
Hi Anand, Nice site..It was good talking to you! When u find time, pls do visit my humble less visited blog at &lt;a href=&#34;https://www.raconteurkasi.blogspot.com&#34;&gt;www.raconteurkasi.blogspot.com&lt;/a&gt; !&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ramya&lt;/strong&gt; &lt;em&gt;3 May 2007 7:52 am&lt;/em&gt;:
Hi Anand, Can u guide me through the interview process of INSEAD MBA . Can you share your wisdom with me to crack the interview, and one more question .. do u sleep for less than 5 hrs a day ?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Andrew&lt;/strong&gt; &lt;em&gt;26 Apr 2007 12:00 pm&lt;/em&gt;:
Thanks, this is very helpful.&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Statistically improbable phrases 2</title>
      <link>https://www.s-anand.net/blog/statistically-improbable-phrases-2/</link>
      <pubDate>Wed, 14 Feb 2007 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/statistically-improbable-phrases-2/</guid>
      <description>&lt;p&gt;My earlier &lt;a href=&#34;https://www.s-anand.net/blog/statistically-improbable-phrases/&#34;&gt;list of statistically improbable phrases in Calvin and Hobbes&lt;/a&gt; is technically just a list of &amp;ldquo;Statistically Improbable Words&amp;rdquo;. I re-did the same analysis using phrases. Here are the top 20 statistically improbable &lt;strong&gt;phrases&lt;/strong&gt; (2 - 4 words only):&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22baby+sitter%22&#34;&gt;baby sitter&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22chocolate+frosted+sugar+bombs%22&#34;&gt;chocolate frosted sugar bombs&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22comic+books%22&#34;&gt;comic books&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22doing+homework%22&#34;&gt;doing homework&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22fearless+spaceman+spiff%22&#34;&gt;fearless spaceman spiff(&lt;/a&gt;) &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22good+night%22&#34;&gt;good night&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22hamster+huey%22&#34;&gt;hamster huey&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22ice+cream%22&#34;&gt;ice cream&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22miss+wormwood%22&#34;&gt;miss wormwood&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22new+year%22&#34;&gt;new year&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22peanut+butter%22&#34;&gt;peanut butter&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22really+think%22&#34;&gt;really think&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22slimy+girls%22&#34;&gt;slimy girls&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22spaceman+spiff%22&#34;&gt;spaceman spiff&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22stuffed+tiger%22&#34;&gt;stuffed tiger&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22stupendous+man%22&#34;&gt;stupendous man&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22sugar+bombs%22&#34;&gt;sugar bombs&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22susie+derkins%22&#34;&gt;susie derkins&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22watch+tv%22&#34;&gt;watch tv&lt;/a&gt; &lt;a href=&#34;http://www.google.com/custom?cx=000835481400639045115%3Aiyjyjb9bpfy&amp;amp;cof=FORID%3A1%3BCX%3ACalvin%3B&amp;amp;q=%22water+balloon%22&#34;&gt;water balloon&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;That is, these are the 2-4 word phrases whose frequency in Calvin and Hobbes is substantially (at least 5 times) higher than in the other books I have.&lt;/p&gt;
&lt;p&gt;While doing this, the single biggest problem that stumped me was: &lt;a href=&#34;https://www.s-anand.net/blog/splitting-a-sentence-into-words/&#34;&gt;what is a word?&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Is &amp;ldquo;it&amp;rsquo;s&amp;rdquo; one word or two words?&lt;/li&gt;
&lt;li&gt;Is &amp;ldquo;six-year-old&amp;rdquo; one word or three words?&lt;/li&gt;
&lt;li&gt;How do I distinguish between abbreviations (g.r.o.s.s.) and full-stops without a space ( &amp;hellip; homework.what&amp;rsquo;s a &amp;hellip;)?&lt;/li&gt;
&lt;li&gt;Does a comma always split words? (It doesn&amp;rsquo;t in numbers, like &amp;ldquo;3,500&amp;rdquo;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The other problem is, &lt;strong&gt;phrases with more words are more improbable&lt;/strong&gt;. Right now, if a phrase occurs 5 times more frequently in Calvin and Hobbes than my other books, I include it. But three-letter words rarely occur that often, and four-letter words even less so. Maybe I should have a lower cutoff for longer phrases.&lt;/p&gt;
&lt;p&gt;Anyway, this analysis is a crude first approximation. Clearly Amazon&amp;rsquo;s gotten much further with their system.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;satish&lt;/strong&gt; &lt;em&gt;20 Feb 2007 3:56 am&lt;/em&gt;:
Hey Stud, Satish here, your junior from IIMB. Trying to get in touch with you. Do mail me at &lt;a href=&#34;mailto:satishkgv@hcl.in&#34;&gt;satishkgv@hcl.in&lt;/a&gt; and let us get in touch.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Oblio&lt;/strong&gt; &lt;em&gt;14 Feb 2007 12:00 pm&lt;/em&gt;:
Fantastic job man! You have unlimited patience!&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reinhard Ebner&lt;/strong&gt; &lt;em&gt;14 Feb 2007 12:00 pm&lt;/em&gt;:
Hey, only just now came across your page, but of the hundreds, if not thousands of C&amp;amp;H sites and tools, this is the most useful I&amp;rsquo;&amp;rsquo;ve seen! R&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;juergwachter&lt;/strong&gt; &lt;em&gt;14 Feb 2007 12:00 pm&lt;/em&gt;:
hello&lt;br&gt;
nice stuff.I intend splitting a text into single words. can you please give me a hint how to do this? I guess there are simple programs doing this.&lt;br&gt;
Many thanks&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;joe&lt;/strong&gt; &lt;em&gt;11 Aug 2009 2:01 am&lt;/em&gt;:
Nice. Do you have a page where I can try out v2 (phrases)?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.s-anand.net/blog/the-calvin-and-hobbes-search-takedown/&#34;&gt;The Calvin and Hobbes search Takedown | s-anand.net&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;21 May 2010 11:53 am&lt;/em&gt; &lt;em&gt;(pingback)&lt;/em&gt;:
[&amp;hellip;] was able to do a lot of cool stuff with this, like statistically improbable phrases and many amusing [&amp;hellip;]&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
  </channel>
</rss>
