承接 suilven/random-english 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

suilven/random-english

Composer 安装命令:

composer require suilven/random-english

包简介

Generate random plausible English, for testing search engines

README 文档

README

Build Status Scrutinizer Code Quality codecov.io

Latest Stable Version Latest Unstable Version Total Downloads License Monthly Downloads Daily Downloads composer.lock

GitHub Code Size GitHub Repo Size GitHub Last Commit GitHub Activity GitHub Issues

codecov.io

Generate random text that is plausible English, although it will not be semantically correct.

Getting Started

Firstly there is no need for this software to be installed on a live system, it is purely intended for creating test data such as fixtures.

Prerequisites

PHP 7.2 is required

Give examples

Installing

composer require --dev suilven/random-english

Usage

Scripts

Random Sentences

The parameter 4 is the number of sentences to return

> bin/randomEnglish sentences 4
Shut in, however, by nine, it was terrible to sun his piano, which we had observed with the sorry house.
Foresting at night is more fun than seconding during the day.
Try!! You cannot wire here.
The minute is colour kenyan copper.

Random Paragraphs

The parameter 2 is the number of random paragraphs

> bin/randomEnglish paragraphs  2
Cat juices are best eaten with propers.  The spread in Pakistan is healthy.  The down is a storm of an female flog and is gold in the voice for his stomach and the mildness of his die.  Wait!! You cannot add here.  The park is colour cornflower blue.  Thea opened the tall and found that it led into a cheap fever, not much larger than a through.  The inside weather was paning on the across bank.  The further great double into the beer.  How slowly the hide passes here, encompassed as I am by fly and fit?  Among these were a couple of countrys, a toeing catch I employed sometimes, a sick hurting a skill, Gregg the butcher and his little boy, and two or three loafers and golf caddies who were accustomed to hang about the railway station.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Wish!! You cannot second here.  This is a random string from 1 to 4 two.  Tom's younger brother (or rather half-brother) Sid was already through with his part of the work (picking up chips), for he was a quiet boy, and had no adventurous, trouble-some ways.  The something gold ladder round the comb.  The decrease is a pull of an try were and is garden in the brush for his coin and the mildness of his come.  It was piano in the line, there star was sound.  Reminding at night is more fun than answering during the day.  Shut in, however, by road, it was through to fruit his cost, which we had observed with the model taste.  Were it not for the works, the south clean would not be out.  The salt film was snowing on the close bank.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

PHP

Prime the generator with a configuration as below, or leave blank to choose random structures from config/sentence-structure.cfg

$generator = new RandomEnglishGenerator();
$generator->setConfig('It was [adjective] in the [noun], [contraction] [noun] was [adjective]');

$generator->sentence(); // generate a random sentence
$generator->title(); // generate a random sentence in Title Case
$generator->paragraph(10); // generate a random paragraph of up to a max of 10 sentences

Configuration

Sentence structures are defined in config/sentence-structure.cfg and look like this

The [noun] was [verb_ing] [adverb]
The [noun] in [country] is [adjective]
The [noun] is colour [colour]
This is a random string from 1 to 4 [one|two|three|four]

The random generation works as follows:

  • A random line from the configuration file is chosen.
  • Any words not in square brackets are output as is.
  • A string of the form [one|two|three|four] represents a choice of random words, either one, two, three or four will be appended to the sentence.
  • The directory words contains various text files with lists of words representative of the filename. A directive of [noun] will result in the file words/english_nouns.txt being loaded and a random word chosen from the file.
  • Exceptions
    • [country] will load words/english_countries.txt, just a semanatic thing
    • [verb_ing] will take a verb and render if with a trailing ing
    • [plural_noun] will take a noun from the file words/english_countable_nouns.txt and pluralize it with an inflector
  • The following are commands to run against Faker to generate random entries, e.g. [lastName] will generate a last name.
'address',
        'name',
        'randomDigit',
        'randomLetter',
        'randomNumber',
        'title',
        'titleMale',
        'titleFemale',
        'firstNameMale',
        'firstNameFemale',
        'lastName',

        'catchPhrase',
        'bs',
        'company',
        'companySuffix',
        'jobTitle',

        'realText',

        'dayOfWeek',
        'monthName',

Running the tests

  1. Build Docker image and enter it in a bash shell
sudo docker-compse up -d phpcli
sudo docker-compose exec phpcli /bin/bash

Note the first step may take several minutes if not previously built.

A bash prompt will appear like this:

> sdc exec phpcli /bin/bash
 ____                 _                   _____             _ _     _     
|  _ \ __ _ _ __   __| | ___  _ __ ___   | ____|_ __   __ _| (_)___| |__  
| |_) / _` | '_ \ / _` |/ _ \| '_ ` _ \  |  _| | '_ \ / _` | | / __| '_ \ 
|  _ < (_| | | | | (_| | (_) | | | | | | | |___| | | | (_| | | \__ \ | | |
|_| \_\__,_|_| |_|\__,_|\___/|_| |_| |_| |_____|_| |_|\__, |_|_|___/_| |_|
                                                      |___/               
root@randomenglish.test:/var/www> 

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Data Sources

suilven/random-english 适用场景与选型建议

suilven/random-english 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 06 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 suilven/random-english 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 suilven/random-english 我们能提供哪些服务?
定制开发 / 二次开发

基于 suilven/random-english 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-06-28