PHP code example of yuzuru-s / markovchain
1. Go to this page and download the library: Download yuzuru-s/markovchain 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/ */
yuzuru-s / markovchain example snippets
use YuzuruS\Mecab\Markovchain;
$mc = new Markovchain();
$text = 'ある村むらから、毎日まいにち町まちへ仕事しごとにいく男おとこがありました。どんな日ひでも、さびしい道みちを歩あるかなければならなかったのです。ある日ひのこと、男おとこはいつものごとく考かんがえながら歩あるいてきました。寒さむい朝あさで、自分じぶんの口くちや、鼻はなから出でる息いきが白しろく凍こおって見みえました。また田圃たんぼには、霜しもが真まっ白しろに降おりていて、ちょうど雪ゆきの降ふったような、ながめでありました。';
echo $mc->makeMarkovText($text);