← 返回 Skills 市场
zhouyouwen

address-extractor

作者 zhouyouwen · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
251
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install address-extractor
功能描述
此技能应用于从任意文本中提取、清洗、标准化地址信息,并将其转换为结构化的省-市-区/县-乡镇/街道-村庄/社区-道路号POI格式。技能能够智能过滤特殊字符和无效备注文本,尽可能提取楼栋号和门牌号以实现精确定位,并通过高德地图API将标准化地址转换为精确的经纬度坐标。适用于文档处理、客户信息管理、物流配送、地理信息...
使用说明 (SKILL.md)

\r \r

地址提取和标准化技能使用指南\r

\r

技能概述\r

\r 此技能提供完整的地址信息处理工作流程,将杂乱的文本地址转换为结构化的地理位置信息。技能集成了文本清洗、地址解析、层级标准化、精确位置提取和坐标转换等功能。\r \r

何时使用此技能\r

\r 当遇到以下情况时应当使用此技能:\r

  • 从客户资料、订单信息、文档记录中提取地址信息\r
  • 需要处理包含地址的自然语言文本并转换为标准格式\r
  • 需要将文本地址转换为GPS坐标以进行地图标注或导航\r
  • 清理和标准化来自多个来源的地址数据\r
  • 提取文本中的精确位置信息(包括楼栋号、门牌号)\r
  • 过滤掉地址文本中的干扰信息(电话、备注、联系方式等)\r \r

如何使用此技能\r

\r

基本使用流程\r

\r

  1. 准备输入文本:收集包含地址信息的原始文本\r
  2. 调用地址提取器:使用AddressExtractor类处理文本\r
  3. 获取处理结果:接收包含清洗文本、地址组件、标准化地址和坐标的完整结果\r
  4. 后续处理:根据需要使用标准化地址或坐标信息\r \r

核心组件使用\r

\r

1. 初始化地址提取器\r

\r

from scripts.address_parser import AddressExtractor\r
\r
# 初始化提取器(推荐配置API密钥)\r
extractor = AddressExtractor(amap_api_key="your-amap-api-key")\r
\r
# 如不配置API密钥,仍可提取和标准化地址,但无法获取坐标\r
extractor_no_api = AddressExtractor()\r
```\r
\r
#### 2. 执行完整地址提取流程\r
\r
```python\r
# 输入包含地址的文本\r
text = "客户张三,电话13800138000,地址:北京市朝阳区建国门外大街1号国贸大厦A座1208室"\r
\r
# 执行提取和标准化\r
result = extractor.extract_and_standardize(text)\r
\r
# 检查结果\r
if result['success']:\r
    print(f"标准化地址: {result['standardized_address']}")\r
    print(f"坐标: {result['coordinates']}")\r
else:\r
    print(f"错误: {result['error']}")\r
```\r
\r
#### 3. 单独使用各功能模块\r
\r
**文本清洗:**\r
```python\r
cleaned = extractor.clean_text(raw_text)\r
```\r
\r
**地址组件提取:**\r
```python\r
components = extractor.extract_address_components(cleaned_text)\r
```\r
\r
**地址标准化:**\r
```python\r
standardized = extractor.standardize_address(components)\r
```\r
\r
**坐标获取:**\r
```python\r
coordinates = extractor.get_coordinates_from_amap(query_address)\r
```\r
\r
### 结果格式说明\r
\r
技能返回一个包含以下字段的字典:\r
\r
- `success`: 布尔值,表示处理是否成功\r
- `original_text`: 原始输入文本\r
- `cleaned_text`: 清洗后的文本\r
- `components`: 地址组件字典,包含:\r
  - `province`: 省份\r
  - `city`: 城市  \r
  - `district`: 区县\r
  - `town`: 乡镇街道\r
  - `village`: 村庄社区\r
  - `road`: 道路\r
  - `house_number`: 门牌号\r
  - `building`: 楼栋号\r
  - `poi`: 兴趣点\r
- `standardized_address`: 标准化的地址路径\r
- `query_address`: 用于API查询的地址字符串\r
- `coordinates`: 坐标信息(如可用)\r
  - `lng`: 经度\r
  - `lat`: 纬度\r
  - `formatted_address`: 格式化地址\r
\r
### 高德地图API配置\r
\r
要获取精确坐标,需要配置高德地图API密钥:\r
\r
1. 访问[高德开放平台](https://lbs.amap.com/)注册账号\r
2. 创建应用并获取API Key\r
3. 在初始化时传入密钥:`AddressExtractor(amap_api_key="your-key")`\r
\r
API密钥将用于调用高德地理编码API:`https://restapi.amap.com/v3/geocode/geo`\r
\r
### 支持的地址格式\r
\r
技能支持多种中文地址表达格式:\r
- 标准行政区划地址:省-市-区-街道-门牌号\r
- 商业建筑地址:大厦、广场、中心等POI名称\r
- 住宅小区地址:小区、花园、苑等居住区名称\r
- 混合格式:包含道路、楼栋、单元等详细信息\r
\r
### 地址层级识别\r
\r
技能按以下优先级识别和提取地址层级:\r
1. **省份**:直辖市、自治区、特别行政区\r
2. **城市**:地级市、副省级城市、直辖市\r
3. **区县**:市辖区、县、县级市、自治县\r
4. **乡镇街道**:镇、乡、街道办事处\r
5. **村庄社区**:村、社区、居委会\r
6. **道路**:路、街、大道、胡同、巷、弄\r
7. **门牌号**:数字+号、带中文描述的门牌\r
8. **楼栋号**:栋、号楼、幢、座、单元\r
9. **POI**:商业建筑、公共设施、地标建筑\r
\r
### 文本清洗规则\r
\r
自动过滤以下内容:\r
- 特殊符号:【】()()[]{}\x3C>《》""''「」『』等\r
- 无效备注:备注、说明、注意、联系、电话、手机等开头的描述\r
- 多余空白字符和标点符号\r
- 个人敏感信息:姓名、年龄、性别等非地址信息\r
\r
### 错误处理\r
\r
技能具备完善的错误处理机制:\r
- 无有效地址时的友好提示\r
- API调用失败的异常处理\r
- 网络请求的超时控制\r
- 编码问题的自动处理\r
\r
## 最佳实践\r
\r
1. **预处理**:尽量提供完整、清晰的地址文本\r
2. **API配置**:生产环境务必配置有效的高德API密钥\r
3. **结果验证**:对重要应用建议验证坐标结果的准确性\r
4. **批量处理**:可循环调用处理多条地址信息\r
5. **日志记录**:利用内置日志功能追踪处理过程\r
\r
## 扩展和定制\r
\r
可通过修改`address_parser.py`中的正则表达式模式来适配特定的地址格式需求。脚本支持灵活的组件扩展和定制化配置。
安全使用建议
This skill appears to do what it advertises, but check these points before installing or using it with real user data: - Privacy: When geocoding, the code sends address strings to AMap (restapi.amap.com). If your inputs contain personal data (names, phone numbers, other PII), those strings may be transmitted to the external service. Ensure you have consent and that this meets your privacy/regulatory requirements. - API key: Provide your own AMap API key to enable coordinate lookups. Without it the skill still extracts components but won't return coordinates. - Dependency and runtime: The script uses the 'requests' library but the skill metadata has no install step. Make sure 'requests' is available in your agent runtime (pip install requests) before relying on the skill. - Accuracy vs. claims: The SKILL.md states it 'filters personal sensitive information' broadly, but the implementation only removes certain labeled notes (e.g., patterns like '姓名:' or '电话:'); it does not robustly anonymize free-form names or phone numbers. If you need to avoid sending PII to external services, sanitize inputs yourself or modify the script to remove/obfuscate sensitive fields. - Code quality: There are minor implementation issues (regex patterns and handling) that could affect extraction robustness. Review and test with representative samples before production use. If you need higher assurance about data handling, consider running the parser without geocoding (no API key) or using an internal/offline geocoder to avoid transmitting addresses to third parties.
功能分析
Type: OpenClaw Skill Name: address-extractor Version: 1.0.0 The skill is a legitimate tool designed to extract, clean, and standardize Chinese address information from unstructured text. The core logic in `scripts/address_parser.py` uses well-defined regular expressions and integrates with the official Amap (Gaode) Maps API for geocoding, requiring a user-provided API key. There is no evidence of malicious behavior, data exfiltration, or prompt injection; in fact, the script includes logic to filter out sensitive non-address information like phone numbers and names during processing.
能力评估
Purpose & Capability
Name and description match the included code: the Python AddressExtractor extracts address components, standardizes them and (optionally) calls AMap geocoding. Requests to the AMap REST API are expected for the stated purpose.
Instruction Scope
SKILL.md claims automatic filtering of 'personal sensitive information' (姓名、年龄、性别等). The implementation removes explicit 'invalid note' patterns (e.g., strings that begin with '备注:', '电话:', '姓名:' etc.) but does not comprehensively scrub free-form names or phone numbers that are not formatted as those labeled notes. The SKILL.md also instructs callers to pass an AMap API key and to call methods in the provided script — those instructions align with the code.
Install Mechanism
There is no install spec (instruction-only + code file). The code imports 'requests' but the skill does not declare dependencies or provide an install step; users must ensure the runtime has the requests package. No suspicious remote download or execution observed.
Credentials
No environment variables or credentials are required by the skill metadata. The AMap API key is optional in code (recommended for coordinates) and is proportionate to the geocoding feature. The skill performs outbound requests to the official AMap REST endpoint, which is appropriate for obtaining coordinates.
Persistence & Privilege
Skill is not 'always' enabled and does not request elevated or persistent platform privileges. It does not modify other skills or system-wide configuration. Autonomous invocation is allowed by default (platform behavior) but not combined with concerning access patterns.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install address-extractor
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /address-extractor 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
address-extractor v1.0.0 - Initial release of the address-extractor skill. - Extracts, cleans, and standardizes address information from unstructured text. - Outputs structured address components (province, city, district, town, village, road, house number, building, POI). - Supports address normalization and conversion to geographic coordinates using Amap API. - Includes robust noise filtering and error handling for practical scenarios. - Provides modular usage: full workflow or individual steps (cleaning, parsing, geocoding).
元数据
Slug address-extractor
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

address-extractor 是什么?

此技能应用于从任意文本中提取、清洗、标准化地址信息,并将其转换为结构化的省-市-区/县-乡镇/街道-村庄/社区-道路号POI格式。技能能够智能过滤特殊字符和无效备注文本,尽可能提取楼栋号和门牌号以实现精确定位,并通过高德地图API将标准化地址转换为精确的经纬度坐标。适用于文档处理、客户信息管理、物流配送、地理信息... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 251 次。

如何安装 address-extractor?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install address-extractor」即可一键安装,无需额外配置。

address-extractor 是免费的吗?

是的,address-extractor 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

address-extractor 支持哪些平台?

address-extractor 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 address-extractor?

由 zhouyouwen(@zhouyouwen)开发并维护,当前版本 v1.0.0。

💬 留言讨论