heidilabs/markov-php
最新稳定版本:0.4
Composer 安装命令:
composer require heidilabs/markov-php
包简介
A simple markov chain experiment
关键字:
README 文档
README
Warning: this project is highly experimental.
Usage
Just clone and run composer install to create the autoloader. Not necessary if you just want to use the CLI script.
Using the Library in your Project
markov-php is available on Packagist for installation through Composer. heidilabs/markov-php
$ composer require heidilabs/markov-php "~0.2"
Demos
Word Chain
CLI:
$ php chainer.php -r demos/resources/mobydick.txt
example output:
to cast anchor in the deep; for heavy chains are being dragged along the cycloid, my soapstone for example, will
Script:
<?php
require_once(__DIR__ . '/../vendor/autoload.php');
$sample = file_get_contents(__DIR__ . '/resources/nietzsche.txt');
$chain = new MarkovPHP\WordChain($sample, 2);
$sentence = $chain->generate(10);
echo "YOUR PIECE OF WISDOM FROM NIETZSCHE<br><br>";
echo $sentence;
example output:
must be contrary to their pride, and also more mysterious, than one thinks: the capable man in the purity of his character
Word Chain - Theme
CLI:
$ php chainer.php -r demos/resources/mobydick.txt -t love
example output:
love of neatness in seamen; some of whom would not have that ferule and buckle-screw; I'll be ready for them
<?php
require_once(__DIR__ . '/../vendor/autoload.php');
$sample = file_get_contents(__DIR__ . '/resources/nietzsche.txt');
$chain = new MarkovPHP\WordChain($sample, 2);
$theme = "hate";
$sentence = $chain->generate(10, $theme);
echo "YOUR PIECE OF WISDOM FROM NIETZSCHE, ABOUT: $theme<br><br>";
echo $sentence;
example output:
they hate thee, and me, and half-and-half, and impure!-- Ah, I cast hail-showers into the depths. Violently will my breast then heave;
Mixed Source
Combines two different sources and creates a simple chain with two connected parts:
<?php
require_once(__DIR__ . '/../vendor/autoload.php');
$sample1 = file_get_contents(__DIR__ . '/resources/nietzsche.txt');
$sample2 = file_get_contents(__DIR__ . '/resources/mobydick.txt');
$chain = new \MarkovPHP\MixedSourceChain($sample1, $sample2);
$sentence = $chain->generate();
echo "RESULT:<br>";
echo $sentence;
example output:
do so, proves that he is probably not only strong, she keeps so many moody secrets. The schools composing none
heidilabs/markov-php 适用场景与选型建议
heidilabs/markov-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.29k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2014 年 12 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「markov」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 heidilabs/markov-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 heidilabs/markov-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 heidilabs/markov-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 7.29k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 18
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-16