AI Skill Report Card
Validating Chinese Addresses
Chinese Address Validation and Correction
Quick Start10 / 15
Pythondef validate_address(address): import re # Standard pattern: 省 + 市/区 + 街道/镇 + 详细地址 pattern = r'(.+省)(.+[市区])(.+[街道镇])(.+)' if re.match(pattern, address): return f"✓ 格式正确: {address}" else: return correct_address(address) # Example usage result = validate_address("北京朝阳区建国门外大街1号")
Recommendation▾
Add a complete working function in Quick Start that actually implements the correction logic, not just a validation stub
Workflow12 / 15
Progress:
- Parse input address components
- Check for required elements (省/市/区/街道/详细地址)
- Identify missing components
- Apply correction rules
- Format according to standard pattern
- Return corrected address
Validation Steps
-
Extract Components
- 省份 (Province): ends with "省"
- 市/区 (City/District): ends with "市" or "区"
- 街道/镇 (Street/Town): ends with "街道", "镇", "路", "街"
- 详细地址 (Detailed address): remaining part
-
Apply Corrections
- Missing 省: Add based on 市 recognition
- Missing 市: Add based on common patterns
- Missing 街道: Extract from detailed address or add placeholder
- Reorder components if needed
Recommendation▾
Include concrete province-city mapping data or reference tables instead of just mentioning them
Examples15 / 20
Example 1:
Input: 北京朝阳区建国门外大街1号
Output: 北京市朝阳区建国门外街道建国门外大街1号
Example 2:
Input: 广东深圳南山科技园
Output: 广东省深圳市南山区科技园街道科技园
Example 3:
Input: 上海浦东新区张江高科技园区
Output: 上海市浦东新区张江镇高科技园区
Recommendation▾
Add edge case examples showing how the skill handles special administrative regions, counties, and malformed inputs with actual before/after pairs
Best Practices
- Use province-city mapping table for accurate province completion
- Recognize special administrative regions (北京市, 上海市, etc.)
- Handle edge cases like 县级市, 自治区
- Preserve original detailed address information
- Use "街道" as default when street type unclear
Common Pitfalls
- Don't assume every address missing 省 is incomplete
- Don't over-correct addresses that are already properly formatted
- Don't lose specific location details during standardization
- Don't apply corrections to non-Chinese addresses
- Don't assume all missing components - some may be intentionally abbreviated