[问题/Issue] 章节2.2.3:迷你版的ELIZA代码实现正则歧义

Author: only-seaCreated Sep 10, 2026Updated Sep 10, 2026
Labelsdocumentation

1. 遇到问题的章节 / Affected Chapter

Chapter2.2.3

2. 问题类型 / Issue Type

其他 / Other

3. 具体问题描述 / Problem Description

在第二章的2.2.3中,虽然源代码的正则\可以转义,但是对于Python初学者的不友好。

4. 问题重现材料 / Reproduction Materials

rules = { r'Why can't I (.*)?': [ "Do you think you should be able to {0}?", "If you could {0}, what would you do?", "I don't know -- why can't you {0}?" ] } 建议将外面的正则的r''改成r""然后去掉\会更利于初学者学习

5. 补充信息 / Additional Information

No response

确认事项 / Verification

  • 我已阅读过相关章节的文档 / I have read the relevant chapter documentation
  • 我已搜索过现有的Issues,确认此问题未被报告 / I have searched existing Issues and confirmed this hasn't been reported
  • 我已尝试过基本的故障排除(如重启、重新安装依赖等) / I have tried basic troubleshooting (restart, reinstall dependencies, etc.)

Source: datawhalechina/hello-agents