fix: improve Chinese NLP filetype detection accuracy#362
Conversation
1. Added new test case for design source files shadowing image substrings 2. Included "包" back to application filetype rules with negative lookahead to prevent false matches 3. Increased priority of design source files to shadow image matches 4. Removed outdated comment about span consumption since it's now standard behavior Influence: 1. Test Chinese file search with "矢量图" to ensure design source files are prioritized over general image files 2. Verify "包" matches application filetype while avoiding false positives like "表情包" 3. Check that design source files (PSD, AI etc.) are correctly identified in complex queries fix: 提升中文NLP文件类型检测准确性 1. 新增设计源文件遮蔽图片子字符串的测试用例 2. 重新包含"包"到应用文件类型规则,添加否定前瞻避免误判 3. 提高设计源文件的优先级使其遮蔽图片匹配 4. 移除关于span消费的过时注释,因这已是标准行为 Influence: 1. 测试中文文件搜索"矢量图"确保设计源文件优先于普通图片文件 2. 验证"包"能匹配应用文件类型同时避免"表情包"等误判 3. 检查在复杂查询中设计源文件(PSD, AI等)能被正确识别 Fixes: #370659
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Johnson-zs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideThis PR refines Chinese NLP filetype detection by reintroducing the “包” synonym for applications with stricter matching, adding a regression test to ensure design-source file rules override generic image matches, and cleaning up an outdated span-consumption comment in the extractor implementation, along with corresponding rule updates in the Chinese filetype rules JSON. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
fileType_designSource_shadowsImageSubstring, consider also asserting that the resultingfileExtensions()does not include the image rule’s extensions so the shadowing behavior is verified at both span and extension levels. - The test currently relies on hard-coded
ruleIdstring literals like"filetype_design_source"and"filetype_image"; using shared constants or an enum for rule IDs would make the tests less brittle to future rule renames.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `fileType_designSource_shadowsImageSubstring`, consider also asserting that the resulting `fileExtensions()` does not include the image rule’s extensions so the shadowing behavior is verified at both span and extension levels.
- The test currently relies on hard-coded `ruleId` string literals like `"filetype_design_source"` and `"filetype_image"`; using shared constants or an enum for rule IDs would make the tests less brittle to future rule renames.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 {
"id": "filetype_application",
"pattern": "安装包|软件|应用|脚本|程序|包(?!含)",
"description": "Application packages",
"enabled": true,
"priority": 150,
"metadata": {
"extensions": ["deb", "rpm", "sh", "appimage", "uap"]
}
} |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
substrings
lookahead to prevent false matches
standard behavior
Influence:
are prioritized over general image files
positives like "表情包"
identified in complex queries
fix: 提升中文NLP文件类型检测准确性
Influence:
Fixes: #370659
Summary by Sourcery
Improve Chinese NLP filetype detection accuracy for design source and application files.
New Features:
Bug Fixes:
Enhancements:
Tests: