Skip to content

hota1024/mecab-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mecab-client

mecab-client

MeCab client library written in TypeScript

🚀 Installation

npm install mecab-client
# or
yarn add mecab-client

🔧 Usage

import { MeCab } from 'mecab-client'

const main = async () => {
  const mecab = new MeCab()

  const result = await mecab.parse("すもももももももものうち")
  console.log(result)
}

main()

💡 API

MeCab#parse(source: string): Word[]

  • 与えられた文字列を解析し Word[] を返します。

Word type

/**
 * Word type.
 */
export type Word = {
  /**
   * 表層系
   */
  surface: string

  /**
   * 品詞
   */
  lexical: Lexical

  /**
   * 品詞細分類1
   */
  compound1: string

  /**
   * 品詞細分類2
   */
  compound2: string

  /**
   * 品詞細分類3
   */
  compound3: string

  /**
   * 活用型
   */
  conjugation: string

  /**
   * 活用形
   */
  inflection: string

  /**
   * 原型
   */
  original: string

  /**
   * 読み
   */
  reading: string

  /**
   * 発音
   */
  pronunciation?: string
}

Releases

No releases published

Packages

No packages published