#sentence #english #generator

cgisf_lib

A quick and easy sentence generator

3 unstable releases

0.2.1 Dec 13, 2022
0.2.0 Dec 13, 2022
0.1.3 May 1, 2022

#23 in #sentence

Download history 69/week @ 2024-07-27 5/week @ 2024-08-03 1/week @ 2024-08-10 1/week @ 2024-08-31 7/week @ 2024-09-07 7/week @ 2024-09-14 39/week @ 2024-09-21 11/week @ 2024-09-28 7/week @ 2024-10-05 25/week @ 2024-10-12 12/week @ 2024-10-19 2/week @ 2024-10-26 25/week @ 2024-11-02 31/week @ 2024-11-09

72 downloads per month
Used in 2 crates

MIT/Apache

38KB
425 lines

cgisf_lib

A random sentence generator, still without commas.

Has three functions:

  • cgisf(), to generate a sentence;
  • get_word(), to generate a word of a certain kind; and
  • get_structure(), to get the structure of a sentence.

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.

The documentation is significantly better than this silly README file.

Contributions welcome at https://github.com/merelymyself/cgisf_lib.

A massive amount of credit goes to CordlessCoder, who single-handedly rewrote practically everything for the 0.2.0 release.


lib.rs:

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; and
  • [gen_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.

Dependencies

~1.5MB
~22K SLoC