Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ScoringStats 原先在首次读取最小值或最大值时使用平均分初始化,导致评分结束后读取的两个极值都变成平均值。若评分前先读取,则初始 0 又会污染全正数的最小值或全负数的最大值。
修复为每次 update 时维护已观察到的极值,getter 只读取状态;没有评分时仍返回 0。平均分和 URL 评分计算方式保持不变。
Files changed
crawl4ai/deep_crawling/scorers.py:修复极值初始化、更新和读取。tests/unit/test_scoring_statistics.py:覆盖正数、负数、混合分数,不同读取时机,以及 KeywordRelevanceScorer 和 CompositeScorer 的公开调用路径。How Has This Been Tested?
python -m pytest tests/unit/test_scoring_statistics.py tests/general/test_deep_crawl_scorers.py -q:12 passed。python -m black --target-version py310 tests/unit/test_scoring_statistics.py、git diff --check:通过。Checklist
AI 披露:问题、代码及本地验证由 OpenAI Codex 完成,尚未经人工审阅。