老师这是我们的vocabulary.py,请你看一下 #203

Open
yuquanlin wants to merge 2 commits from Bug585-OuyangBowen into Alpha-snapshot20240618

老师这是我们的vocabulary.py,请你看一下

老师这是我们的vocabulary.py,请你看一下
yuquanlin added 1 commit 2025-05-29 21:04:55 +08:00

在 UserVocabularyLevel 的初始化方法中,所有对时间的处理都是字符串格式。但是如果不是字符串格式会调用 strftime 方法,会错误。我们可以增加类型检查。

在 UserVocabularyLevel 的初始化方法中,所有对时间的处理都是字符串格式。但是如果不是字符串格式会调用 strftime 方法,会错误。我们可以增加类型检查。
yuquanlin added 1 commit 2025-05-29 22:25:51 +08:00
yuhaixin requested review from yuhaixin 2025-06-24 15:38:22 +08:00

老师这是我们的vocabulary.py,请你看一下
1.建议添加docstring说明类和方法的功能
ArticleVocabularyLevel 类改进建议
1.init 方法同时负责数据处理和计算逻辑,职责过多。建议将数据处理和计算逻辑拆分为单独的方法
2.魔法数字(0.6, 0.3, 0.1等)直接出现在代码中。建议定义为类常量
UserVocabularyLevel 类改进建议
1.UserVocabularyLevel 的初始化方法中,如果传入非字符串且非 datetime 的对象(如 int 时间戳),可能会出错。可以增加输入验证检查时间戳是否有效如果时间戳无效,可选择跳过(不纳入计算)记录警告(logging.warning)抛出明确异常(如 ValueError("Invalid timestamp format"))
2.adjustment系数(0.5)是魔法数字。建议:定义为类常量
使用cet4、6考试阅读原文进行测试,测试结果与预期偏差较大,建议对参数进行优化

> 老师这是我们的vocabulary.py,请你看一下 1.建议添加docstring说明类和方法的功能 ArticleVocabularyLevel 类改进建议 1.__init__ 方法同时负责数据处理和计算逻辑,职责过多。建议将数据处理和计算逻辑拆分为单独的方法 2.魔法数字(0.6, 0.3, 0.1等)直接出现在代码中。建议定义为类常量 UserVocabularyLevel 类改进建议 1.UserVocabularyLevel 的初始化方法中,如果传入非字符串且非 datetime 的对象(如 int 时间戳),可能会出错。可以增加输入验证检查时间戳是否有效如果时间戳无效,可选择跳过(不纳入计算)记录警告(logging.warning)抛出明确异常(如 ValueError("Invalid timestamp format")) 2.adjustment系数(0.5)是魔法数字。建议:定义为类常量 使用cet4、6考试阅读原文进行测试,测试结果与预期偏差较大,建议对参数进行优化
This Pull Request doesn't have enough approvals yet. 0 of 1 approvals granted.
You are not authorized to merge this pull request.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mrlan/EnglishPal#203
There is no content yet.