class_docstr: Splits words into subwords and performs optional transformations on
  subword groups. This filter is funtionally based on yonik's
  WordDelimiterFilter in Solr, but shares no code with it.
  
  * Split on intra-word delimiters, e.g. `Wi-Fi` -> `Wi`, `Fi`.
  * When splitwords=True, split on case transitions,
    e.g. `PowerShot` -> `Power`, `Shot`.
  * When splitnums=True, split on letter-number transitions,
    e.g. `SD500` -> `SD`, `500`.
  * Leading and trailing delimiter characters are ignored.
  * Trailing possesive "'s" removed from subwords,
    e.g. `O'Neil's` -> `O`, `Neil`.
  
  The mergewords and mergenums arguments turn on merging of subwords.
  
  When the merge arguments are false, subwords are not merged.
  
  * `PowerShot` -> `0`:`Power`, `1`:`Shot` (where `0` and `1` are token
    positions).
  
  When one or both of the merge arguments are true, consecutive runs of
  alphabetic and/or numeric subwords are merged into an additional token with
  the same position as the last sub-word.
  
  * `PowerShot` -> `0`:`Power`, `1`:`Shot`, `1`:`PowerShot`
  * `A's+B's&C's` -> `0`:`A`, `1`:`B`, `2`:`C`, `2`:`ABC`
  * `Super-Duper-XL500-42-AutoCoder!` -> `0`:`Super`, `1`:`Duper`, `2`:`XL`,
    `2`:`SuperDuperXL`,
    `3`:`500`, `4`:`42`, `4`:`50042`, `5`:`Auto`, `6`:`Coder`,
    `6`:`AutoCoder`
  
  When using this filter you should use a tokenizer that only splits on
  whitespace, so the tokenizer does not remove intra-word delimiters before
  this filter can see them, and put this filter before any use of
  LowercaseFilter.
  
  >>> rt = RegexTokenizer(r"\S+")
  >>> iwf = IntraWordFilter()
  >>> lcf = LowercaseFilter()
  >>> analyzer = rt | iwf | lcf
  
  One use for this filter is to help match different written representations
  of a concept. For example, if the source text contained `wi-fi`, you
  probably want `wifi`, `WiFi`, `wi-fi`, etc. to match. One way of doing this
  is to specify mergewords=True and/or mergenums=True in the analyzer used
  for indexing, and mergewords=False / mergenums=False in the analyzer used
  for querying.
  
  >>> iwf_i = IntraWordFilter(mergewords=True, mergenums=True)
  >>> iwf_q = IntraWordFilter(mergewords=False, mergenums=False)
  >>> iwf = MultiFilter(index=iwf_i, query=iwf_q)
  >>> analyzer = RegexTokenizer(r"\S+") | iwf | LowercaseFilter()
  
  (See :class:`MultiFilter`.)
docstr: :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.
docstr_tok: [":","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","."]
code: 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
  
imports: import re
  from collections import deque
  from whoosh.compat import u, text_type
  from whoosh.compat import xrange
  from whoosh.analysis.filters import Filter
label_desc: Use image node_id 1 to create a new IntraWordFilter object from inherited base classes: Filter with example: obj = IntraWordFilter(delims, splitwords, splitnums, mergewords, mergenums)