def get_paragraph_number(identifier):
    """
    Extracts the number of a paragraph from the identifier, and the parent directory of the
    paragraph.

    Parameters
    ----------
    directory : Path
        A parent directory of a paragraph.
    identifier : str
        An identifier of a paragraph.

    Returns
    -------
    int
        The number of the paragraph.
    """
    paragraph_number = int(identifier.split('_')[-1]) - 1
    assert paragraph_number >= 0
    return paragraph_number