def get_neighbor_types(neighbor_dict, sep=None):
    """
    Given a *neighbor_dict* (where a key is a "target" word and its
    value is a list of all of its neighbors), return a list of `(word1,
    word2, relationship)` triples, where `relationship` is one of
    "deletion," "addition," "substitution," or "unknown".
    """
    types = []
    targets = list(neighbor_dict.keys())
    while targets:
        current = targets.pop()
        current_key = current
        if sep:
            current = current.split(sep)
        for neighbor in neighbor_dict[current_key]:
            neighbor_key = neighbor
            if sep:
                neighbor = neighbor.split(sep)
            if len(current) == len(neighbor):
                types.append((current_key, neighbor_key, 'substitution'))
            elif len(current) > len(neighbor):
                types.append((current_key, neighbor_key, 'deletion'))
            elif len(current) < len(neighbor):
                types.append((current_key, neighbor_key, 'addition'))
            else:
                types.append((current_key, neighbor_key, 'unknown'))
    return types
