v1.2.2
🇯🇵 Analyze Japanese from Deno with MeCab
Repository
Current version released
2 years ago
deno_mecab
日本語
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@v1.2.2/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
License
MIT © 2021 Seraimu