code: def apply(self, doc):
          
          if not isinstance(doc, Document):
              raise TypeError(
                  "Input Contexts to MentionNgrams.apply() must be of type Document"
              )
  
          for sentence in doc.sentences:
              for ts in Ngrams.apply(self, sentence):
                  yield ts
docs: Generate MentionNgrams from a Document by parsing all of its Sentences.
  
          :param doc: The ``Document`` to parse.
          :type doc: ``Document``
          :raises TypeError: If the input doc is not of type ``Document``.