(self, delims=u("-_'\"()!@#$%^&*[]{}<>\|;:,./?`~=+"),
                 splitwords=True, splitnums=True,
                 mergewords=False, mergenums=False)
:param delims: a string of delimiter characters.
        :param splitwords: if True, split at case transitions,
            e.g. `PowerShot` -> `Power`, `Shot`
        :param splitnums: if True, split at letter-number transitions,
            e.g. `SD500` -> `SD`, `500`
        :param mergewords: merge consecutive runs of alphabetic subwords into
            an additional token with the same position as the last subword.
        :param mergenums: merge consecutive runs of numeric subwords into an
            additional token with the same position as the last subword.
:param delims: a string of delimiter characters.
        :param splitwords: if True, split at case transitions,
            e.g. `PowerShot` -> `Power`, `Shot`
        :param splitnums: if True, split at letter-number transitions,
            e.g. `SD500` -> `SD`, `500`
        :param mergewords: merge consecutive runs of alphabetic subwords into
            an additional token with the same position as the last subword.
        :param mergenums: merge consecutive runs of numeric subwords into an
            additional token with the same position as the last subword.
: param delims : a string of delimiter characters . : param splitwords : if True split at case transitions e . g . PowerShot - > Power Shot : param splitnums : if True split at letter - number transitions e . g . SD500 - > SD 500 : param mergewords : merge consecutive runs of alphabetic subwords into an additional token with the same position as the last subword . : param mergenums : merge consecutive runs of numeric subwords into an additional token with the same position as the last subword .
def __init__(self, delims=u("-_'\"()!@#$%^&*[]{}<>\|;:,./?`~=+"),
                 splitwords=True, splitnums=True,
                 mergewords=False, mergenums=False):
        """
        :param delims: a string of delimiter characters.
        :param splitwords: if True, split at case transitions,
            e.g. `PowerShot` -> `Power`, `Shot`
        :param splitnums: if True, split at letter-number transitions,
            e.g. `SD500` -> `SD`, `500`
        :param mergewords: merge consecutive runs of alphabetic subwords into
            an additional token with the same position as the last subword.
        :param mergenums: merge consecutive runs of numeric subwords into an
            additional token with the same position as the last subword.
        """

        from whoosh.support.unicode import digits, lowercase, uppercase

        self.delims = re.escape(delims)

        # Expression for text between delimiter characters
        self.between = re.compile(u("[^%s]+") % (self.delims,), re.UNICODE)
        # Expression for removing "'s" from the end of sub-words
        dispat = u("(?<=[%s%s])'[Ss](?=$|[%s])") % (lowercase, uppercase,
                                                    self.delims)
        self.possessive = re.compile(dispat, re.UNICODE)

        # Expression for finding case and letter-number transitions
        lower2upper = u("[%s][%s]") % (lowercase, uppercase)
        letter2digit = u("[%s%s][%s]") % (lowercase, uppercase, digits)
        digit2letter = u("[%s][%s%s]") % (digits, lowercase, uppercase)
        if splitwords and splitnums:
            splitpat = u("(%s|%s|%s)") % (lower2upper, letter2digit,
                                          digit2letter)
            self.boundary = re.compile(splitpat, re.UNICODE)
        elif splitwords:
            self.boundary = re.compile(text_type(lower2upper), re.UNICODE)
        elif splitnums:
            numpat = u("(%s|%s)") % (letter2digit, digit2letter)
            self.boundary = re.compile(numpat, re.UNICODE)

        self.splitting = splitwords or splitnums
        self.mergewords = mergewords
        self.mergenums = mergenums
def __init__ ( self , delims = u ( "-_'\"()!@#$%^&*[]{}<>\|;:,./?`~=+" ) , splitwords = True , splitnums = True , mergewords = False , mergenums = False ) : from whoosh . support . unicode import digits , lowercase , uppercase self . delims = re . escape ( delims ) # Expression for text between delimiter characters self . between = re . compile ( u ( "[^%s]+" ) % ( self . delims , ) , re . UNICODE ) # Expression for removing "'s" from the end of sub-words dispat = u ( "(?<=[%s%s])'[Ss](?=$|[%s])" ) % ( lowercase , uppercase , self . delims ) self . possessive = re . compile ( dispat , re . UNICODE ) # Expression for finding case and letter-number transitions lower2upper = u ( "[%s][%s]" ) % ( lowercase , uppercase ) letter2digit = u ( "[%s%s][%s]" ) % ( lowercase , uppercase , digits ) digit2letter = u ( "[%s][%s%s]" ) % ( digits , lowercase , uppercase ) if splitwords and splitnums : splitpat = u ( "(%s|%s|%s)" ) % ( lower2upper , letter2digit , digit2letter ) self . boundary = re . compile ( splitpat , re . UNICODE ) elif splitwords : self . boundary = re . compile ( text_type ( lower2upper ) , re . UNICODE ) elif splitnums : numpat = u ( "(%s|%s)" ) % ( letter2digit , digit2letter ) self . boundary = re . compile ( numpat , re . UNICODE ) self . splitting = splitwords or splitnums self . mergewords = mergewords self . mergenums = mergenums