Sponsored by Deepsite.site

Entity Identificationn

Created By
u3588064a year ago
Recognize whether two sets of data are from the same entity.
Content

# EntityIdentification Identify whether two sets of data are from the same entity. 识别两组数据是否来自同一主体

This is a MCP (Model Context Protocol) server. 这是一个支持MCP协议的服务器。

Data Comparison Tool

This tool provides a comprehensive way to compare two sets of data, evaluating both exact and semantic equality of their values. It leverages text normalization and a language model to determine if the data originates from the same entity.

Features

  • **Text Normalization**: Converts text to lowercase, removes punctuation, and normalizes whitespace.
  • **Value Comparison**: Compares values directly and semantically (ignoring order for lists).
  • **JSON Traversal**: Iterates through each key in the JSON objects and compares corresponding values.
  • **Language Model Integration**: Uses a generative language model to assess semantic similarity and provide a final judgment on whether the data comes from the same entity.

Installation

To use this tool, ensure you have the necessary dependencies installed. You can install them using pip:

```bash pip install genai ```

Usage

Functions

  1. **normalize_text(text)**:

    • Normalizes the input text by converting it to lowercase, removing punctuation, and normalizing whitespace.
  2. **compare_values(val1, val2)**:

    • Compares two values both exactly and semantically.
    • If the values are lists, it ignores the order of elements for semantic comparison.
  3. **compare_json(json1, json2)**:

    • Compares two JSON objects key by key.
    • Uses `compare_values` to evaluate each key's values.
    • Integrates a language model to assess semantic similarity and provides a final judgment.

Example

```python 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) ```

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

Contact

If you have any questions or suggestions, please contact me:

Wechat ![qrcode_for_gh_643efb7db5bc_344(1)](https://github.com/u3588064/LLMemory/assets/53069671/8bb26c0f-4cab-438b-9f8c-16b1c26b3587)

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
CursorThe AI Code Editor
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
DeepChatYour AI Partner on Desktop
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Serper MCP ServerA Serper MCP Server
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
RedisA Model Context Protocol server that provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
Playwright McpPlaywright MCP server
ChatWiseThe second fastest AI chatbot™
Amap Maps高德地图官方 MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
WindsurfThe new purpose-built IDE to harness magic
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Tavily Mcp