AI个人学习
和实操指南

iText2KG核心提示指令:提取知识图谱实体关系和实体

一款不错的基于LLM构建增量式知识图谱的工具:itext2kg

iText2KG即插即用,适用于多种场景,比如科学论文、网站、简历的图谱转换,性能优于现有基线


特点:
1、可以根据新文档不断更新知识图谱,将新信息整合到已有结构中
2、不需要针对特定领域进行训练,可以跨领域提取知识
3、包含模块用于文档提炼、实体提取和关系提取,确保提取的实体和关系是唯一且解析过的,减少错误和重复信息
4、支持将提取的实体和关系整合到 Neo4j 数据库中,并提供可视化界面

 

提取实体关系

Act like an expert in Information Extraction. If you don’t find the information, keep its place empty in the json. If the text is in English or French, translate it to English.  

Question:
    # Directives
    - Adhere completely to the provided entities list.
    - Do not add any entity outside the provided list.
    - Extract ONE predicate per subject and object.
    - ALL entities in the provided list should have a relation.

Format Instructions:The output should be formatted as a JSON instance that conforms to the JSON schema below.

As an example, for the schema `{"properties": {"foo": {"title": "Foo", "description": "a list of strings", "type": "array", "items": {"type": "string"}},"required": ["foo"]}}`  
The object `{"foo": ["bar", "baz"]}` is a well-formatted instance of the schema.  
The object `{"properties": {"foo": ["bar", "baz"]}}` is not well-formatted.

Here is the output schema: 
```json
{
  "properties": {
    "relationships": {
      "title": "Relationships",
      "default": "Given the provided entities and context, try to find the predicates between these entities. They should be chosen carefully to accurately represent the relationship being expressed.",
      "type": "array",
      "items": {
        "$ref": "#/definitions/Relationship"
      }
    }
  },
  "definitions": {
    "Relationship": {
      "title": "Relationship",
      "type": "object",
      "properties": {
        "startNode": {
          "title": "Startnode",
          "default": "The start entity, found in the entities list",
          "type": "string"
        },
        "endNode": {
          "title": "Endnode",
          "default": "The end entity, found in the entities list",
          "type": "string"
        },
        "name": {
          "title": "Name",
          "default": "The predicate between the two entities. The predicate should encode ONE relation.",
          "type": "string"
        }
      }
    }
  }
}
	Answer:

 

提取实体关系中文版

充当信息提取专家。如果未找到信息,请在json中保留该位置为空。如果文本是英文或法文,则将其翻译为英文。  
<上下文>  
问题:  
    # 指令  
    - 完全遵循提供的实体列表。  
    - 不添加任何提供列表之外的实体。  
    - 每个主题和对象提取一个谓词。  
    - 所有提供列表中的实体必须有关系。  

格式说明:输出应格式化为符合以下JSON模式的JSON实例。  

例如,对于模式 `{"properties": {"foo": {"title": "Foo", "description": "a list of strings", "type": "array", "items": {"type": "string"}},"required": ["foo"]}}`  
对象 `{"foo": ["bar", "baz"]}` 是符合该模式的格式良好的实例。  
对象 `{"properties": {"foo": ["bar", "baz"]}}` 不是格式良好的。  

这是输出模式:  
```json  
{  
  "properties": {  
    "relationships": {  
      "title": "Relationships",  
      "default": "根据提供的实体和上下文,尝试找出这些实体之间的谓词。应仔细选择以准确表示所表达的关系。",  
      "type": "array",  
      "items": {  
        "$ref": "#/definitions/Relationship"  
      }  
    }  
  },  
  "definitions": {  
    "Relationship": {  
      "title": "Relationship",  
      "type": "object",  
      "properties": {  
        "startNode": {  
          "title": "Startnode",  
          "default": "起始实体,见于实体列表",  
          "type": "string"  
        },  
        "endNode": {  
          "title": "Endnode",  
          "default": "结束实体,见于实体列表",  
          "type": "string"  
        },  
        "name": {  
          "title": "Name",  
          "default": "两个实体之间的谓词。谓词应编码一个关系。",  
          "type": "string"  
        }  
      }  
    }  
  }  
}  
	答案:  

 

 

提取实体

Act like an expert in Information Extraction. If you don’t find the information, keep its place empty in the json. If the text is not in English or French, translate it to English.  

Question:
Format Instructions:The output should be formatted as a JSON instance that conforms to the JSON schema below.

As an example, for the schema `{"properties": {"foo": {"title": "Foo", "description": "a list of strings", "type": "array", "items": {"type": "string"}},"required": ["foo"]}}`  
The object `{"foo": ["bar", "baz"]}` is a well-formatted instance of the schema.  
The object `{"properties": {"foo": ["bar", "baz"]}}` is not well-formatted.

Here is the output schema:  
```json
{
  "properties": {
    "entities": {
      "title": "Entities",
      "default": "All the entities presented in the context. The entities should encode ONE concept.",
      "type": "array",
      "items": {
        "$ref": "#/definitions/Entity"
      }
    }
  },
  "definitions": {
    "Entity": {
      "title": "Entity",
      "type": "object",
      "properties": {
        "label": {
          "title": "Label",
          "default": "The type or category of the entity, such as 'Process', 'Technique', 'Data Structure', 'Methodology', 'Person', etc. This field helps in classifying and organizing entities within the knowledge graph.",
          "type": "string"
        },
        "name": {
          "title": "Name",
          "default": "The specific name of the entity. It should represent a single, distinct concept and must not be an empty string. For example, if the entity is a 'Technique', the name could be 'Neural Networks'.",
          "type": "string"
        }
      }
    }
  }
}
	Answer:

 

提取实体中文版

扮演一个信息提取专家。如果找不到相关信息,请在JSON中将对应位置保留为空。如果文本不是英语或法语,请将其翻译成英语。

问题:
格式说明:输出应该格式化为符合以下JSON模式的JSON实例。

例如,对于模式`{"properties": {"foo": {"title": "Foo", "description": "a list of strings", "type": "array", "items": {"type": "string"}},"required": ["foo"]}}`
对象`{"foo": ["bar", "baz"]}`是该模式的格式正确的实例。
对象`{"properties": {"foo": ["bar", "baz"]}}`格式不正确。

以下是输出模式:
```json
{
  "properties": {
    "entities": {
      "title": "实体",
      "default": "上下文中出现的所有实体。每个实体应该表示一个独立的概念。",
      "type": "array",
      "items": {
        "$ref": "#/definitions/Entity"
      }
    }
  },
  "definitions": {
    "Entity": {
      "title": "实体",
      "type": "object",
      "properties": {
        "label": {
          "title": "标签",
          "default": "实体的类型或类别,如'过程'、'技术'、'数据结构'、'方法论'、'人物'等。此字段有助于在知识图谱中对实体进行分类和组织。",
          "type": "string"
        },
        "name": {
          "title": "名称",
          "default": "实体的具体名称。它应代表一个单一的、明确的概念,且不能为空字符串。例如,如果实体类型是'技术',名称可能是'神经网络'。",
          "type": "string"
        }
      }
    }
  }
}
回答:
AI轻松学

普通人的AI入门指南

帮助你以低成本、零基础学会如何利用AI工具。AI就像办公软件一样,是每个人的必备技能。 掌握AI会让你在求职中占据优势,在未来的工作和学习中事半功倍。

查看详情>
未经允许不得转载:首席AI分享圈 » iText2KG核心提示指令:提取知识图谱实体关系和实体

首席AI分享圈

首席AI分享圈专注于人工智能学习,提供全面的AI学习内容、AI工具和实操指导。我们的目标是通过高质量的内容和实践经验分享,帮助用户掌握AI技术,一起挖掘AI的无限潜能。无论您是AI初学者还是资深专家,这里都是您获取知识、提升技能、实现创新的理想之地。

联系我们
zh_CN简体中文