{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-04-25T07:45:41.079990Z",
     "start_time": "2025-04-25T07:45:41.072334Z"
    }
   },
   "source": [
    "import cpca\n",
    "\n",
    "string_4 = [\"江苏省苏州市昆山市开发区青阳南路308号1室车佰佳汽车服务部\"]  # 移除重复的\"苏州市\"\n",
    "df_address = cpca.transform(string_4)\n",
    "\n",
    "# 检查解析结果\n",
    "print(\"解析结果：\")\n",
    "print(df_address)\n",
    "\n",
    "# 提取省市区\n",
    "if not df_address.empty:\n",
    "    string11 = df_address.iloc[0]['省']\n",
    "    string12 = df_address.iloc[0]['市']\n",
    "    string13 = df_address.iloc[0]['区']\n",
    "else:\n",
    "    string11 = string12 = string13 = \"解析失败\"\n",
    "\n",
    "print(\"最终结果：\")\n"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "解析结果：\n",
      "     省    市    区                     地址  adcode\n",
      "0  江苏省  苏州市  昆山市  开发区青阳南路308号1室车佰佳汽车服务部  320583\n",
      "最终结果：\n"
     ]
    }
   ],
   "execution_count": 2
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
