Skip to content

Repository files navigation

Suzume

CI npm PyPI codecov License C++17 Platform Docs

Suzume is a lightweight Japanese tokenizer for browsers and native apps. It is not a full morphological analyzer like MeCab: its primary goal is to split text into useful units for search, display, and application code. Unlike a boundary-only tokenizer, it also returns part-of-speech tags and lemmas.

Reach for it when you need to:

  • Tokenize Japanese anywhere — use the same tokenizer in a browser, serverless function, Python process, or C/C++ application.
  • Extract search terms — generate keyword tags with POS filtering, lemmas, and duplicate removal.
  • Add your vocabulary — load application-specific words through a user dictionary.

📖 Documentation  ·  🧪 Live Demo  ·  Getting Started

How is it different from MeCab?

MeCab is a morphological analyzer designed for detailed, dictionary-based analysis. Suzume is a tokenizer designed around practical token boundaries. It uses character patterns and compact rules, keeping compounds and quantities together when that produces a more useful search unit.

Input:  経済成長     3人
MeCab:  経済 / 成長  3 / 人
Suzume: 経済成長     3人

Suzume still provides POS tagging and lemmatization, so applications can normalize inflected verbs and adjectives without adopting MeCab-style output. The outputs are intentionally different rather than drop-in compatible. See Differences from MeCab for examples, trade-offs, and known constraints.

Install

npm install @libraz/suzume  # JavaScript / TypeScript
pip install suzume          # Python

For C/C++ installation, native builds, user dictionaries, and all runtime options, see the documentation.

Quick Start

import { Suzume } from '@libraz/suzume'

const suzume = await Suzume.create()
const tokens = suzume.analyze('すもももももももものうち')
const tags = suzume.generateTags('東京の公園に行きました')

suzume.destroy() // optional immediate cleanup
from suzume import Suzume

with Suzume() as sz:
    tokens = sz.analyze("すもももももももものうち")
    tags = sz.generate_tags("東京の公園に行きました")

Documentation

License

Apache License 2.0

About

A lightweight C++17 Japanese morphological analyzer with WebAssembly support, no external dependencies

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages