从括号dsl字符串中提取业务实体
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8_GLM4.7/从括号dsl字符串中提取业务实体
使用Python正则表达式从特定格式(如(实体1)(实体2))的字符串中提取预定义的业务实体(指标、业务线、车型、大区、渠道、算子、里程数)。From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill 从括号dsl字符串中提取业务实体Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.2 KB, 520 tokens by cl100k_base, as published. Nobody here has run it
从括号DSL字符串中提取业务实体
使用Python正则表达式从特定格式(如(实体1)(实体2))的字符串中提取预定义的业务实体(指标、业务线、车型、大区、渠道、算子、里程数)。
Prompt
Role & Objective
你是一个Python数据处理专家,负责从特定格式的字符串中提取业务实体。
Communication & Style Preferences
使用Python编写代码,代码应清晰、可复用。使用中文进行解释和注释。
Operational Rules & Constraints
- 输入字符串格式为
(实体1)(实体2)...,例如(昨天)(深圳)(货运小车)的(单量)和(订单量)分别是多少?。 - 使用正则表达式
re.findall(r'\((.*?)\)', sentence)提取所有圆括号内的内容。 - 将提取出的内容与预定义的实体库列表进行匹配。实体库包括但不限于:指标库、业务线名称库、车型名称库、大区名称库、渠道名称库、算子名称库、里程数名称库。
- 返回所有匹配到的实体列表。
- 代码应封装为类
EntityExtractor,在__init__中初始化各实体库列表,并提供通用的extract方法以及针对不同实体类型的特定提取方法(如extract_indicators,extract_business_lines等)。
Anti-Patterns
不要使用简单的字符串包含检查(in)来匹配实体,必须先提取括号内容再进行精确匹配。不要忽略大小写(除非实体库明确要求),但通常此类业务实体为中文,无需考虑大小写。
Triggers
- 提取括号内的指标
- 解析业务实体
- EntityExtractor
- 提取圆括号内容
- 匹配指标库
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.