code: def set_doc_extensions(name: str, force: bool = True):
      """
      Set a collection of custom extensions on the global :class:`spacy.tokens.Doc` ,
      specified by ``name`` .
  
      Args:
          name: Name of a function registered in :obj:`doc_extensions_registry`
              that returns a collection of custom doc extensions as a dictionary.
              For example, "extract" or "extract.keyterms".
          force: If True, set extensions even if existing extensions already exist;
              otherwise, don't overwrite existing extensions.
      """
      for name, kwargs in get_doc_extensions(name).items():
          if not Doc.has_extension(name):
              Doc.set_extension(name, **kwargs)
          elif force is True:
              LOGGER.warning(
                  "%s `Doc` extension already exists; overwriting...",
                  name,
              )
              Doc.set_extension(name, **kwargs, force=True)
          else:
              LOGGER.warning(
                  "%s `Doc` extension already exists, and was not overwritten",
                  name,
              )
  
imports: import logging
  import catalogue
  from spacy.tokens import Doc
  from ..None import types
label_desc: Use image node_id 2 for calling a global function with example usage: set_doc_extensions(name, force) without return types