Download the PHP package suilven/random-english without Composer
On this page you can find all versions of the php package suilven/random-english. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download suilven/random-english
More information about suilven/random-english
Files in suilven/random-english
Package random-english
Short Description Generate random plausible English, for testing search engines
License MIT
Informations about the package random-english
Random English
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
Installing
Usage
Scripts
Random Sentences
The parameter 4 is the number of sentences to return
Random Paragraphs
The parameter 2 is the number of random paragraphs
PHP
Prime the generator with a configuration as below, or leave blank to choose random structures from config/sentence-structure.cfg
Configuration
Sentence structures are defined in config/sentence-structure.cfg
and look like this
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, eitherone
,two
,three
orfour
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 filewords/english_nouns.txt
being loaded and a random word chosen from the file. - Exceptions
[country]
will loadwords/english_countries.txt
, just a semanatic thing[verb_ing]
will take a verb and render if with a trailinging
[plural_noun]
will take a noun from the filewords/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.
Running the tests
1) Build Docker image and enter it in a bash shell
Note the first step may take several minutes if not previously built.
A bash prompt will appear like this:
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Gordon Anderson - Initial work - Gordon Anderson
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Data Sources
- Wiktionary - different word classifications
- Mens Names - Office of National Statistics https://www.ons.gov.uk/peoplepopulationandcommunity/birthsdeathsandmarriages/livebirths/datasets/babynamesenglandandwalesbabynamesstatisticsboys
- Womens Names - Office of National Statistics https://www.ons.gov.uk/peoplepopulationandcommunity/birthsdeathsandmarriages/livebirths/datasets/babynamesenglandandwalesbabynamesstatisticsgirls
- Countries - OSM Overpass API, https://wiki.openstreetmap.org/wiki/Countries_of_the_world
- Colours - https://github.com/codebrainz/color-names/blob/master/output/colors.csv
All versions of random-english with dependencies
slevomat/coding-standard Version ^6.3
doctrine/inflector Version ^2.0
yooper/php-text-analysis Version ^1.5
vanilla/garden-cli Version ^2.2
vanderlee/syllable Version ^1.5
league/climate Version ^3.5
fzaninotto/faker Version ^1.9