知识卡片
中间列名必须按流水线契约一致
tokenize_row写all_tokens而后续读取tokens,窗口函数写moving_window而示例显示window,若照抄将断开数据处理链。需在每步检查列名、行数与一条样本;自然语言叙述正确不能抵消实际字段不一致。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 用词嵌入推理
原书出处 · 1 处
- · 查看原书依据
def tokenize_row(row): row['all_tokens'] = row['text'].lower().split() return row Now, you can use your tokenizer on the torchtext dataset that contains this iterable sequence of rows of data, each with a text key for the WikiText2 data: >>> dset = dset.map(tokenize_row) >>> dset DatasetDict({ train: Dataset({ features: ['text', 'tokens'], num_rows: 10000 }) }) You’ll need to compute the vocabulary for your dataset to handle the one-hot encoding
参考来源
- 位置:《Natural Language Processing in Action, Second Edition》第06章《用词嵌入推理》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-6.html)
- 结论依据:摘录中关于中间列名必须按流水线契约一致的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:def tokenize_row(row): row['all_tokens'] = row['text'].lower().split() return row Now, you can use your tokenizer on the torchtext dataset that contains this iterable sequence of rows of data, each with a text key for the WikiText2 data: >>> dset = dset.map(tokenize_row) >>> dset DatasetDict({ train: Dataset({ features: ['text', 'tokens'], num_rows: 10000 }) }) You’ll need to compute the vocabulary for your dataset to handle the one-hot encoding