npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

seimei-split

v0.2.0

Published

Split Japanese full names into family name and given name

Downloads

39

Readme

seimei-split

English

日本人のフルネームを姓(sei)と名(mei)に分離するライブラリです。

Playground で動作を試せます。

特徴

  • スペース区切り・スペースなしの両方に対応
  • 漢字・ひらがな・カタカナに対応
  • UniDic辞書同梱
  • TypeScript ファーストクラスサポート

インストール

npm install seimei-split

使い方

// 辞書同梱版(推奨)
import { split } from "seimei-split";

split("田中 太郎");  // => { sei: "田中", mei: "太郎" }
split("田中太郎");   // => { sei: "田中", mei: "太郎" }

// 辞書なし版(独自辞書を使う場合)
import { split, setLexicon } from "seimei-split/core";

仕組み

スペース区切りの入力

入力にスペース(半角・全角)が含まれる場合、スペース位置で直接分割します。辞書照合は行いません。

スペースなしの入力

スペースなしの名前(例: 田中太郎)に対しては、辞書ベースのスコアリングアルゴリズムを使用します。

1. 候補列挙

全ての分割位置を列挙します。田中太郎(4文字)の場合:

| 分割位置 | 姓 | 名 | |---|---|---| | 1 | 田 | 中太郎 | | 2 | 田中 | 太郎 | | 3 | 田中太 | 郎 |

最大分割位置は maxSeiLen(同梱辞書では11文字)で制限されます。

2. 辞書照合

各候補の姓・名部分を辞書で照合します。3段階のマッチレベルがあります:

| マッチ種別 | スコア | 説明 | |---|---|---| | surface | 4.0 | 辞書に完全一致 | | folded | 2.5 | 異体字変換後に一致(例: 齋藤 → 斎藤) | | reading | 1.0 | かな入力が既知の読みに一致(オプションの読みデータが必要) | | none | 0 | 一致なし |

3. スコアリング

各候補のスコアを算出します:

score = matchScore(姓) + matchScore(名) + lengthScore(姓) + lengthScore(名) + pairBonus
  • matchScore: 辞書マッチスコア(上表参照)
  • lengthScore: 文字数に基づく小さなボーナス/ペナルティ。2文字が最高(+0.5)、5文字以上はペナルティ(-0.2〜-0.4)
  • pairBonus: 姓名両方が辞書に一致すると +0.8
  • 制約: 1文字姓は辞書ヒット必須。ヒットしない場合は候補から除外

4. 信頼度閾値

最良候補が以下の条件を満たす場合に採用:

  • score >= 6.0(信頼度閾値)
  • bestScore - secondBestScore >= 1.0(十分な差)

閾値を満たさない場合は未分割で返します。allowLowConfidence: true を指定するとベストエフォートの結果を返します。

異体字フォールディング

旧字体・異体字は自動的に現代の標準字体にマッピングされます:

齋→斎, 齊→斉, 邊→辺, 濱→浜, 﨑→崎, 髙→高, 德→徳, 廣→広, 嶋→島, 國→国, 澤→沢, 櫻→桜, 龍→竜 など

辞書データ

同梱辞書は UniDic(現代書き言葉UniDic)から人名エントリ(名詞,固有名詞,人名,{姓|名})を抽出したものです。

| | 件数 | |---|---| | 姓 | 18,364 | | 名 | 37,084 | | 異体字マッピング | 1,002 | | 読みエントリ(オプション) | 25,742 |

バンドルサイズ

| エントリポイント | 生サイズ | gzip | |---|---|---| | seimei-split(辞書同梱) | 458 KB | 213 KB | | seimei-split/core(辞書なし) | 3.5 KB | 1.6 KB |

かな入力用の読みデータはデフォルトで tree shaking により除外されます。setReading() を呼ぶと有効になります。

開発状況

| データセット | 精度 | |---|---| | MVP(208件) | 正解94.7%, 誤分割0%, unsplit 5.3% |

ライセンス

コード: MIT | 辞書データ: BSD 3-Clause

詳細は LICENSES/README.md を参照。