Skip to main content
Glama
u3588064

EntityIdentification

by u3588064

实体识别

识别两组数据是否来自同一实体。 识别数据是否来自同一主体

这是一个 MCP(模型上下文协议)服务器。 这是一个支持MCP协议的服务器。

数据比较工具

此工具提供了一种全面的方法,可以比较两组数据,评估其值的精确性和语义相等性。它利用文本规范化和语言模型来确定数据是否来自同一实体。

特征

  • 文本规范化:将文本转换为小写,删除标点符号,并规范化空格。

  • 值比较:直接和语义上比较值(忽略列表的顺序)。

  • JSON 遍历:遍历 JSON 对象中的每个键并比较相应的值。

  • 语言模型集成:使用生成语言模型评估语义相似度,并对数据是否来自同一实体做出最终判断。

Related MCP server: Agentic RAG with MCP Server

安装

要使用此工具,请确保已安装必要的依赖项。您可以使用 pip 安装它们:

pip install genai

用法

功能

  1. 规范化文本(文本) :

    • 通过将输入文本转换为小写、删除标点符号和规范化空格来规范化输入文本。

  2. 比较值(val1,val2) :

    • 精确且语义地比较两个值。

    • 如果值是列表,它会忽略元素的顺序以进行语义比较。

  3. 比较json(json1,json2) :

    • 按键比较两个 JSON 对象。

    • 使用compare_values来评估每个键的值。

    • 集成语言模型评估语义相似度并给出最终判断。

例子

import json
import genai
import re

# Define your JSON objects
json1 = {
    "name": "John Doe",
    "address": "123 Main St, Anytown, USA",
    "hobbies": ["reading", "hiking", "coding"]
}

json2 = {
    "name": "john doe",
    "address": "123 Main Street, Anytown, USA",
    "hobbies": ["coding", "hiking", "reading"]
}

# Compare the JSON objects
comparison_results = compare_json(json1, json2)

# Generate final matching result
model1 = genai.GenerativeModel("gemini-2.0-flash-thinking-exp")
result_matching = model1.generate_content("综合这些信息,你认为可以判断两个数据来自同一主体吗?"+json.dumps(comparison_results, ensure_ascii=False, indent=4))
print(result_matching.text)

贡献

欢迎贡献!请打开一个问题或提交一个拉取请求。

执照

本项目遵循 MIT 许可证。详情请参阅LICENSE文件。

接触

如果您有任何问题或建议,请联系我:

微信qrcode_for_gh_643efb7db5bc_344(1)

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    This MCP server extracts entities and relationships from text and stores them in Neo4j, supporting multiple isolated knowledge graph projects that share the same database.
    102
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that implements a heavily typed knowledge graph memory system with AI-powered entity and relation extraction, enabling structured knowledge storage and retrieval from unstructured text using predefined or custom ontologies.
    9
    -