def extract_tag(inventory, url):
    """
    extract data from sphinx inventory. 
    
    The extracted datas come from a C++ project 
    documented using Breathe. The structure of the inventory 
    is a dictionary with the following keys

    - cpp:class (class names)
    - cpp:function (functions or class methods)
    - cpp:type (type names)

    each value of this dictionary is again a dictionary with

    - key : the name of the element
    - value : a tuple where the third index is the url to the corresponding documentation

    Parameters
    ----------

    inventory : dict
                sphinx inventory

    url : url of the documentation

    Returns
    -------

    dictionary with keys class, class_methods, func, type
    but now the class methods are with their class.
    """
    classes = {}
    class_methods = {}
    functions = {}
    types = {}

    get_relative_url = lambda x: x[2].replace(url, '')

    for c, v in inventory.get('cpp:class', {}).items():
        classes[c] = get_relative_url(v)
        class_methods[c] = {}

    for method, v in inventory.get('cpp:function', {}).items():
        found = False
        for c in class_methods.keys():
            find = c + '::'
            if find in method:
                class_methods[c][method.replace(find, '')] = get_relative_url(v)
                found = True
                break
        if not found:
            functions[method] = get_relative_url(v)

    for typename, v in inventory.get('cpp:type', {}).items():
        types[typename] = get_relative_url(v)

    return {'class': classes, 
            'class_methods': class_methods, 
            'func':functions, 
            'type': types
            }