์ตœ๊ทผ Kakao์—์„œ Khaiii๋ฅผ ๋ฐœํ‘œํ•ด์„œ ์กฐ๊ธˆ ์ธ๊ธฐ๊ฐ€ ์•ฝํ•ด์ง€๊ธด ํ–ˆ์ง€๋งŒ, ์—ฌ์ „ํžˆ Khaiii์™€ ๋งž๋จน๋Š” ์„ฑ๋Šฅ์„ ๋ณด์—ฌ์ฃผ๋Š” mecab์„ค์น˜๋ฅผ ์ง„ํ–‰ํ•ด ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

1. ์šฐ์„  mecab ํ™ˆํŽ˜์ด์ง€์—์„œ ์ตœ์‹  ๋ฒ„์ „์„ ๋‹ค์šด๋กœ๋“œ ํ•ฉ๋‹ˆ๋‹ค. 

    ํ˜„์žฌ๋Š” mecab-0.996-ko-0.9.2.tar.gz ์ด ํŒŒ์ผ์ด ์ตœ์‹ ์ด๋„ค์š”.

 

https://bitbucket.org/eunjeon/mecab-ko/downloads/

 

eunjeon / mecab-ko / Downloads — Bitbucket

 

bitbucket.org

2. ํŒŒ์ผ์„ ๋‹ค์šด๋ฐ›์•„์„œ ํŠน์ • ๋””๋ ‰ํ† ๋ฆฌ์— ์ €์žฅ ํ•˜๊ณ  ์••์ถ•์„ ํ’€์–ด ์ค๋‹ˆ๋‹ค.

tar -zxvf mecab-*-ko-*.tar.gz

3. ํ•ด๋‹น ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•˜์—ฌ configure/make/make install ์„ ์ง„ํ–‰ ํ•ฉ๋‹ˆ๋‹ค.

cd mecab-0.996-ko-0.9.2
./configure
make
make check
sudo make install

4. ์„ค์น˜ ๋ฒ„์ „์„ ํ™•์ธํ•˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒ ํ•ฉ๋‹ˆ๋‹ค.

mecab --version

5. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๋กœ๋”ฉํ•ด์ฃผ๊ณ  ๋‹ค์‹œ ๋ฒ„์ „์„ ํ™•์ธํ•˜๋ฉด ์ •์ƒ์ ์œผ๋กœ ํ‘œ์‹œ ๋ฉ๋‹ˆ๋‹ค.

sudo ldconfig
mecab --version

** ์ด ๋ฐฉ๋ฒ• ์™ธ์— ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ํ•œ๋ฒˆ์— ์„ค์น˜ ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

pip install python-mecab-ko

 

6. ๋‹ค์Œ์€ ํ•œ๊ตญ์–ด ์‚ฌ์ „์„ ์„ค์น˜ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

์šฐ์„  ์‚ฌ์ „์˜ ์ตœ์‹  ๋ฒ„์ „์„ ๋‹ค์šด๋ฐ›์•„ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์••์ถ•์„ ํ’€์–ด ์ค๋‹ˆ๋‹ค.

ํ˜„์žฌ์˜ ์ตœ์‹  ๋ฒ„์ „์€ mecab-ko-dic-2.1.1-20180720.tar.gz ์ด๊ตฐ์š”.

https://bitbucket.org/eunjeon/mecab-ko-dic/downloads/

tar -zxvf mecab-ko-dic-2.1.1-20180720.tar.gz
 

eunjeon / mecab-ko-dic / Downloads — Bitbucket

 

bitbucket.org

 

7. ์••์ถ•์„ ํ‘ผ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•˜์—ฌ make๋ฅผ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

cd mecab-ko-dic-2.1.1-20180720
./configure
make
sudo make install

8. ํ…Œ์ŠคํŠธ๋ฅผ ํ•ด๋ด…๋‹ˆ๋‹ค. Khaiii์ฒ˜๋Ÿผ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•œ ํ›„ ๋ถ„์„ํ•˜๊ณ ์ž ํ•˜๋Š” ๋ฌธ์žฅ์„ ์ž…๋ ฅํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

mecab -d /usr/local/lib/mecab/dic/mecab-ko-dic

์„ค์น˜๊ฐ€ ์ž˜ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

 

9. Python์—์„œ ์ž˜ ๋˜๋Š”์ง€ ํ…Œ์ŠคํŠธ ํ•ด ๋ด…๋‹ˆ๋‹ค.

import mecab
mecab = mecab.MeCab()

mecab.morphs('์˜๋“ฑํฌ๊ตฌ์ฒญ์—ญ์— ์žˆ๋Š” ๋ง›์ง‘ ์ข€ ์•Œ๋ ค์ฃผ์„ธ์š”.')
# ['์˜๋“ฑํฌ๊ตฌ์ฒญ์—ญ', '์—', '์žˆ', '๋Š”', '๋ง›์ง‘', '์ข€', '์•Œ๋ ค', '์ฃผ', '์„ธ์š”', '.']

 

์ด์ƒ์œผ๋กœ ๋งˆ์น˜๊ฒ ์Šต๋‹ˆ๋‹ค.

+ Recent posts