<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>chakoku</author_name>
  <author_url>https://blog.hatena.ne.jp/chakoku/</author_url>
  <blog_title>chakokuのブログ(rev4)</blog_title>
  <blog_url>https://chakoku.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>背景：LLMを理解すべくLLM from scratch本でプログラムを書く 進捗：「2.2 テキストをトークン化する」(P21） 課題：文書をLLMで扱うには、単語をトークン（ID）に置き換える必要がある。このためトークナイザが必要 取り組み：自作トークナイザを作成 結論：自作トークナイザはできた詳細： 本では正規表現でsplitさせる方法で文書から単語を切り出して、辞書に登録していく方法が採用されている。多分一番短いプログラムだと思う。他人の真似をするのが嫌なへそ曲がりなので、一文字ずつ順番に文字を読み込みながら単語に分割するアルゴリズムで組んでみる。はっきりって、こっちは効率が悪い。しか…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fchakoku.hatenablog.com%2Fentry%2F2025%2F08%2F12%2F163616&quot; title=&quot;LLM from scratch; tokenizerを作成 - chakokuのブログ(rev4)&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2025-08-12 16:36:16</published>
  <title>LLM from scratch; tokenizerを作成</title>
  <type>rich</type>
  <url>https://chakoku.hatenablog.com/entry/2025/08/12/163616</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
