import random


def random_phrase(word_graph, exclude=[]):
	"""Build a random phrase from the given word graph."""
	def random_path():
		chosen_words = []
		word = '_start'
		while word != '_end':
			possible_words = word_graph[word]
			word = random.choice(possible_words)
			if word != '_end':
				chosen_words.append(word)
		return " ".join(chosen_words)

	while True:
		phrase = random_path()
		if phrase not in exclude:
			return phrase