Skip to main content
Deno 2 is finally here 🎉️
Learn more

deno_mecab

Test Lint Test Coverage Maintainability license

English | 日本語

deno-mecab is an asynchronous Japanese morphological analysis module using MeCab.

Getting Started

Requirements

Example

For a quick example, run this:

deno run --allow-run https://deno.land/x/deno_mecab/example.ts

The script to be execute:

import { MeCab } from "https://deno.land/x/deno_mecab/mod.ts";

const mecab = new MeCab(["mecab"]);

const text = "JavaScriptはとても楽しいです。";

// Parse (形態素解析)
console.log(await mecab.parse(text));
// [{surface: "JavaScript", feature: "名詞", featureDetails: [ "固有名詞", "組織", "*" ], ...

// Dump (ダンプ出力)
console.log(await mecab.dump(text));
// [{nodeId: 0, surface: "BOS", feature: "BOS/EOS", featureDetails: [ "*", "*", "*" ], ...

// Wakati (わかち書き)
console.log(await mecab.wakati("JavaScriptはとても楽しいです。"));
// [ "JavaScript", "は", "とても", "楽しい", "です", "。" ]

// Yomi (読み付与)
console.log(await mecab.yomi("日本語"));
// ニホンゴ

Maintainer

@sera1mu

License

MIT © 2021 Seraimu