def testMergeCostReductionTableNaive(BCM):
	currentGraphCost = BCM.findTotalClusteringCost()
	allOK = True
	for potentialMerge, costReduction in BCM.mergeCostReductions.iteritems():
		(c1, c2) = potentialMerge
		BCM2 = deepcopy(BCM)
		BCM2.mergeClusters_changeNGramCounts(c1, c2)
		newGraphCost = BCM2.findTotalClusteringCost()
		calculatedCostReduction = newGraphCost - currentGraphCost

		desc = 'Potential MergeCostReduction for clusters {0} and {1}: BCM {2}'.format(c1, c2, BCM.description)
		allOK = (allOK and 
			testing.floatComparisonTest(calculatedCostReduction, costReduction, 'calculatedCostReduction', 'costReduction', desc, throwawayTest=True)
			)
	if allOK:
		testing.outputTestOK('All Merge Cost Reductions Worked as Expected')
	else:
		testing.outputTestFAILED('Not All Merge Cost Reductions Worked as Expected')
def testMergeReductionCost(word1=(0,), word2=(1,), expectedMergeReductionCost=1.0):
	cluster1 = BCM.wordClusterMapping[word1]
	cluster2 = BCM.wordClusterMapping[word2]
	mergeReductionCost = BCM.mergeCostReductions.get(cluster1, cluster2)
	desc = 'Merge reduction cost for words {0} and {1}: BCM {2}'.format(word1, word2, BCM.description)
	testing.floatComparisonTest(mergeReductionCost, expectedMergeReductionCost, 'mergeReductionCost', 'expectedMergeReductionCost', desc, numDigits=2)
def testEdgeCost(BCM,expectedTotalEdgeCost=2.0):
	totalEdgeCost = sum([v for i,v in BCM.clusterCostTable.iteritems()])
	desc = 'Total cluster cost: BCM {0}'.format(BCM.description)
	testing.floatComparisonTest(totalEdgeCost, expectedTotalEdgeCost, 'totalEdgeCost', 'expectedTotalEdgeCost', desc, numDigits=2)