ó <żCVc@s1dZd„Zd„Zd„Zdd„ZdS(s# Tools for comparing ranked lists. ccs\t|ƒ}t|ƒ}x=|D]5}y|||||fVWqtk rSqXqWdS(s¸Finds the difference between the values in ranks1 and ranks2 for keys present in both dicts. If the arguments are not dicts, they are converted from (key, rank) sequences. N(tdicttKeyError(tranks1tranks2tk((sg/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/metrics/spearman.pyt _rank_dists s    cCsƒd}d}x5t||ƒD]$\}}|||7}|d7}qWy&ddt|ƒ|||dSWntk r~dSXdS(sUReturns the Spearman correlation coefficient for two rankings, which should be dicts or sequences of (key, rank). The coefficient ranges from -1.0 (ranks are opposite) to 1.0 (ranks are identical), and is only calculated for keys in both rankings (for meaningful results, remove keys present in only one list before ranking).iiigN(RtfloattZeroDivisionError(RRtntresRtd((sg/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/metrics/spearman.pytspearman_correlations& cCsd„t|ƒDƒS(s„Given a sequence, yields each element with an increasing rank, suitable for use as an argument to ``spearman_correlation``. css!|]\}}||fVqdS(N((t.0tiR((sg/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/metrics/spearman.pys 0s(t enumerate(tseq((sg/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/metrics/spearman.pytranks_from_sequence,sgV瞯Ň s