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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@2ji-han/kuromoji.js

v0.1.8

Published

JavaScript implementation of Japanese morphological analyzer

Readme

kuromoji.js

test License

English日本語

this is fork of @takuyaa/kuromoji.js

and, I was inspired by the following repositories

Once again, I would like to thank you!

futures

  • [x] Tests Pass 100% :partying_face:
  • [x] async to promise/await :partying_face:
  • [x] Support and build for browser :partying_face:
  • [x] Asynchronization of init functions(eg. await kuromoji.builder()) :partying_face:
  • [ ] Support Stream
  • [ ] kuromoji-server
  • [ ] Support user dictionary
  • [ ] Search mode
  • [ ] Output of N-best solution
  • [ ] Support NAIST-jdic, Unidic
  • [ ] Low dictionary size(use fst?)

About

JavaScript implementation of Japanese morphological analyzer. This is a pure JavaScript porting of Kuromoji.

You can see how kuromoji.js works in demo site.

Directory

Directory tree is as follows:

.github       -- Github settings
dict/         -- Dictionaries for tokenizer (gzipped)
docs/         -- kuromoji.js documents
   - demo/     -- kuromoji.js demo page (https://coco-ly.com/kuromoji.js/)
   - example/  -- Examples to use in Node.js
scripts/      -- build scripts
src/          -- Type Script source

Usage

Install with package manager:

npm install kuromoji.js
pnpm install kuromoji.js
bun install kuromoji.js

Load this library as follows:

import kuromoji from "kuromoji.js";
const kuromoji = require("kuromoji.js").default;
//browser
import kuromoji from 'https://cdn.jsdelivr.net/npm/kuromoji.js/dist/browser/index.min.js'

You can tokenize sentences with only 5 lines of code. If you need working examples, you can see the files under the demo or example directory.

import kuromoji from "kuromoji.js";

kuromoji.builder().build((err, tokenizer) => {
    // tokenizer is ready
    const path = tokenizer.tokenize("すもももももももものうち");
    console.log(path);
});

Also, Loading with top-level await is also supported as follows

import kuromoji from "kuromoji.js/promise";

const tokenizer = await kuromoji.builder().build();

const path = tokenizer.tokenize("すもももももももものうち");
console.log(path.length);

Build Dictionary

We currently use mecab-ipadic for our dictionaries, but You can build and use your own dictionary as long as it is compatible with mecab-ipadic

bun build-dict <output path> <dict input path>

API

The function tokenize() returns an JSON array like this:

[ {
    // word id in dictionary
    word_id: 509800,
    // word type (KNOWN for words in the dictionary, UNKNOWN for unknown words)
    word_type: 'KNOWN',
    // word start position
    word_position: 1,
    // surface form
    surface_form: '黒文字',
    // part of speech
    pos: '名詞',
    // Part-of-Speech Subdivision 1
    pos_detail_1: '一般',
    // Part-of-Speech Subdivision 2
    pos_detail_2: '*',
    // Part-of-Speech Subdivision 3
    pos_detail_3: '*',
    // conjugated type
    conjugated_type: '*',
    // conjugated form
    conjugated_form: '*',
    // basic form
    basic_form: '黒文字',
    // reading
    reading: 'クロモジ',
    // pronunciation
    pronunciation: 'クロモジ'
} ]

(This is defined in src/_core/util/IpadicFormatter.ts)