def weighing_function(orig_length, cur_length):

	"""
	Function to generate the weight value given the predicted text-length and the expected text-length
	The intuition is that if the predicted text-length is far from the expected text-length then weight should be
	small to that word-bbox.
	:param orig_length: Length of the expected word bounding box
	:param cur_length: Length of the predicted word bounding box
	:return:
	"""

	if orig_length == 0:
		if cur_length == 0:
			return 1
		return 0

	return (orig_length - min(orig_length, abs(orig_length - cur_length)))/orig_length