Scan a string.

        Parameters
        ----------
        data : `str`
            String to scan.
        part : `bool`
            True if data is partial.

        Returns
        -------
        `generator` of (`str` or `markovchain.scanner.Scanner.END`)
            Token generator.

def scan(self, data, part):
        """Scan a string.

        Parameters
        ----------
        data : `str`
            String to scan.
        part : `bool`
            True if data is partial.

        Returns
        -------
        `generator` of (`str` or `markovchain.scanner.Scanner.END`)
            Token generator.
        """
        if not self.end_chars:
            yield from data
            self.start = self.start or bool(data)
            self.end = False
        else:
            for char in data:
                if char in self.end_chars:
                    if not self.start:
                        continue
                    self.end = True
                else:
                    if self.end:
                        yield self.END
                        self.end = False
                    self.start = True
                yield char

        if not part and self.start:
            if not self.end and self.default_end is not None:
                yield self.default_end
            yield self.END
            self.reset()