import logging


def ov_jaccard(x, y, xy, g):
	"""
	Calculate the Jaccard's coefficient (https://en.wikipedia.org/wiki/Jaccard_index).

	Parameters
	----------
	x : int
		The cardinality of A.
	y : int
		The cardinality of B.
	xy : int
		The cardinality of A AND B.
	g : int
		The cardinality of background.

	Returns
	-------
	float
		Overlap coefficient.
	"""
	if xy > x or xy > y:
		logging.error("Invalid parameters.")
	if min(x,y,xy) < 0:
		logging.error("Invalid parameters.")
	if x == 0 or y == 0:
		return 0
	else:
		return xy/(x + y - xy)