Expand description
A random sentence generator, still without commas.
Has three functions:
gen_sentence()
, to generate a sentence;gen_word()
, to generate a word of a certain kind; andgen_structure()
, to generate the structure of a sentence based on your SentenceConfig.
cgisf is a reference to ‘Colourless Green Ideas Sleep Furiously’ - a 1957 example of a sentence that is grammatical but makes no sense. Similarly, don’t expect these sentences to make that much sense either.
§Usage
First, add this to your Cargo.toml
[dependencies]
cgisf = "0.2.1"
Then,
use cgisf_lib::{gen_sentence, SentenceConfigBuilder};
print!("{}", gen_sentence(SentenceConfigBuilder::random().build()));
A deeper explanation can be found in the individual functions’ pages.
Structs§
- Sentence
Config - The actual structure of the config. To build it, use
SentenceConfigBuilder
. - Sentence
Config Builder - The builder for
SentenceConfig
.
Enums§
Functions§
- gen_
sentence - gen_
structure - gen_
word - Get a random word from the wordlists that fits the
WordType
. In this step, the word may be altered slightly, such as when a ‘s’ is added to the end of a noun to get a plural noun.