Skip to content

Instantly share code, notes, and snippets.

@fasiha
Last active December 23, 2023 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fasiha/fffa8914d25660859ad97da1eafd92cb to your computer and use it in GitHub Desktop.
Save fasiha/fffa8914d25660859ad97da1eafd92cb to your computer and use it in GitHub Desktop.
J.DepP usage and output example

Example output

➜ echo あの壁にかかっている絵はきれいですね | mecab -d /usr/local/lib/mecab/dic/unidic | jdepp 2> /dev/null | to_tree.py
# S-ID: 1; J.DepP
  0:         あの━━┓
  1:   壁に━━┓     ┃
  2:  かかっている━━┓  ┃
  3:         絵は━━┫
  4:        きれいですねEOS
➜ echo あの壁にかかっている絵はきれいですね | mecab -d /usr/local/lib/mecab/dic/unidic | jdepp 2> /dev/null | to_chunk.py
# S-ID: 1; J.DepP
あの │ 壁 に │ かかっ て いる │ 絵 は │ きれい です ね EOS

Download and install instructions on Naoki Yoshinaga's website: http://www.tkl.iis.u-tokyo.ac.jp/~ynaga/jdepp/#dl

@fasiha
Copy link
Author

fasiha commented Jan 16, 2022

Glad it's working, what an ordeal 😭!

Just because even the thought of using a system-wide python gives me anxiety, I did want to risk annoying you by asking if you noticed the stupidly complicated installation instructions for pyenv: in the macOS section it says "Then follow the rest of the post-installation steps under Basic GitHub Checkout, starting with #2 ("Configure your shell's environment for Pyenv")", and in that section it tells you how to futz with your .bashrc or .bash_profile to make it work.

I use oh-my-zsh and I just have the following line in ~/.zshrc: eval "$(pyenv init -)".

Again, totally feel free to ignore me! I'm just going on because I can't imagine life without pyenv/conda to keep my python sanity 🙃.

jdepp is also pretty interesting and unusual. I really like it but had to think about what exactly it was doing, what bunsetsu were, how to take advantage of bunsetsu and their inter-dependencies. Feel free to reach out if you want to check notes on it!

@MeikyuuTrader
Copy link

I was actually only using jdepp to create "words" and then I'd search the definition. More or less copying your method from the stackoverlfow post. So more advance stuff isn't going to be touched.

It's unfortunate that you can't get rid of the extra dependencies, like particles, to get the real word.

@fasiha
Copy link
Author

fasiha commented Dec 23, 2023

@MeikyuuTrader have you seen Ichiran? https://ichi.moe and https://github.com/tshatrov/ichiran its a very nice way (and an alternative to MeCab + JDepP) to find particles, etc. but via a totally different technique.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment