Skip to main content

Japanese entity parser library for company/corporate name normalization and extraction.

Project description

ja-entity-parser

Test PyPI - Version

日本語 / English

Overview

ja-entity-parser is a Python library for normalization and extraction of Japanese entities: corporate names, personal names, and addresses.
It combines SudachiPy morphological analysis with custom normalization rules (old/new kanji conversion, kanji numeral conversion, bracket/punctuation/control character unification, NFKC, and user dictionary replacements) to accurately parse Japanese text into structured components.

Features

  • Japanese text normalization: Old/new kanji conversion, kanji numeral → Arabic, bracket/punctuation/control character unification, NFKC, corporate abbreviation expansion ((株)株式会社, etc.)
  • Corporate name parsing: Legal form extraction and brand name/kana via SudachiPy
  • Personal name parsing: Family/given name split using SudachiPy POS, whitespace, or surname dictionary
  • Address parsing: Prefecture → city → town → block using Address Base Registry data
  • User dictionary support: Extendable for industry-specific terms
  • Testing: 66 pytest-based unit and integration tests

Installation

pip install ja-entity-parser

Usage

1. Parse corporate name

from ja_entityparser import parse_corporate

result = parse_corporate("トヨタ自動車株式会社")
print(result)
# {
#   'input': 'トヨタ自動車株式会社',
#   'normalized': 'トヨタ自動車株式会社',
#   'legal_form': '株式会社',
#   'brand_name': 'トヨタ自動車',
#   'brand_kana': 'トヨタジドウシャ'
# }

# Abbreviations are automatically expanded:
result = parse_corporate("(株)ソフトバンク")
# normalized: '株式会社ソフトバンク'

2. Parse person name

from ja_entityparser import parse_person

result = parse_person("田中 太郎")
print(result)
# {
#   'input': '田中 太郎',
#   'normalized': '田中 太郎',
#   'family_name': '田中',
#   'given_name': '太郎',
#   'family_name_kana': 'タナカ',
#   'given_name_kana': 'タロウ'
# }

3. Parse address

from ja_entityparser import parse_address

result = parse_address("東京都台東区寿3-1-5")
print(result)
# {
#   'input': '東京都台東区寿3-1-5',
#   'normalized': '東京都台東区寿3-1-5',
#   'prefecture': '東京都',
#   'city': '台東区',
#   'town': '寿',
#   'block': '3-1-5'
# }

Address data is sourced from the Japanese government's アドレス・ベース・レジストリ (Address Base Registry).

4. Normalization only

from ja_entityparser.normalizer import normalize

text = "〔トヨタ〕(株)テスト 三百二十一号"
print(normalize(text))
# (トヨタ)株式会社テスト 321号

API Reference

Function Description Returns
parse_corporate(text) Parse Japanese corporate name input, normalized, legal_form?, brand_name, brand_kana
parse_person(text) Parse Japanese person name input, normalized, family_name?, given_name?, *_kana?
parse_address(text) Parse Japanese address input, normalized, prefecture?, city?, town?, block?
normalize(text) Normalize Japanese text str

License

Apache License 2.0

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

ja_entity_parser-1.0.0.tar.gz (37.6 kB view details)

Uploaded Source

Built Distribution

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

ja_entity_parser-1.0.0-py3-none-any.whl (31.8 kB view details)

Uploaded Python 3

File details

Details for the file ja_entity_parser-1.0.0.tar.gz.

File metadata

  • Download URL: ja_entity_parser-1.0.0.tar.gz
  • Upload date:
  • Size: 37.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ja_entity_parser-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c68c08f8c63c829bf85afad681547ea9c3ac3a7799c78d435da67abb412a8292
MD5 3958d22dd1071bdc9aee4ed154301afa
BLAKE2b-256 ee10373439bd936ffec9fc8be27eaff4eb8a11a9a3a1cd51429f1f2d21e72a00

See more details on using hashes here.

File details

Details for the file ja_entity_parser-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ja_entity_parser-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3993d258a987ef2fc567fdaf9abe916d67f2d0ef4a5da4cbe2e8dd9a039acc50
MD5 d0459aadf7be3beccf5976ae7b9307a6
BLAKE2b-256 362bf7d3374461500fb687300dadc8945799bd98ca05b2c5d11ad7fe2a010744

See more details on using hashes here.

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