def pairwise_similarity_statistics(<EOL>src_collection,<EOL>tar_collection,<EOL>metric=sim,<EOL>mean_func=amean,<EOL>symmetric=False,<EOL>):
if not callable(mean_func):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not callable(metric):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if hasattr(src_collection, '<STR_LIT>'):<EOL><INDENT>src_collection = src_collection.split()<EOL><DEDENT>if not hasattr(src_collection, '<STR_LIT>'):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if hasattr(tar_collection, '<STR_LIT>'):<EOL><INDENT>tar_collection = tar_collection.split()<EOL><DEDENT>if not hasattr(tar_collection, '<STR_LIT>'):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>src_collection = list(src_collection)<EOL>tar_collection = list(tar_collection)<EOL>pairwise_values = []<EOL>for src in src_collection:<EOL><INDENT>for tar in tar_collection:<EOL><INDENT>pairwise_values.append(metric(src, tar))<EOL>if symmetric:<EOL><INDENT>pairwise_values.append(metric(tar, src))<EOL><DEDENT><DEDENT><DEDENT>return (<EOL>max(pairwise_values),<EOL>min(pairwise_values),<EOL>mean_func(pairwise_values),<EOL>std(pairwise_values, mean_func, <NUM_LIT:0>),<EOL>)<EOL>
Calculate the pairwise similarity statistics a collection of strings.

    Calculate pairwise similarities among members of two collections,
    returning the maximum, minimum, mean (according to a supplied function,
    arithmetic mean, by default), and (population) standard deviation
    of those similarities.

    Parameters
    ----------
    src_collection : list
        A collection of terms or a string that can be split
    tar_collection : list
        A collection of terms or a string that can be split
    metric : function
        A similarity metric function
    mean_func : function
        A mean function that takes a list of values and returns a float
    symmetric : bool
        Set to True if all pairwise similarities should be calculated in both
        directions

    Returns
    -------
    tuple
        The max, min, mean, and standard deviation of similarities

    Raises
    ------
    ValueError
        mean_func must be a function
    ValueError
        metric must be a function
    ValueError
        src_collection is neither a string nor iterable
    ValueError
        tar_collection is neither a string nor iterable

    Example
    -------
    >>> tuple(round(_, 12) for _ in pairwise_similarity_statistics(
    ... ['Christopher', 'Kristof', 'Christobal'], ['Niall', 'Neal', 'Neil']))
    (0.2, 0.0, 0.118614718615, 0.075070477184)