Generate a sentence that can be read and understood. It must contain a subject, verb, and object, and tenses and plurals must match. The program must also be able to generate several different sentences to qualify.


  • Hard-coding the sentences is not permitted, and nor is reading them directly from a file (i'm looking at you, unclemeat)
  • You can have any number of word lists
  • Submit an example sentence or 2 that have been generated by your program
  • Any language is accepted
  • It's a , so the most upvoted answer wins
  • 8
    \$\begingroup\$ I think it's clear from some of the answers (MatLab I'm looking at you) that you should modify the rules such that data-mining is not allowed to pull consecutive words from any source. \$\endgroup\$ Commented Feb 21, 2014 at 13:50
  • 7
    \$\begingroup\$ I'll upvote anyone who uses repetitions of "buffalo" or "fish" as sample sentences! \$\endgroup\$
    – user15259
    Commented Feb 21, 2014 at 16:19
  • 7
    \$\begingroup\$ Most answers here either mine valid, full sentences from text sources, or generate output that does not meet the criteria. To me, both approaches seem against the spirit of the question! If someone really wants to impress, might I suggest a program that starts with a set of valid sentence structures like [Adjective] [pl. noun] [verb] [adjective] [pl. noun] and pulls from a real dictionary (maybe using one of the Dictionary APIs available out there) to fill in the blanks? I'd write it myself if I had a few minutes to spare! :( After all... Lazy Developers Write Lousy Programs. \$\endgroup\$
    – Brian Lacy
    Commented Feb 21, 2014 at 17:21
  • 1
    \$\begingroup\$ @Pureferret Word lists would be lists of individual words. Hard coding would be a list of complete sentences. With word lists, you would typically need some logic in the program to piece together a complete sentence. With hard coded sentences, you basically just need a print statement. \$\endgroup\$
    – 8bittree
    Commented Feb 27, 2014 at 15:03
  • 4
    \$\begingroup\$ I’m voting to close this question because it lacks an "objective validity criterion" as required by the popularity-contest tag wiki. \$\endgroup\$ Commented Feb 8, 2023 at 0:27

28 Answers 28

Not the answer you're looking for? Browse other questions tagged or ask your own question.