57
\$\begingroup\$

Problem:

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.

Rules:

  • 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
\$\endgroup\$
17
  • 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\$ Feb 21, 2014 at 13:50
  • 7
    \$\begingroup\$ I'll upvote anyone who uses repetitions of "buffalo" or "fish" as sample sentences! \$\endgroup\$
    – user15259
    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
    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
    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\$ Feb 8 at 0:27

28 Answers 28

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