Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

I used the word list from here Find words containing every vowel

I used the word list from here Find words containing every vowel

Source Link
yegle
  • 219
  • 1
  • 6

Python

Result:

$ 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