Follow the instruction on the official page: https://konlpy.org/ko/latest/install/#
If you are using Ubuntu or Window, there might not be a problem (When I installed KoNLPy on my Window machine, I did not have any problem...), but if you are using a Mac and type just pip install konlpy on Terminal, you might see a lot of error messages. This is because most packages processing Korean are based on Java. So, what you need to do first is to install JDK (Java Development Kit) and then download Jpype1. Below is how to do it.
Prerequisite:
- Make a virtual environment using conda
- In doing so, you need to specify python version. I set it as KoNLPy does not work well with higher versions (This might have been fixed now though).
1. Install JDK: https://www.oracle.com/java/technologies/javase-jdk11-downloads.html
2. Set JAVA environment variable: https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/index.html
(My Mac OS: Mojave)
3. Install Jpype1: conda install -c conda-forge jpype1
4. Intall KoNLPy: pip install konlpy / pip3 install konlpy
5. In order to install Mecab (this is not available on Window), just type the following command in your Terminal.
bash <(curl -s https://raw.githubusercontent.com/konlpy/konlpy/master/scripts/mecab.sh)
Now, let's test it!
1. Activate your conda virtual environment
2. Then run python3
3. Load KoNLPy, and type some sentences as below
a. Kkma
b. Hannanum
c. Mecab
d. Komoran
No comments:
Post a Comment