def scan(self, tokens, max_matches=six.MAXSIZE, overlap=False):
    '\n        Scans for matches in given tokens.\n\n        :param list(tuple(string, string)) tokens: A tokenized representation of the text to scan. The first string in the tuple is the content, typically a word, and the second string is the part of speech tag.\n        :param int max_matches: The maximum number of matches to look for. Default is the maximum size possible for a list.\n        :param bool overlap: Whether the found results are allowed to overlap. Default False.\n        :returns: A generator of the results found. Each result is a tuple with the first element being a list of elements found, and the second and third elements are the start and end indices representing the span of the result.\n        :rtype: generator(tuple(list(lxml.etree.Element), int, int))\n        '
    if (not self.streamlined):
        self.streamline()
    matches = 0
    i = 0
    length = len(tokens)
    while ((i < length) and (matches < max_matches)):
        try:
            (results, next_i) = self.parse(tokens, i)
        except ParseException as err:
            i += 1
        else:
            if (next_i > i):
                matches += 1
                if (len(results) == 1):
                    results = results[0]
                (yield (results, i, next_i))
                if overlap:
                    i += 1
                else:
                    i = next_i
            else:
                i += 1
Scans for matches in given tokens.

:param list(tuple(string, string)) tokens: A tokenized representation of the text to scan. The first string in the tuple is the content, typically a word, and the second string is the part of speech tag.
:param int max_matches: The maximum number of matches to look for. Default is the maximum size possible for a list.
:param bool overlap: Whether the found results are allowed to overlap. Default False.
:returns: A generator of the results found. Each result is a tuple with the first element being a list of elements found, and the second and third elements are the start and end indices representing the span of the result.
:rtype: generator(tuple(list(lxml.etree.Element), int, int))
def scan(self, tokens, max_matches=six.MAXSIZE, overlap=False):
    '\n        Scans for matches in given tokens.\n\n        :param list(tuple(string, string)) tokens: A tokenized representation of the text to scan. The first string in the tuple is the content, typically a word, and the second string is the part of speech tag.\n        :param int max_matches: The maximum number of matches to look for. Default is the maximum size possible for a list.\n        :param bool overlap: Whether the found results are allowed to overlap. Default False.\n        :returns: A generator of the results found. Each result is a tuple with the first element being a list of elements found, and the second and third elements are the start and end indices representing the span of the result.\n        :rtype: generator(tuple(list(lxml.etree.Element), int, int))\n        '
    if (not self.streamlined):
        self.streamline()
    matches = 0
    i = 0
    length = len(tokens)
    while ((i < length) and (matches < max_matches)):
        try:
            (results, next_i) = self.parse(tokens, i)
        except ParseException as err:
            i += 1
        else:
            if (next_i > i):
                matches += 1
                if (len(results) == 1):
                    results = results[0]
                (yield (results, i, next_i))
                if overlap:
                    i += 1
                else:
                    i = next_i
            else:
                i += 1