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.
This commit is contained in:
Robyn Speer 2018-06-21 15:53:16 -04:00
parent fdf064b234
commit 830157d8e4
3 changed files with 4 additions and 1 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ pip-log.txt
wordfreq-data.tar.gz wordfreq-data.tar.gz
.idea .idea
build.dot build.dot
.pytest_cache

View File

@ -395,7 +395,7 @@ things need to be installed:
To install these three things on Ubuntu, you can run: To install these three things on Ubuntu, you can run:
```sh ```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 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 tar xvf mecab-ko-dic-2.0.1-20150920.tar.gz
cd mecab-ko-dic-2.0.1-20150920 cd mecab-ko-dic-2.0.1-20150920
./autogen.sh ./autogen.sh
./configure
make make
sudo make install sudo make install
``` ```

View File

@ -20,6 +20,7 @@ def find_mecab_dictionary(names):
'/var/local/lib/mecab/dic', '/var/local/lib/mecab/dic',
'/usr/lib/mecab/dic', '/usr/lib/mecab/dic',
'/usr/local/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] 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] checked_paths = [path for path in full_paths if len(path) <= MAX_PATH_LENGTH]