|
1 | | -ENTITY_TYPE_CONFLICT_PROMPT = """你是一个知识图谱一致性评估专家。你的任务是判断同一个实体在不同文本块中被提取为不同的类型,是否存在语义冲突。 |
| 1 | +ENTITY_TYPE_CONFLICT_PROMPT_ZH = """你是一个知识图谱一致性评估专家。你的任务是判断同一个实体在不同文本块中被提取为不同的类型,是否存在语义冲突。 |
2 | 2 |
|
3 | 3 | 实体名称:{entity_name} |
4 | 4 |
|
|
21 | 21 | }} |
22 | 22 | """ |
23 | 23 |
|
24 | | -ENTITY_DESCRIPTION_CONFLICT_PROMPT = """你是一个知识图谱一致性评估专家。你的任务是判断同一个实体在不同文本块中的描述是否存在语义冲突。 |
| 24 | +ENTITY_TYPE_CONFLICT_PROMPT_EN = """You are a Knowledge Graph Consistency Assessment Expert. Your task is to determine whether there are semantic conflicts when the same entity is extracted as different types in different text blocks. |
| 25 | +
|
| 26 | +Entity Name: {entity_name} |
| 27 | +
|
| 28 | +Type extraction results from different text blocks: |
| 29 | +{type_extractions} |
| 30 | +
|
| 31 | +Preset entity type list (for reference): |
| 32 | +concept, date, location, keyword, organization, person, event, work, nature, artificial, science, technology, mission, gene |
| 33 | +
|
| 34 | +Please determine whether these types have semantic conflicts (i.e., whether they describe the same category of things, or if there are contradictions). |
| 35 | +Note: If types are just different expressions of the same concept (such as concept and keyword), it may not be considered a serious conflict. |
| 36 | +
|
| 37 | +Please return in JSON format: |
| 38 | +{{ |
| 39 | + "has_conflict": <true/false>, |
| 40 | + "conflict_severity": <float between 0-1, where 0 means no conflict, 1 means severe conflict>, |
| 41 | + "conflict_reasoning": "<reasoning for conflict judgment>", |
| 42 | + "conflicting_types": ["<pairs of conflicting types>"], |
| 43 | + "recommended_type": "<if there is a conflict, the recommended correct type (must be one of the preset types)>" |
| 44 | +}} |
| 45 | +""" |
| 46 | + |
| 47 | +ENTITY_DESCRIPTION_CONFLICT_PROMPT_ZH = """你是一个知识图谱一致性评估专家。你的任务是判断同一个实体在不同文本块中的描述是否存在语义冲突。 |
25 | 48 |
|
26 | 49 | 实体名称:{entity_name} |
27 | 50 |
|
|
40 | 63 | }} |
41 | 64 | """ |
42 | 65 |
|
43 | | -RELATION_CONFLICT_PROMPT = """你是一个知识图谱一致性评估专家。你的任务是判断同一对实体在不同文本块中的关系描述是否存在语义冲突。 |
| 66 | +ENTITY_DESCRIPTION_CONFLICT_PROMPT_EN = """You are a Knowledge Graph Consistency Assessment Expert. Your task is to determine whether there are semantic conflicts in the descriptions of the same entity across different text blocks. |
| 67 | +
|
| 68 | +Entity Name: {entity_name} |
| 69 | +
|
| 70 | +Descriptions from different text blocks: |
| 71 | +{descriptions} |
| 72 | +
|
| 73 | +Please determine whether these descriptions have semantic conflicts (i.e., whether they describe the same entity, or if there is contradictory information). |
| 74 | +
|
| 75 | +Please return in JSON format: |
| 76 | +{{ |
| 77 | + "has_conflict": <true/false>, |
| 78 | + "conflict_severity": <float between 0-1>, |
| 79 | + "conflict_reasoning": "<reasoning for conflict judgment>", |
| 80 | + "conflicting_descriptions": ["<pairs of conflicting descriptions>"], |
| 81 | + "conflict_details": "<specific conflict content>" |
| 82 | +}} |
| 83 | +""" |
| 84 | + |
| 85 | +RELATION_CONFLICT_PROMPT_ZH = """你是一个知识图谱一致性评估专家。你的任务是判断同一对实体在不同文本块中的关系描述是否存在语义冲突。 |
44 | 86 |
|
45 | 87 | 实体对:{source_entity} -> {target_entity} |
46 | 88 |
|
|
58 | 100 | }} |
59 | 101 | """ |
60 | 102 |
|
61 | | -ENTITY_EXTRACTION_PROMPT = """从以下文本块中提取指定实体的类型和描述。 |
| 103 | +RELATION_CONFLICT_PROMPT_EN = """You are a Knowledge Graph Consistency Assessment Expert. Your task is to determine whether there are semantic conflicts in the relation descriptions of the same entity pair across different text blocks. |
| 104 | +
|
| 105 | +Entity Pair: {source_entity} -> {target_entity} |
| 106 | +
|
| 107 | +Relation descriptions from different text blocks: |
| 108 | +{relation_descriptions} |
| 109 | +
|
| 110 | +Please determine whether these relation descriptions have semantic conflicts. |
| 111 | +
|
| 112 | +Please return in JSON format: |
| 113 | +{{ |
| 114 | + "has_conflict": <true/false>, |
| 115 | + "conflict_severity": <float between 0-1>, |
| 116 | + "conflict_reasoning": "<reasoning for conflict judgment>", |
| 117 | + "conflicting_relations": ["<pairs of conflicting relation descriptions>"] |
| 118 | +}} |
| 119 | +""" |
| 120 | + |
| 121 | +ENTITY_EXTRACTION_PROMPT_ZH = """从以下文本块中提取指定实体的类型和描述。 |
62 | 122 |
|
63 | 123 | **重要**:你只需要提取指定的实体,不要提取其他实体。 |
64 | 124 |
|
|
96 | 156 | }} |
97 | 157 | """ |
98 | 158 |
|
| 159 | +ENTITY_EXTRACTION_PROMPT_EN = """Extract the type and description of the specified entity from the following text block. |
| 160 | +
|
| 161 | +**Important**: You should only extract the specified entity, do not extract other entities. |
| 162 | +
|
| 163 | +Entity Name: {entity_name} |
| 164 | +
|
| 165 | +Text Block: |
| 166 | +{chunk_content} |
| 167 | +
|
| 168 | +Please find and extract the following information for **this entity only** (entity name: {entity_name}) from the text block: |
| 169 | +
|
| 170 | +1. entity_type: Entity type, must be one of the following preset types (lowercase): |
| 171 | + - concept: concept |
| 172 | + - date: date |
| 173 | + - location: location |
| 174 | + - keyword: keyword |
| 175 | + - organization: organization |
| 176 | + - person: person |
| 177 | + - event: event |
| 178 | + - work: work |
| 179 | + - nature: nature |
| 180 | + - artificial: artificial |
| 181 | + - science: science |
| 182 | + - technology: technology |
| 183 | + - mission: mission |
| 184 | + - gene: gene |
| 185 | +
|
| 186 | + If the type cannot be determined, please use "concept" as the default value. |
| 187 | +
|
| 188 | +2. description: Entity description (briefly describe the role and characteristics of this entity in the text) |
| 189 | +
|
| 190 | +Please return in JSON format: |
| 191 | +{{ |
| 192 | + "entity_type": "<entity type (must be one of the preset types above)>", |
| 193 | + "description": "<entity description>" |
| 194 | +}} |
| 195 | +""" |
| 196 | + |
99 | 197 | CONSISTENCY_EVALUATION_PROMPT = { |
100 | | - "en": "", |
101 | | - "zh": "" |
| 198 | + "zh": { |
| 199 | + "ENTITY_TYPE_CONFLICT": ENTITY_TYPE_CONFLICT_PROMPT_ZH, |
| 200 | + "ENTITY_DESCRIPTION_CONFLICT": ENTITY_DESCRIPTION_CONFLICT_PROMPT_ZH, |
| 201 | + "RELATION_CONFLICT": RELATION_CONFLICT_PROMPT_ZH, |
| 202 | + "ENTITY_EXTRACTION": ENTITY_EXTRACTION_PROMPT_ZH, |
| 203 | + }, |
| 204 | + "en": { |
| 205 | + "ENTITY_TYPE_CONFLICT": ENTITY_TYPE_CONFLICT_PROMPT_EN, |
| 206 | + "ENTITY_DESCRIPTION_CONFLICT": ENTITY_DESCRIPTION_CONFLICT_PROMPT_EN, |
| 207 | + "RELATION_CONFLICT": RELATION_CONFLICT_PROMPT_EN, |
| 208 | + "ENTITY_EXTRACTION": ENTITY_EXTRACTION_PROMPT_EN, |
| 209 | + }, |
102 | 210 | } |
0 commit comments