def count_gerunds(results):
	"""Given a list of words, return the number of pairs which appear as
	both verb and gerundive noun form in the list (adding -ING,
	possibly doubling previous letter, possibly removing -E
	suffix).

	For example: ALIGN, ALIGNING, LOVE, LOVING, ZIGZAG, ZIGZAGGING
	would return 3.

	Limiting the count (see params.py:MAX_GERUNDS) allows games
	with 'I', 'N', and 'G' to exist, but rejects games that are
	too simple because too many words end in -ING.
	"""

	words = list(x['word'] for x in results)
	count=0
	for word in words:
		if not word.endswith('ING'):
			continue
		if word[0:-3] in words:
			count=count+1
		if word[0:-3]+'E' in words:
			count=count+1
		if len(word) >= 5 and word[-4] == word[-5] and word[0:-4] in words:
			count=count+1
	return count