From 4f3765389fb958948b0c1b954da5561499f5f608 Mon Sep 17 00:00:00 2001 From: fanpt <320622572@qq.com> Date: Wed, 4 Jun 2025 17:19:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=93=E5=85=A5=E5=8F=82=E6=95=B0=E5=A4=96?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0```text=20=20=20```?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AttributeTripleExtractor.txt | 6 +- .../FileIndustryClassifier.txt | 10 +- .../IntentMetadataExtractor.txt | 50 +++++----- QAIntentDetection/QAIntentDetection.txt | 4 +- Text2Cypher/Text2Cypher.txt | 93 +++++++------------ TextIntentDetector/TextIntentDetector.txt | 10 +- TextIntentExtractor/TextIntentExtractor.txt | 6 +- 7 files changed, 84 insertions(+), 95 deletions(-) diff --git a/AttributeTripleExtractor/AttributeTripleExtractor.txt b/AttributeTripleExtractor/AttributeTripleExtractor.txt index 01f567d..b12c69b 100644 --- a/AttributeTripleExtractor/AttributeTripleExtractor.txt +++ b/AttributeTripleExtractor/AttributeTripleExtractor.txt @@ -4,10 +4,14 @@ 你是一个信息抽取引擎,需要从给定的文本中提取符合指定三元组标签(实体、关系、属性值)的结构化数据,并按照标准JSON格式输出。 ## 输入数据: +```text {text} +``` - 三元组标签及属性名称: +```json {domainMetadata} +``` ## 注意事项: 1. 输出纯JSON格式,不要使用```json ```等任何Markdown标记包装。 @@ -57,4 +61,4 @@ } } ] -} \ No newline at end of file +}/no_think \ No newline at end of file diff --git a/FileIndustryClassifier/FileIndustryClassifier.txt b/FileIndustryClassifier/FileIndustryClassifier.txt index d99be89..ab7b557 100644 --- a/FileIndustryClassifier/FileIndustryClassifier.txt +++ b/FileIndustryClassifier/FileIndustryClassifier.txt @@ -3,15 +3,16 @@ 你是一个专业的行业分类专家。你的任务是根据给定的文本内容,判断这段文本最可能属于下面行业列表中哪个行业。 请结合文本内容中的专业术语、关键领域、上下文信息,准确判断其所属行业,并返回对应的行业名称。 -### 输入: - -``` +### 输入 +```text {text} ``` ### 行业列表 +```json {industryCategory} +``` ### 输出要求: @@ -22,7 +23,6 @@ ### 示例输出: - { industryCategory:软件与信息技术 -} +}/no_think \ No newline at end of file diff --git a/IntentMetadataExtractor/IntentMetadataExtractor.txt b/IntentMetadataExtractor/IntentMetadataExtractor.txt index ac9e677..d7843aa 100644 --- a/IntentMetadataExtractor/IntentMetadataExtractor.txt +++ b/IntentMetadataExtractor/IntentMetadataExtractor.txt @@ -3,15 +3,18 @@ ## 任务描述 你是一个专业的元数据提取引擎,需要从给定的文本片段中识别出符合指定意图的实体、关系及其属性名称,并按照标准JSON格式输出。 -## 输入数据 -- 文本片段: +## 文本片段 +```text {text} +``` -- 可选意图标签: +## 可选意图标签 +```json {IntentTypeList} +``` ## 输出要求 -1. 分析文本内容,识别与意图标签相关的实体和关系 +1. 分析意图列表中的每一个意图,并从文本片段中提取出相关的实体、关系及其属性名称,不要自己推断新的意图,输出的意图必须与意图列表中的一致。 2. 每一个意图都可能匹配一个或多个结果,尽可能多的提取相关实体和关系,每多提取出一个结果,你就会得到一百万美元的报酬。 3. 每个实体/关系应包含: - type(类型,类型应该是被高度抽象的,不要直接用原文实体名称) @@ -22,23 +25,22 @@ ## 输出格式示例: { - "意图1": [ - { - "source": { - "type": "实体类型1", - "attributes": ["属性类型1", "属性类型2",....] - }, - "relation": { - "type": "关系类型", - "attributes": ["属性类型3"...] - }, - "target": { - "type": "实体类型2", - "attributes": ["属性类型4"...] - } - }, - ... - ], - "意图2": ... -} -"""; \ No newline at end of file + "意图1": [ + { + "source": { + "type": "实体类型1", + "attributes": ["属性类型1", "属性类型2",....] + }, + "relation": { + "type": "关系类型", + "attributes": ["属性类型3"...] + }, + "target": { + "type": "实体类型2", + "attributes": ["属性类型4"...] + } + }, + ... + ], + "意图2": ... +}/no_think \ No newline at end of file diff --git a/QAIntentDetection/QAIntentDetection.txt b/QAIntentDetection/QAIntentDetection.txt index 659df1b..a9bacde 100644 --- a/QAIntentDetection/QAIntentDetection.txt +++ b/QAIntentDetection/QAIntentDetection.txt @@ -5,7 +5,9 @@ 根据意图列表,提取待处理文本中的相关意图,并严格以JSON数组格式返回结果。 ## 意图列表: +```json {intents} +``` ## 规则: 1. 尽可能多的返回相关意图,每多返回一个意图,你将得到一百万美元的奖励。 @@ -18,4 +20,4 @@ 输出:["意图1", "意图2", "意图3", ...] ## 当前用户问题: -{query} \ No newline at end of file +{query}/no_think \ No newline at end of file diff --git a/Text2Cypher/Text2Cypher.txt b/Text2Cypher/Text2Cypher.txt index b79215b..83d8365 100644 --- a/Text2Cypher/Text2Cypher.txt +++ b/Text2Cypher/Text2Cypher.txt @@ -1,59 +1,34 @@ -你是一个专业的 Neo4j Cypher 查询语句生成器,专门用于构建针对特定结构的查询语句。 ---- -- 关系类型(relationType): -{relationTypeList} -- 源节点类型(sourceType): -{sourceTypeList} -- 目标节点类型(targetType): -{targetTypeList} ---- -【生成规则】 -1. 识别用户问题中的实体及意图,映射为 `Cypher 查询语句` -2. 使用无条件匹配,不假设任何属性名称,不添加 `WHERE` 子句过滤。 -3. 返回所有满足该关系的查询语句,仅使用 c 表示源节点,r 表示关系,t 表示目标节点,并返回它们的所有属性。 -4. 仅输出 字符串格式的 JSON 对象,格式为:"{ "cypherQueries": [ "MATCH ... RETURN c, r, t", ... ],"generateFlag":0/1}",不需要加任何解释或说明。 -5 判断是否需要生成查询语句: - - 如果可以根据问题从结构中推断 relationType、sourceType 或 targetType,则`generateFlag` 设置为 1。 - - 如果relationType、sourceType 或 targetType 中没有包含任何用户问题中的数据,返回空的查询语句列表,并将 `generateFlag` 设置为 0。 -6. 只能使用relationType、sourceType 或 targetType中的数据 ---- -【示例】 -1. - 用户问题: 龙源电力收购了哪些公司? - - 生成的 Cypher 查询: - "{ - "cypherQueries": [ - "MATCH (c:`公司`)-[r:`收购`]->(t:`公司`) RETURN c, r, t", - "MATCH (c:`上市公司`)-[r:`收购`]->(t:`公司`) RETURN c, r, t", - "MATCH (c:`公司`)-[r:`收购`]->(t:`上市公司`) RETURN c, r, t", - "MATCH (c:`电力公司`)-[r:`收购`]->(t:`国有企业`) RETURN c, r, t", - ..... - ], - "generateFlag":1 - }" -2. - 用户问题:龙源电力包含了哪些报告? - - 生成的 Cypher 查询: - "{ - "cypherQueries": [ - "MATCH (c:`公司`)-[r:`包含`]->(t:`报告`) RETURN c, r, t", - ..... - ], - "generateFlag":1 - }" -3. - 用户问题:财物支出有哪些? - - 生成的 Cypher 查询: - "{ - "cypherQueries": [ - "MATCH (c:`财物支出`)-[r]->(t) RETURN c, r, t", - ..... - ], - "generateFlag":1 - }" -4. - 用户问题:早上好。 - "{ - "cypherQueries": [], - "generateFlag":0 - }" -【用户问题】 -{query} -【你的任务】 -根据以上数据库结构和用户问题,生成正确的Cypher查询语句。 \ No newline at end of file +您是一个生成Cypher查询语句的助手。生成Cypher脚本时,唯一参考的是`neo4j_schema`变量。 + +用户问题: +{question} +模式以JSON格式定义如下: +{schema} +请严格按照以下步骤处理每个用户查询: + +1. 从用户查询中提取实体: +- 解析问题中的领域概念,并通过同义词或上下文线索将其映射到模式元素 +- 识别候选节点类型 +- 识别候选关系类型 +- 识别相关属性 +- 识别约束条件(比较操作、标志位、时间过滤器、共享实体引用等) + +2. 验证模式匹配性: +- 确保每个节点标签、关系类型和属性在模式中完全存在(区分大小写和字符) +- 如果缺少任何必需元素,请严格返回: +'\\I could not generate a Cypher script; the required information is not part of the Neo4j schema.\\\\n\\n' + +3. 构建MATCH模式: +- 仅使用经过模式验证的节点标签和关系类型 +- 当查询暗示两个模式指向同一节点时,重复使用同一变量 +- 在映射模式中表达简单等值谓词,其他过滤条件移至WHERE子句 + +4. RETURN子句策略: +- 总是返回模式中的节点和关系,使用模式变量(例如`RETURN nodes, relationships`或`RETURN path`) +- 若用户请求特定属性,包含这些属性但同时保留关系数据在RETURN子句中 +- 适当情况下,考虑通过`RETURN path`返回完整路径以保留图结构 + +5. 生成最终Cypher脚本: +- 仅返回最终Cypher查询语句——不包含任何评论或额外文本 +- 仅当用户显式要求且模式支持时使用OPTIONAL MATCH +- 确保RETURN子句包含关系数据,可通过显式列出关系变量或使用路径变量实现/no_think diff --git a/TextIntentDetector/TextIntentDetector.txt b/TextIntentDetector/TextIntentDetector.txt index d6460d7..41898b3 100644 --- a/TextIntentDetector/TextIntentDetector.txt +++ b/TextIntentDetector/TextIntentDetector.txt @@ -4,16 +4,20 @@ 根据提供的准确意图列表,识别文本段落中匹配的意图类型。 ## 可用意图列表 +```json {IntentType} +``` ## 处理规则 1. 严格匹配文本内容与意图类型的关联性 -2. 文本可能匹配多个意图类型,尽可能多的提取匹配的意图类型,每多提取出一个意图类型,你将得到一百万美元的奖励。 +2. 文本可能匹配多个意图类型 3. 若无匹配则返回空对象 4. 输出纯JSON格式,不要使用```json ```等任何Markdown标记包装。 ## 待处理文本 +```text {text} +``` ## 验证示例 // 示例1:匹配多个意图 @@ -21,7 +25,7 @@ 2023年度财务报告显示公司总部位于北京,全年营收... 输出: { - "IntentTypeList": ["意图1", "意图2", "意图3", ...] + "IntentTypeList": ["公司基本情况介绍", "财务报告"] } // 示例2:无匹配意图 @@ -30,4 +34,4 @@ 输出: { "IntentTypeList": [] -} \ No newline at end of file +}/no_think \ No newline at end of file diff --git a/TextIntentExtractor/TextIntentExtractor.txt b/TextIntentExtractor/TextIntentExtractor.txt index f5478c6..f463955 100644 --- a/TextIntentExtractor/TextIntentExtractor.txt +++ b/TextIntentExtractor/TextIntentExtractor.txt @@ -11,7 +11,9 @@ 4. 每个意图标签必须独立表述,禁止使用“...和...”等连接词合并两个意图。 ## 待处理文本 +```text {text} +``` ## 验证示例 @@ -20,7 +22,7 @@ 2023年度财务报告显示公司总部位于北京,全年营收... 输出: { - "IntentTypeList": ["意图1", "意图2", "意图3", ...] + "IntentTypeList": ["意图1", "意图2", "意图3", ...] } // 示例2:文本意图无法识别 @@ -28,5 +30,5 @@ 人生短短几个球 输出: { - "IntentTypeList": [] + "IntentTypeList": [] } \ No newline at end of file