/mecab-server

Primary LanguageTypeScriptMIT LicenseMIT

mecab-server

mecabを実行して結果を返すだけのサーバー

インストール

  1. mecab と mecab-ipadic-NEologd などを入れる
    https://github.com/neologd/mecab-ipadic-neologd/blob/master/README.ja.md
  2. config.example.ymlconfig.yml としてコピーしてパス等を変える
  3. yarn install && yarn build
  4. PORT=3062 yarn start

またはDockerを使う場合

  1. cp config.example.yml config.yml
  2. docker-compose build
  3. docker-compose up -d

使い方

GETの場合

GET http://localhost:3062/?text=魔法少女リリカルなのはなのはなぜなのはてな

POSTの場合

POST http://localhost:3062/

{
  "text": "魔法少女リリカルなのはなのはなぜなのはてな"
}

出力例

{
  "result":[
    ["魔法少女リリカルなのは","名詞","固有名詞","一般","*","*","*","魔法少女リリカルなのは","マホウショウジョリリカルナノハ","マホーショージョリリカルナノハ"],
    ["","助動詞","*","*","*","特殊・ダ","体言接続","","",""],
    ["","名詞","非自立","一般","*","*","*","","",""],
    ["","助詞","係助詞","*","*","*","*","","",""],
    ["なぜ","副詞","助詞類接続","*","*","*","*","なぜ","ナゼ","ナゼ"],
    ["","助動詞","*","*","*","特殊・ダ","体言接続","","",""],
    ["","名詞","非自立","一般","*","*","*","","",""],
    ["はてな","感動詞","*","*","*","*","*","はてな","ハテナ","ハテナ"]
  ]
}