A domain-specific language (DSL) for defining and implementing automated customer service chatbots. This project provides a language interpreter that processes scripts written in Apple_RSL and executes them to create interactive customer service experiences.
- Custom DSL designed specifically for customer service interactions
- Script parser that transforms text scripts into executable structures
- Interactive interpreter with both CLI and GUI interfaces
- User data management and authentication
- 6 service categories: Product Information, Order Processing, Account Management, Technical Support, Company Policies, and Promotions
- Comprehensive testing framework
- Clone the repository
git clone https://github.com/xiangri678/PyDSL_APPLE.git
cd PyDSL_APPLE
- Install dependencies
pip install PyQt5
python interpreter_GUI.py script_after_sale.txt
python interpreter.py script_pre_sale.txt
script_pre_sale.txt
- Pre-sales service including product info, promotions, and company policiesscript_after_sale.txt
- After-sales service including order processing, tech support, and company policiesscript_support.txt
- Customer support services including account management and order processingscript_wechat.txt
- WeChat interface including product info, promotions, and order processing
Apple_RSL/
├── py/ # Python source files
│ ├── parser.py # Script parser implementation
│ ├── interpreter.py # CLI interpreter
│ └── interpreter_GUI.py # GUI interpreter implementation
├── script/ # Apple_RSL scripts
│ ├── script_pre_sale.txt
│ ├── script_after_sale.txt
│ ├── script_support.txt
│ └── script_wechat.txt
├── test/ # Testing files and modules
│ ├── test_parser_V3.py
│ ├── test_interpreter_V1.py
│ └── testsuite.py
├── user_data.json # Sample user data for testing
└── README.md
Apple_RSL is defined using BNF notation:
<Script> ::= <Step>+
<Step> ::= "Step" <Identifier> <NewLine> <Command>+
<Command> ::= <Say> | <Listen> | <Branch> | <Awake> | <Default> | <Exit>
<Say> ::= "SAY" <QuotedString> <NewLine>
<Listen> ::= "LISTEN" <Number> <Number> <NewLine>
<Branch> ::= "BRANCH" <QuotedString> <Identifier> <NewLine>
<Awake> ::= "AWAKE" <Identifier> <NewLine>
<Default> ::= "DEFAULT" <Identifier> <NewLine>
<Exit> ::= "EXIT" <NewLine>
Run the test suite to verify all components:
python testsuite.py
Individual tests can also be run:
# Test the parser
python test_parser_V3.py
# Test the interpreter
python test_interpreter_V1.py
这是一个领域特定语言(DSL)项目,用于定义和实现自动化客服机器人。该项目提供了一个语言解释器,可以处理使用Apple_RSL编写的脚本并执行它们来创建交互式客服体验。
- 专为客服交互设计的自定义DSL
- 将文本脚本转换为可执行结构的脚本解析器
- 支持CLI和GUI界面的交互式解释器
- 用户数据管理和身份验证
- 6种服务类别:产品信息、订单处理、账户管理、技术支持、公司政策和促销活动
- 全面的测试框架
- 克隆仓库
git clone https://github.com/xiangri678/PyDSL_APPLE.git
cd PyDSL_APPLE
- 安装依赖
pip install PyQt5
python interpreter_GUI.py script_after_sale.txt
python interpreter.py script_pre_sale.txt
script_pre_sale.txt
- 售前服务,包括产品信息、促销活动和公司政策script_after_sale.txt
- 售后服务,包括订单处理、技术支持和公司政策script_support.txt
- 客户支持服务,包括账户管理和订单处理script_wechat.txt
- 微信接口,包括产品信息、促销活动和订单处理
Apple_RSL/
├── py/ # Python源文件
│ ├── parser.py # 脚本解析器实现
│ ├── interpreter.py # CLI解释器
│ └── interpreter_GUI.py # GUI解释器实现
├── script/ # Apple_RSL脚本
│ ├── script_pre_sale.txt
│ ├── script_after_sale.txt
│ ├── script_support.txt
│ └── script_wechat.txt
├── test/ # 测试文件和模块
│ ├── test_parser_V3.py
│ ├── test_interpreter_V1.py
│ └── testsuite.py
├── user_data.json # 用于测试的示例用户数据
└── README.md
Apple_RSL使用BNF表示法定义:
<Script> ::= <Step>+
<Step> ::= "Step" <Identifier> <NewLine> <Command>+
<Command> ::= <Say> | <Listen> | <Branch> | <Awake> | <Default> | <Exit>
<Say> ::= "SAY" <QuotedString> <NewLine>
<Listen> ::= "LISTEN" <Number> <Number> <NewLine>
<Branch> ::= "BRANCH" <QuotedString> <Identifier> <NewLine>
<Awake> ::= "AWAKE" <Identifier> <NewLine>
<Default> ::= "DEFAULT" <Identifier> <NewLine>
<Exit> ::= "EXIT" <NewLine>
运行测试套件以验证所有组件:
python testsuite.py
也可以单独运行各个测试:
# 测试解析器
python test_parser_V3.py
# 测试解释器
python test_interpreter_V1.py