知识卡片
规则改写应保留边界与语境
替换文本时需正确处理多处重叠、大小写和原有空白,避免前一次替换改变后面索引。匹配到一个名称并不证明替代词在语境中等价;本章映射还存在拼写问题,演示标记或替换不能当领域决策依据。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
Now, you can insert the new token into the original document, using the match start and stop: >>> newdrug = bad_word_trans[drug] >>> if doc[start].shape_[0] == 'X': ... newdrug = newdrug.title() >>> newtext = doc[:start].text_with_ws + newdrug + " " >>> newtext += doc[stop:].text >>> newtext 'Acetaminophen costs $0.10 per tablet' Now, you have a complete pipeline, not only for detecting errors but also for replacing
参考来源
- 位置:《Natural Language Processing in Action, Second Edition》第10章《真实世界中的大语言模型》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-10.html)
- 结论依据:摘录中关于规则改写应保留边界与语境的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:Now, you can insert the new token into the original document, using the match start and stop: >>> newdrug = bad_word_trans[drug] >>> if doc[start].shape_[0] == 'X': ... newdrug = newdrug.title() >>> newtext = doc[:start].text_with_ws + newdrug + " " >>> newtext += doc[stop:].text >>> newtext 'Acetaminophen costs $0.10 per tablet' Now, you have a complete pipeline, not only for detecting errors but also for replacing