Run `CERMINE <https://github.com/CeON/CERMINE>`_ to extract DOIs of cited \
            papers from a PDF file.

    .. note::

        Try to use a local CERMINE JAR file, and falls back to using the API. \
                JAR file is expected to be found in \
                ``libbmc/external/cermine.jar``. You can override this using \
                the ``override_local`` parameter.

    .. note::

        CERMINE JAR file can be found at \
                `<http://maven.icm.edu.pl/artifactory/simple/kdd-releases/pl/edu/icm/cermine/cermine-impl/>`_.

    .. note::

        This fallback using the \
                `CERMINE API <http://cermine.ceon.pl/about.html>`_, and \
                hence, uploads the PDF file (so uses network). Check out \
                the CERMINE API terms.

    .. note::

        This function uses CERMINE to extract references from the paper, and \
                try to match them on Crossref to get DOIs.

    :param pdf_file: Path to the PDF file to handle.
    :param force_api: Force the use of the Cermine API \
            (and do not try to use a local JAR file). Defaults to ``False``.
    :param override_local: Use this specific JAR file, instead of the one at \
            the default location (``libbmc/external/cermine.jar``).
    :returns: A dict of cleaned plaintext citations and their associated DOI.

def cermine_dois(pdf_file, force_api=False, override_local=None):
    """
    Run `CERMINE <https://github.com/CeON/CERMINE>`_ to extract DOIs of cited \
            papers from a PDF file.

    .. note::

        Try to use a local CERMINE JAR file, and falls back to using the API. \
                JAR file is expected to be found in \
                ``libbmc/external/cermine.jar``. You can override this using \
                the ``override_local`` parameter.

    .. note::

        CERMINE JAR file can be found at \
                `<http://maven.icm.edu.pl/artifactory/simple/kdd-releases/pl/edu/icm/cermine/cermine-impl/>`_.

    .. note::

        This fallback using the \
                `CERMINE API <http://cermine.ceon.pl/about.html>`_, and \
                hence, uploads the PDF file (so uses network). Check out \
                the CERMINE API terms.

    .. note::

        This function uses CERMINE to extract references from the paper, and \
                try to match them on Crossref to get DOIs.

    :param pdf_file: Path to the PDF file to handle.
    :param force_api: Force the use of the Cermine API \
            (and do not try to use a local JAR file). Defaults to ``False``.
    :param override_local: Use this specific JAR file, instead of the one at \
            the default location (``libbmc/external/cermine.jar``).
    :returns: A dict of cleaned plaintext citations and their associated DOI.
    """
    # TODO:
    #    * Do not convert to plain text, but use the extra metadata from
    #      CERMINE
    # Call CERMINE on the PDF file
    cermine_output = cermine(pdf_file, force_api, override_local)
    # Parse the resulting XML
    root = ET.fromstring(cermine_output)
    plaintext_references = [
        # Remove extra whitespaces
        tools.clean_whitespaces(
            # Convert XML element to string, discarding any leading "[n]"
            ET.tostring(e, method="text").decode("utf-8").replace(e.text, ""))
        for e in root.iter("mixed-citation")]
    # Call the plaintext methods to fetch DOIs
    return plaintext.get_cited_dois(plaintext_references)