现在有一个需求,就是对Excel中户籍详细地址列进行数据清洗,要求去除每一行数据的详细地址,比如 湖南省东安县石期市镇双车村7组 只保留…
- User
现在有一个需求,就是对Excel中户籍详细地址列进行数据清洗,要求去除每一行数据的详细地址,比如 湖南省东安县石期市镇双车村7组 只保留 湖南省东安县石期市镇双车村.如果是小区则保留到某个小区或者街道.只保留最小的新政单位,将清洗后的数据新增一列用于显示 处理逻辑
对每一行输入地址,按以下优先级保留最低一级地名: 若存在“村”或“社区”,则保留到该村/社区(例如“广东省汕头市潮阳区文光街道”本身是街道,若地址中有“村”,则保留到村); 若无村/社区,则保留到“街道”或“镇”; 若无街道/镇,则保留到“区/县”。 删除门牌号、楼栋、单元、房号、组、队、几号、几巷、几里、自然村内的小地名等具体位置信息。 保留完整的省、市、区(县)上级结构,确保层级连续。 特殊处理:若地址包含小区名(如“桐淮小区”),将其视为社区层级并保留;若包含“农场”、“大队”,也保留到该层级。
Assistant
I will examine the project files and structure first to understand the setup.
I will read
package.jsonto check installed dependencies.I will install
xlsxandlucide-reactfor parsing/exporting Excel files and modern UI icons.I will check
src/index.cssto see how styles and Tailwind CSS are imported.I will check the current build status.
I will create
src/utils/addressCleaner.tswhich implements the Chinese household address cleaning algorithm according to the user's priority rules.I will update
src/utils/addressCleaner.tswith refined regular expressions and cleaner hierarchy parsing.I will create
src/utils/sampleData.tswith realistic Chinese household registration address samples for testing and demonstration.I will refine
src/utils/addressCleaner.tsto ensure all priority match patterns (including大队部,行政村,自然村小地名剥离,嘎查,居委会) are supported.I will create
src/utils/excelHelper.tsto handle Excel/CSV file reading, column auto-detection, and generating exportable Excel files with the new cleaned address column.I will run
build_projectto ensure there are no compilation or bundling errors.I will update
index.htmlwith an appropriate title and favicon/meta tags.I will create
src/components/StatsCards.tsxto display key processing statistics (total rows, modified rows, retention breakdown, accuracy rate).I will create
src/components/ExcelCleanerTab.tsxfor the batch Excel file processing, column selection, data preview grid with difference highlighting, and Excel/CSV exporting.I will remove the unused imports in
src/components/ExcelCleanerTab.tsx.I will create
src/components/InstantTesterTab.tsxfor single and multi-line real-time address cleaning tests, with hierarchical structure tree visualization.I will create
src/components/RulesSettingsTab.tsxproviding configurable cleaning rules, rule toggle switches, and detailed visual specification tables with before-and-after examples.I will remove the unused imports from
src/components/RulesSettingsTab.tsx.I will replace
src/App.tsxwith the complete application implementation.I will build the project to verify that there are no TypeScript or bundling errors.
已为您开发完成 Excel 户籍详细地址数据清洗与新增列标准化工具。
✨ 核心功能与清洗规则实现说明
本工具严格按照您的业务清洗规则开发,支持 Excel / CSV 文件批量清洗、即时文本沙盒测试、差异高亮对比 以及 一键导出新增列后的 Excel 文件 (.xlsx / .csv):
📌 清洗与截断保留逻辑(严格按优先级)
-
优先级 #1:村级 / 社区 / 居委会
- 若地址中存在 “村”、“行政村”、“社区”、“居委会” 或 “嘎查”,系统将精确保留至该村/社区。
- 示例:
湖南省东安县石期市镇双车村7组保留湖南省东安县石期市镇双车村(成功剥离7组)。 - 示例:
广东省汕头市潮阳区文光街道桃园社区3栋2单元501室保留广东省汕头市潮阳区文光街道桃园社区(成功剥离3栋2单元501室)。
-
特殊实体处理:小区 / 农场 / 大队(视作社区层级)
- 若地址中包含 “小区”(如“桐淮小区”)、“农场”、“大队”、“家属院” 等,视作社区层级单位予以保留。
- 示例:
福建省泉州市丰泽区泉秀街道桐淮小区12号楼402室保留福建省泉州市丰泽区泉秀街道桐淮小区(剥离12号楼402室)。 - 示例:
黑龙江省佳木斯市富锦市建三江农场第八管理区15号保留黑龙江省佳木斯市富锦市建三江农场。
-
优先级 #2:街道 / 镇 / 乡
- 若地址无村/社区/小区,则截断保留至 “街道”、“镇” 或 “乡”。
- 示例:
四川省成都市金牛区营门口街道茶店子西街18号附3号保留四川省成都市金牛区营门口街道。
-
优先级 #3:区 / 县
- 若地址无更低级别乡镇街道,则保留至 “区” 或 “县”。
-
详细信息剥离与上级结构保障
- 彻底去除门牌号、楼栋(栋/幢/号楼)、单元、房号/室/户、组/村民小组、队/生产队、几号、几弄、几巷、自然村内小地名。
- 保持上级结构完整:完整保留省/自治区/直辖市 市/州 区/县 乡镇/街道 的连续前缀,确保层级结构不缺失。
🚀 平台核心特性
- 📊 Excel 批量处理与导出:
- 支持上传
.xlsx、.xls、.csv文件,自动识别包含户籍详细地址的列。 - 在原始表格中自动新增一列(默认列名
清洗后地址,支持自定义列名与插入位置:紧随原列后或追加至表尾)。 - 红字删除线高亮显示被剥离的组队门牌信息,直观审查。
- 支持上传
- 🧪 在线即时测试沙盒:支持单条和多行文本粘贴实时清洗与行政区划拆解展示。
- 📥 内置典型示例模板:自带 14+ 典型真实户籍地址测试集与 Excel 模板下载功能,无需准备文件即可直接体验。
Files built:
src/utils/addressCleaner.ts,src/utils/sampleData.ts,src/utils/excelHelper.ts,index.html,src/components/StatsCards.tsx,src/components/ExcelCleanerTab.tsx,src/components/InstantTesterTab.tsx,src/components/RulesSettingsTab.tsx,src/App.tsx-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.