定制 gnugat/pronounceableword 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gnugat/pronounceableword

最新稳定版本:2.0.0

Composer 安装命令:

composer require gnugat/pronounceableword

包简介

A light, customizable and simple library generating random and pronounceable words without using dictionaries or Markov chains.

README 文档

README

PronounceableWord PHP library

A light, customizable and simple PHP (>= 5.2) library, used to generate randomly pronounceable words, names and passwords without using database of existing words or big samples of text like with Markov chains.

Warning

Offensive or insulting words might be generated because of the random nature of the generator (see how to manage them in ./doc/manageOffensiveAndInsultingWords.rst).

Installation and usage

First, get the last stable version, and put it in an accessible directory.

You can use composer to do so (http://packagist.org/), by adding in the require of your file ./composer.json the following entry: "gnugat/PronounceableWord": "*".

You should have a fully operationnal pronounceable word generator:

<?php
// File "/index.php".

require_once dirname(__FILE__) . '/vendor/PronounceableWord/src/PronounceableWord/DependencyInjectionContainer.php';

define('MINIMUM_LENGTH', 5);
define('MAXIMUM_LENGTH', 11);

$length = rand(MINIMUM_LENGTH, MAXIMUM_LENGTH);

$container = new PronounceableWord_DependencyInjectionContainer();
$generator = $container->getGenerator();
$word = $generator->generateWordOfGivenLength($length);

Configuration

To customize the algorithm, the letters used, the linked letters or the types, just copy and modify as you wish the files in the ./src/PronounceableWord/Configuration directory and then pass your configuration classes to the container (see how to configure in ./doc/configuration.rst).

Tests

Tests are done using PHPUnit (https://github.com/sebastianbergmann/phpunit/) (>=3.5) in the ./test directory (see how to test in ./doc/tests.rst).

Examples

Here is a sample of examples that can be generated (use the ./bin/generateExamples.php script for more):

Length 5 6 7 8
1 vicas panori eropops absugrit
2 ramsa verifu simbous nimpiowi
3 kiclu impriar rubleru entumecu
4 posup bivary kitocra vemolior
5 utler rugisi kanomev pactabie

Algorithm

Basically, the library will generate a word following these rules:

  1. Choose randomly a letter;
  2. choose randomly a linked letter of different type;
  3. choose randomly a linked letter, of different type if the last letter is of consecutive types.

Where:

  • "linked letter" is an arbitrary chosen letter that is expected to follow well the previous letter;
  • "types" would be voyels and consonants;
  • "consecutive" would be a group of two letters from the same "type".

The step 3 is repeated as many times as necessary.

Documentation

You can find more documentation at the following links:

  • Copyright and MIT license: ./LICENSE.rst;
  • version and change log: ./VERSION.rst and CHANGELOG.rst;
  • technical and usage documentation: ./doc/.

Contributing

  1. Fork it: https://github.com/gnugat/PronounceableWord/fork_select ;
  2. create a branch (git checkout -b my_branch);
  3. commit your changes (git commit -am "Changes description message");
  4. push to the branch (git push origin my_branch);
  5. create an Issue (https://github.com/gnugat/PronounceableWord/issues) with a link to your branch;
  6. wait for it to be accepted/argued.

统计信息

  • 总下载量: 13.45k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 4
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-01-08