Skip to content

fix: enhance Chinese numeral time parsing#360

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
Johnson-zs:master
Jul 20, 2026
Merged

fix: enhance Chinese numeral time parsing#360
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
Johnson-zs:master

Conversation

@Johnson-zs

Copy link
Copy Markdown
Contributor
  1. Added support for Chinese numeral month specifications in time
    queries ("七月", "十二月")
  2. Extended year-month and full date patterns to accept Chinese numerals
    ("2025年七月", "七月八号")
  3. Improved number parsing logic to handle leading-ten Chinese numerals
    ("十一", "十五")
  4. Updated test cases to verify new Chinese numeral time formats
  5. Expanded regex patterns in time_rules.json to accommodate Chinese
    numerals

The changes improve natural language processing for Chinese date/time
queries by properly handling Chinese numeral representations alongside
Arabic numerals. This makes the search functionality more intuitive for
Chinese users who may use either number format when specifying dates.

Log: Improved support for Chinese numeral time expressions in search
queries

Influence:

  1. Test month queries with Chinese numerals ("七月", "十二月")
  2. Verify year-month combinations with Chinese months ("2025年十一月")
  3. Check date formats with Chinese day numbers ("七月八号")
  4. Test full dates with Chinese numerals ("2025年七月三十日")
  5. Verify mixed numeral formats ("最近3天" vs. "最近十五天")
  6. Check edge cases like single-digit and leading-ten numbers

fix: 增强中文数字时间解析功能

  1. 新增支持中文数字月份查询 ("七月", "十二月")
  2. 扩展年月和完整日期格式支持中文数字 ("2025年七月", "七月八号")
  3. 改进数字解析逻辑以处理"十"开头的数字写法 ("十一", "十五")
  4. 添加测试用例验证新的中文数字时间格式
  5. 更新 time_rules.json 中的正则表达式以兼容中文数字

这些改动提升了中文时间查询的自然语言处理能力,正确处理中文数字与阿拉伯数
字表达,使搜索功能对使用中文数字表达时间的用户更加友好。

Log: 改进搜索查询中的中文数字时间表达式支持

Influence:

  1. 测试中文数字月份查询 ("七月", "十二月")
  2. 验证带中文月份的年份组合 ("2025年十一月")
  3. 检查带中文日期的格式 ("七月八号")
  4. 测试完整的带中文数字日期 ("2025年七月三十日")
  5. 验证混合数字格式 ("最近3天" 与 "最近十五天")
  6. 检查边界情况如个位数和"十"开头的数字

Fixes: #370419

1. Added support for Chinese numeral month specifications in time
queries ("七月", "十二月")
2. Extended year-month and full date patterns to accept Chinese numerals
("2025年七月", "七月八号")
3. Improved number parsing logic to handle leading-ten Chinese numerals
("十一", "十五")
4. Updated test cases to verify new Chinese numeral time formats
5. Expanded regex patterns in time_rules.json to accommodate Chinese
numerals

The changes improve natural language processing for Chinese date/time
queries by properly handling Chinese numeral representations alongside
Arabic numerals. This makes the search functionality more intuitive for
Chinese users who may use either number format when specifying dates.

Log: Improved support for Chinese numeral time expressions in search
queries

Influence:
1. Test month queries with Chinese numerals ("七月", "十二月")
2. Verify year-month combinations with Chinese months ("2025年十一月")
3. Check date formats with Chinese day numbers ("七月八号")
4. Test full dates with Chinese numerals ("2025年七月三十日")
5. Verify mixed numeral formats ("最近3天" vs. "最近十五天")
6. Check edge cases like single-digit and leading-ten numbers

fix: 增强中文数字时间解析功能

1. 新增支持中文数字月份查询 ("七月", "十二月")
2. 扩展年月和完整日期格式支持中文数字 ("2025年七月", "七月八号")
3. 改进数字解析逻辑以处理"十"开头的数字写法 ("十一", "十五")
4. 添加测试用例验证新的中文数字时间格式
5. 更新 time_rules.json 中的正则表达式以兼容中文数字

这些改动提升了中文时间查询的自然语言处理能力,正确处理中文数字与阿拉伯数
字表达,使搜索功能对使用中文数字表达时间的用户更加友好。

Log: 改进搜索查询中的中文数字时间表达式支持

Influence:
1. 测试中文数字月份查询 ("七月", "十二月")
2. 验证带中文月份的年份组合 ("2025年十一月")
3. 检查带中文日期的格式 ("七月八号")
4. 测试完整的带中文数字日期 ("2025年七月三十日")
5. 验证混合数字格式 ("最近3天" 与 "最近十五天")
6. 检查边界情况如个位数和"十"开头的数字

Fixes: #370419

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @Johnson-zs, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:95分

■ 【总体评价】

代码实现了中文数字月份和日期的解析支持,逻辑正确且测试覆盖全面
修复了中文数字解析的边界问题,无安全漏洞,因正则表达式复杂度略微增加扣5分

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

TimeExtractor::localeAwareToInt 函数新增了对 "十X" 模式(如 "十一"、"十五")的解析逻辑,修复了原先只能解析 "X十" 模式的问题。同时将 prefix > 1 修改为 prefix > 0,允许解析 "一十" 等情况。time_rules.json 中的正则表达式同步更新,支持匹配 1-3 位的中文数字字符集。
潜在问题:无
建议:无

  • 2.代码质量(良好)✓

代码注释清晰,解释了 "十X" 和 "XY" 模式的区别。测试用例命名规范,覆盖了七月、十二月、十五天等典型场景,确保了修改的正确性。
潜在问题:无
建议:无

  • 3.代码性能(无性能问题)✓

正则表达式中新增了 [零一二两三四五六七八九十]{1,3} 的匹配,长度限制为 1-3 字符,对整体匹配性能影响极小。localeAwareToInt 中新增的条件判断均为 O(1) 操作。
潜在问题:无
建议:无

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次修改仅涉及字符串解析逻辑和正则规则更新,无外部输入直接参与系统命令或数据库操作,不存在安全风险。

  • 建议:无

■ 【改进建议代码示例】

// 当前代码已经非常完善,无需额外修复,保持现有实现即可。

@Johnson-zs

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit dae47d4 into linuxdeepin:master Jul 20, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants