#!/usr/bin/python

class soundtype():
	"""A represents a class of sounds and what they can appear after."""
	def __init__(self, sonority, wordedgey, membersounds):
		self.sonority = sonority
		self.sounds = membersounds
		self.wordedgey = wordedgey

def derpify(allsounds,already="",depth=1):
	if depth <= 3:
		for set in allsounds:
			next = []
			for test in allsounds:
				if test.sonority > set.sonority:
					next.append(test)
			if next == [] and not set.wordedgey:
				for test in allsounds:
					if test.wordedgey:
						next.append(test)
			for sound in set.sounds:
				print sound + already + "erp"
				if next:
					derpify(next, sound + already, depth + 1)
#d = dict()
#d['glides'] = soundtype(2,False,['y','w'])
#d['liquids'] = soundtype(3,False,['l','r'])
#d['nasals'] = soundtype(4,False,['m','n'])
#d['voicedfricatives'] = soundtype(5,False,['z','v'])
#d['fricatives'] = soundtype(5,False,['sh','f'])
#d['sibilants'] = soundtype(5,True,['s'])
#d['voicedstops'] = soundtype(6,False,['b','g','d','j'])
#d['stops'] = soundtype(6,False,['p','k','t','ch'])

l = [
soundtype(2,False,['y','w','h']),	#glides
soundtype(3,False,['l','r']), #liquids
soundtype(4,False,['m','n']), #nasals
soundtype(5,False,['z','v']), #voiced fricatives
soundtype(5,False,['f',]), #voiceless fricatives
soundtype(5,True,['sh','s']), #voiceless fricatives which can appear at a word edge
soundtype(6,False,['b','g','d','j']), #voiced stops
soundtype(6,False,['p','k','t','ch']) #voiceless stops
]

derpify(l)