From 830157d8e49d6a35f695e1b4f5266745a98aa7d6 Mon Sep 17 00:00:00 2001 From: Robyn Speer Date: Thu, 21 Jun 2018 15:53:16 -0400 Subject: [PATCH] Fix instructions and search path for mecab-ko-dic I'm starting a new Python environment on a new Ubuntu installation. You never know when a huge yak will show up and demand to be shaved. I tried following the directions in the README, and found that a couple of steps were missing. I've added those. When you follow those steps, it appears to install the MeCab Korean dictionary in `/usr/lib/x86_64-linux-gnu/mecab/dic`, which was none of the paths we were checking, so I've added that as a search path. --- .gitignore | 1 + README.md | 3 ++- wordfreq/mecab.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a68e8ca..882d793 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ pip-log.txt wordfreq-data.tar.gz .idea build.dot +.pytest_cache diff --git a/README.md b/README.md index 912c0f4..c038143 100644 --- a/README.md +++ b/README.md @@ -395,7 +395,7 @@ things need to be installed: To install these three things on Ubuntu, you can run: ```sh -sudo apt-get install libmecab-dev mecab-ipadic-utf8 +sudo apt-get install python3-dev libmecab-dev mecab-ipadic-utf8 pip3 install mecab-python3 ``` @@ -419,6 +419,7 @@ wget https://bitbucket.org/eunjeon/mecab-ko-dic/downloads/mecab-ko-dic-2.0.1-201 tar xvf mecab-ko-dic-2.0.1-20150920.tar.gz cd mecab-ko-dic-2.0.1-20150920 ./autogen.sh +./configure make sudo make install ``` diff --git a/wordfreq/mecab.py b/wordfreq/mecab.py index aca75d2..8607387 100644 --- a/wordfreq/mecab.py +++ b/wordfreq/mecab.py @@ -20,6 +20,7 @@ def find_mecab_dictionary(names): '/var/local/lib/mecab/dic', '/usr/lib/mecab/dic', '/usr/local/lib/mecab/dic', + '/usr/lib/x86_64-linux-gnu/mecab/dic', ] full_paths = [os.path.join(path, name) for path in paths for name in names] checked_paths = [path for path in full_paths if len(path) <= MAX_PATH_LENGTH]