def apply(self, doc):
if not isinstance(doc, Document):<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>for sentence in doc.sentences:<EOL><INDENT>for ts in Ngrams.apply(self, sentence):<EOL><INDENT>yield ts<EOL><DEDENT><DEDENT>
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``.