知识卡片
特殊词元属于建模协议
EOS标记文本边界,UNK表示当前词表无法区分的项,各有明确角色。应记录其计数和预测处理,不能把两者都叫无意义噪声;比较语言模型还需保持分词、词表、损失归约及特殊项处理一致。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
So how many <eos> and <unk> tokens are there in this training set? >>> num_eos = sum([vocab.idx2word[i] == '<eos>' for i in↪ ↪ corpus.train.numpy()]) >>> num_eos 36718 >>> num_unk = sum([vocab.idx2word[i] == '<unk>' for i in↪ ↪ corpus.train.numpy()]) >>> num_unk 54625 >>> num_normal = sum([ ... vocab.idx2word[i] not in ('<unk>', '<eos>') ... for i in corpus.train.numpy()]) >>> num_normal 1997285 >>> num_unk / (num_normal + num_eos
参考来源
- 位置:《Natural Language Processing in Action, Second Edition》第08章《循环网络与长短期记忆》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-8.html)
- 结论依据:摘录中关于特殊词元属于建模协议的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:So how many <eos> and <unk> tokens are there in this training set? >>> num_eos = sum([vocab.idx2word[i] == '<eos>' for i in↪ ↪ corpus.train.numpy()]) >>> num_eos 36718 >>> num_unk = sum([vocab.idx2word[i] == '<unk>' for i in↪ ↪ corpus.train.numpy()]) >>> num_unk 54625 >>> num_normal = sum([ ... vocab.idx2word[i] not in ('<unk>', '<eos>') ... for i in corpus.train.numpy()]) >>> num_normal 1997285 >>> num_unk / (num_normal + num_eos