1. Go to this page and download the library: Download wandu/mecab library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wandu / mecab example snippets
use Wandu\Mecab\Mecab;
$mecab = new Mecab('/usr/local/lib/mecab/dic/mecab-ko-dic');
$mecab->parseToString('동해물과 백두산이 마르고 닳도록 하느님이 보우하사'); // return string
use Wandu\Mecab\Mecab;
use Wandu\Mecab\Node;
use Wandu\Mecab\Tag\KoreaEunjeon;
$mecab = new Mecab('/usr/local/lib/mecab/dic/mecab-ko-dic');
$nodes = array_filter($mecab->parse('동해물과 백두산이 마르고 닳도록 하느님이 보우하사'), function (Node $node) {
return
$node->hasTag(KoreaEunjeon::TAG_NNP) ||
$node->hasTag(KoreaEunjeon::TAG_NNB) ||
$node->hasTag(KoreaEunjeon::TAG_NNG);
});
use Wandu\Mecab\Mecab;
$mecab = new Mecab('/usr/local/lib/mecab/dic/mecab-ko-dic');
$mecab->split('동해물과 백두산이 마르고 닳도록 하느님이 보우하사'); // return array
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.