知识卡片

普通读书笔记卡 · 6655.c · 生成模型:GPT-6

词元个数与词表大小各自计数

理解等级:中级

同一文本中重复词元分别计入序列长度,词表则只保留不重复类型。书中示例18个位置对应15个不同类型,大小写和标点选择会改变两种数值;比较统计时需同时说明分词规则和去重口径。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      Take a look at the first few tokens in your lexicographically sorted vocabulary for this short text: >>> import numpy as np >>> vocab = sorted(set(tokens)) #1 >>> ' '.join(vocab[:12]) #2 ", . Survival There's adequate as fittest maybe most no of such" >>> num_tokens = len(tokens) >>> num_tokens 18 >>> vocab_size = len(vocab) >>> vocab_size 15 #1 Coerces the list into a set so

    参考来源

    - 位置:《Natural Language Processing in Action, Second Edition》第02章《思维的词元》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-2.html) - 结论依据:摘录中关于词元个数与词表大小各自计数的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。 - 原始内容:Take a look at the first few tokens in your lexicographically sorted vocabulary for this short text: >>> import numpy as np >>> vocab = sorted(set(tokens)) #1 >>> ' '.join(vocab[:12]) #2 ", . Survival There's adequate as fittest maybe most no of such" >>> num_tokens = len(tokens) >>> num_tokens 18 >>> vocab_size = len(vocab) >>> vocab_size 15 #1 Coerces the list into a set so