class_docstr: Given a set of words (or any object with a ``__contains__`` method),
  break any tokens in the stream that are composites of words in the word set
  into their individual parts.
  
  Given the correct set of words, this filter can break apart run-together
  words and trademarks (e.g. "turbosquid", "applescript"). It can also be
  useful for agglutinative languages such as German.
  
  The ``keep_compound`` argument lets you decide whether to keep the
  compound word in the token stream along with the word segments.
  
  >>> cwf = CompoundWordFilter(wordset, keep_compound=True)
  >>> analyzer = RegexTokenizer(r"\S+") | cwf
  >>> [t.text for t in analyzer("I do not like greeneggs and ham")
  ["I", "do", "not", "like", "greeneggs", "green", "eggs", "and", "ham"]
  >>> cwf.keep_compound = False
  >>> [t.text for t in analyzer("I do not like greeneggs and ham")
  ["I", "do", "not", "like", "green", "eggs", "and", "ham"]
docstr: :param wordset: an object with a ``__contains__`` method, such as a
      set, containing strings to look for inside the tokens.
  :param keep_compound: if True (the default), the original compound
      token will be retained in the stream before the subwords.
docstr_tok: [":","param","wordset",":","an","object","with","a","``","__contains__","``","method",",","such","as","a","set",",","containing","strings","to","look","for","inside","the","tokens",".",":","param","keep_compound",":","if","True","(","the","default",")",",","the","original","compound","token","will","be","retained","in","the","stream","before","the","subwords","."]
code: def __init__(self, wordset, keep_compound=True):
      """
      :param wordset: an object with a ``__contains__`` method, such as a
          set, containing strings to look for inside the tokens.
      :param keep_compound: if True (the default), the original compound
          token will be retained in the stream before the subwords.
      """
  
      self.wordset = wordset
      self.keep_compound = keep_compound
  
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 CompoundWordFilter object from inherited base classes: Filter with example: obj = CompoundWordFilter(wordset, keep_compound)