library markov
Implementation of MarkovChain algorithm in PHP
fieg/markov
Implementation of MarkovChain algorithm in PHP
- Thursday, May 14, 2015
- by fieg
- Repository
- 0 Watchers
- 2 Stars
- 21 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 2 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
Markov Chain
Implementation of MarkovChain algorithm in PHP., (*1)
, (*2)
Getting started
use Fieg\Markov\MarkovChain;
$sentences = [
'my blue car',
'red and blue flowers',
'his blue car',
];
$chain = new MarkovChain();
foreach ($sentences as $sentence) {
$tokens = explode(" ", $sentence);
$chain->train($tokens);
}
$result = $chain->query("blue");
Which would result in:, (*3)
array(2) {
'car' =>
double(0.66666666666667)
'flowers' =>
double(0.33333333333333)
}
dev-master
9999999-dev
Implementation of MarkovChain algorithm in PHP
Sources
Download
MIT
The Development Requires