def corpus_importer(self, corpus, n_val=<NUM_LIT:1>, bos='<STR_LIT>', eos='<STR_LIT>'):
if not corpus or not isinstance(corpus, Corpus):<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>sentences = corpus.sents()<EOL>for sent in sentences:<EOL><INDENT>ngs = Counter(sent)<EOL>for key in ngs.keys():<EOL><INDENT>self._add_to_ngcorpus(self.ngcorpus, [key], ngs[key])<EOL><DEDENT>if n_val > <NUM_LIT:1>:<EOL><INDENT>if bos and bos != '<STR_LIT>':<EOL><INDENT>sent = [bos] + sent<EOL><DEDENT>if eos and eos != '<STR_LIT>':<EOL><INDENT>sent += [eos]<EOL><DEDENT>for i in range(<NUM_LIT:2>, n_val + <NUM_LIT:1>):<EOL><INDENT>for j in range(len(sent) - i + <NUM_LIT:1>):<EOL><INDENT>self._add_to_ngcorpus(<EOL>self.ngcorpus, sent[j : j + i], <NUM_LIT:1><EOL>)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
r"""Fill in self.ngcorpus from a Corpus argument.

        Parameters
        ----------
        corpus :Corpus
            The Corpus from which to initialize the n-gram corpus
        n_val : int
            Maximum n value for n-grams
        bos : str
            String to insert as an indicator of beginning of sentence
        eos : str
            String to insert as an indicator of end of sentence

        Raises
        ------
        TypeError
            Corpus argument of the Corpus class required.

        Example
        -------
        >>> tqbf = 'The quick brown fox jumped over the lazy dog.\n'
        >>> tqbf += 'And then it slept.\n And the dog ran off.'
        >>> ngcorp = NGramCorpus()
        >>> ngcorp.corpus_importer(Corpus(tqbf))