I used the word list from here Find words containing every vowelFind words containing every vowel
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack InternalResult:
$ python mksentence.py infringement lecture attainment Produce more? (Y/N)y impeachment recoup ornament Produce more? (Y/N)y maladjustment edit discouragement Produce more? (Y/N)y embellishment guest punishment Produce more? (Y/N)y settlement section escapement Produce more? (Y/N)y segment withhold recruitment Produce more? (Y/N) I used the word list from here Find words containing every vowel
Some more rules can be added. For example, if a word ending with "ness" and the word also exist in set without the suffix, then it's a noun.
Source code:
#!/usr/bin/env python # vim: set fileencoding=utf-8 ts=4 sw=4 tw=72 : from __future__ import (unicode_literals, absolute_import, division, print_function) import random if __name__ == "__main__": filename = 'corncob_lowercase.txt' noun = set() verb = set() whole_words_set = {word.rstrip() for word in open(filename)} for word in whole_words_set: if word.endswith('ment'): noun.add(word) elif word.endswith('ing'): if word[:-3] in whole_words_set: verb.add(word[:-3]) elif word[:-3]+"e" in whole_words_set: verb.add(word[:-3]+"e") noun_list = list(noun) verb_list = list(verb) while True: sentence = "%s %s %s" % (random.choice(noun_list), random.choice(verb_list), random.choice(noun_list)) print(sentence) if input("Produce more? (Y/N)").lower() == "n": break