Skip to main content

中国企业中英文名称对齐匹配库 (7825 家企业 100% 覆盖)

Project description

Matchina

English | 中文

中国企业中英文名称对齐匹配库。支持精确匹配、别名匹配、模糊搜索,离线使用,无需网络。

特性

  • 🔍 四层匹配策略:精确匹配 → 别名匹配 → 规则匹配 → 模糊匹配
  • 🇨🇳 中英文支持:同时支持中文和英文名称
  • 📦 离线使用:所有数据打包在库内,无需网络
  • 高性能:单次匹配 < 100ms
  • 🐍 Python 3.8+:支持 Python 3.8 及以上版本

安装

pip install matchina

快速开始

from matchina import resolve, search, resolve_batch

# 精确匹配
result = resolve("华为")
print(result[0].name_cn)      # 华为技术有限公司
print(result[0].name_en)      # Huawei Technologies Co., Ltd.
print(result[0].confidence)   # 1.0

# 英文匹配
result = resolve("Alibaba")
print(result[0].name_cn)       # 阿里巴巴集团控股有限公司

# 别名匹配
result = resolve("抖音")
print(result[0].name_cn)       # 北京字节跳动科技有限公司
print(result[0].confidence)    # 0.95

# 批量匹配
names = ["腾讯", "百度", "小米", "比亚迪"]
results = resolve_batch(names)
for name, matches in results.items():
    if matches:
        print(f"{name}{matches[0].name_cn}")

# 模糊搜索
results = search("科技", limit=5)
for r in results:
    print(f"{r.name_cn} (置信度: {r.confidence:.2f})")

匹配策略

匹配类型 说明 置信度
exact 完全匹配 1.0
alias 别名匹配 0.95
rule 规则匹配(后缀/缩写) 0.85
fuzzy 模糊匹配(编辑距离) 0.6-0.8

数据覆盖

当前版本包含:

  • 7825 家企业实体 ✅ (100% 中文名 - 英文名对齐)
  • A 股上市公司: 完整覆盖
  • 港股上市公司: 完整覆盖
  • 中概股: SEC EDGAR 数据
  • 独角兽品牌: 手动验证
  • 知名企业: 手动验证

API 文档

resolve(name, top_k=5)

匹配企业名称。

参数:

  • name (str): 企业名称(中文或英文)
  • top_k (int): 返回结果数量,默认 5

返回: List[MatchResult]

search(query, limit=10)

模糊搜索企业名称。

参数:

  • query (str): 搜索关键词
  • limit (int): 返回结果数量,默认 10

返回: List[MatchResult]

resolve_batch(names, top_k=5)

批量匹配企业名称。

参数:

  • names (List[str]): 企业名称列表
  • top_k (int): 每个名称返回结果数量

返回: Dict[str, List[MatchResult]]

MatchResult

匹配结果对象。

@dataclass
class MatchResult:
    entity_id: str      # 实体 ID
    name_cn: str        # 中文名称
    name_en: str        # 英文名称
    confidence: float   # 置信度 (0.0-1.0)
    aliases: List[str]  # 别名列表
    match_type: str     # 匹配类型

示例企业

中文名 英文名 别名
华为技术有限公司 Huawei Technologies Co., Ltd. 华为、HUAWEI
腾讯控股有限公司 Tencent Holdings Limited 腾讯、微信、QQ、Tencent
阿里巴巴集团控股有限公司 Alibaba Group Holding Limited 阿里、淘宝、天猫、Alibaba
北京字节跳动科技有限公司 Beijing ByteDance Technology Co., Ltd. 字节跳动、抖音、TikTok、今日头条
小米科技有限责任公司 Xiaomi Technology Co., Ltd. 小米、MI、Xiaomi

开发

# 克隆仓库
git clone https://github.com/xxx/matchina.git
cd matchina

# 安装开发依赖
pip install -e ".[dev]"

# 运行测试
pytest

# 类型检查
mypy matchina

# 代码检查
ruff check matchina

贡献

欢迎贡献代码、报告问题或提出建议!

  1. Fork 本仓库
  2. 创建功能分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -m 'Add amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 创建 Pull Request

许可证

MIT License

更新日志

v0.1.0 (2026-03-14)

  • 首次发布
  • 支持 1132 家企业实体
  • 四层匹配策略
  • 中英文支持

Matchina - Match China, Match Enterprise Names.优化 < 100ms

  • 📝 四套班子流程留痕系统

v0.1.0 (2026-03-14)

  • 首次发布
  • 支持 1132 家企业实体
  • 四层匹配策略
  • 中英文支持

Matchina - Match China, Match Enterprise Names.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

matchina-0.2.0.tar.gz (708.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

matchina-0.2.0-py3-none-any.whl (708.8 kB view details)

Uploaded Python 3

File details

Details for the file matchina-0.2.0.tar.gz.

File metadata

  • Download URL: matchina-0.2.0.tar.gz
  • Upload date:
  • Size: 708.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for matchina-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0ad390e411aa918ad80be7aee3e1bf4a1c4530bb291a2866519e0628ab0cca09
MD5 79c8b970118d47929e9074445f6d646e
BLAKE2b-256 2874c9c81f80a24292f55b8fe62ea86caa1ae5b2f6858f49964890adda6a7d22

See more details on using hashes here.

Provenance

The following attestation bundles were made for matchina-0.2.0.tar.gz:

Publisher: publish.yml on janseling/matchina

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file matchina-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: matchina-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 708.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for matchina-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 249b9a9bd7e538ba0a13e6dda999ff9067e61c325c99f1cd94934f0448bd3127
MD5 cdc27e4bd60d08c09e6d614fd3da08c9
BLAKE2b-256 3b10b55995ca9866286abaee342a1f48a849aab8e5224289e904b0a7c6b6dae0

See more details on using hashes here.

Provenance

The following attestation bundles were made for matchina-0.2.0-py3-none-any.whl:

Publisher: publish.yml on janseling/matchina

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page