def substring_names(features):
    """Yield all feature name pairs in substring relation.

    >>> list(substring_names(['+spam', '-ham', '+pam']))
    [('pam', 'spam')]
    """
    names = tools.uniqued(map(remove_sign, features))
    for l, r in permutations(names, 2):
        if l in r:
            yield (l, r)