LoginSignup
xxxkousukexxx03
@xxxkousukexxx03 (maru nanaga)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

HaskellでMeCabを使いたい!

解決したいこと

HaskellでMecabを用いて形態素解析をしたい。
環境: WSL:Ubuntu, stack, Mecab

行ったこと

$ sudo apt install mecab libmecab-dev mecab-ipadic-utf8 を実行しmecabをインストール。
2.$ git clone —depth 1 https://github.com/neologd/mecab-ipadic-neologd.git
$ cd mecab-ipadic-neologd
$ bin/install-mecab-ipadic-neologd -n -a
を実行しNEologdをインストール
3./etc/Mecabrcのmecab設定ファイルのdicdirの行をNEologdのパスに書き換え
4.yesodプロジェクトディレクトリのstack.yamlに

extra-deps:
- mecab-0.4.0

を追加
5.プロジェクトのソースファイルにimport qualified NLP.Mecab as Mecab
と入力した
6.コンパイル時にCould not find module ‘NLP.Mecab’のエラーが出てコンパイルに失敗

発生している問題・エラー

Could not find module ‘NLP.Mecab’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |                    
10 | import qualified NLP.Mecab as Mecab
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Completed 196 action(s).

Error: [S-7282]
       Stack failed to execute the build plan.
       
       While executing the build plan, Stack encountered the error:
       
       [S-7011]
       While building package my-app-0.0.0 (scroll up to its section to see the error) using:
       /home/vashli/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_6HauvNHV_3.6.3.0_ghc-9.2.8 --verbose=1 --builddir=.stack-work/dist/x86_64-linux-tinfo6/ghc-9.2.8 build lib:my-app exe:my-app --ghc-options " -fdiagnostics-color=always"
       Process exited with code: ExitFailure 1

Mecabのバージョンを0.4.0としたのはUbuntuに0.4.0ならあるよーみたいに言われたからでMecabのバージョンなどの正確な内容が把握できてません。import文までのコンパイル(ほぼすべて)は問題なくできました。
HaskellとMecabに関する情報が少なすぎて何もわかりません。。。
どなたかご教授お願いします。

0

1Answer

Comments

  1. 回答ありがとうございます!
    どうやら古い情報のようでそもそもyesodのテンプレートから異なっているので再現できませんでした、、、
    mecabを別のファイルに管理する感じも今はほとんどしない?(よくわからない)っぽいです。

Your answer might help someone💌