class_docstr: Helper class that creates a search index based on the doctrees
  passed to the `feed` method.
class_docstr_tok: ["Helper","class","that","creates","a","search","index","based","on","the","doctrees","passed","to","the","`","feed","`","method","."]
code: def _word_collector(self, doctree: nodes.document) -> WordStore:
      def _visit_nodes(node):
          if isinstance(node, nodes.comment):
              return
          elif isinstance(node, nodes.raw):
              if "html" in node.get("format", "").split():
                  # Some people might put content in raw HTML that should be searched,
                  # so we just amateurishly strip HTML tags and index the remaining
                  # content
                  nodetext = re.sub(
                      r"<style.*?</style>",
                      "",
                      node.astext(),
                      flags=re.IGNORECASE | re.DOTALL,
                  )
                  nodetext = re.sub(
                      r"<script.*?</script>",
                      "",
                      nodetext,
                      flags=re.IGNORECASE | re.DOTALL,
                  )
                  nodetext = re.sub(r"<[^<]+?>", "", nodetext)
                  word_store.words.extend(split(nodetext))
              return
          elif isinstance(
              node, nodes.meta
          ) and _is_meta_keywords(  # type: ignore[attr-defined]
              node, language
          ):
              keywords = [
                  keyword.strip()
                  for keyword in node["content"].split(",")
              ]
              word_store.words.extend(keywords)
          elif isinstance(node, nodes.Text):
              word_store.words.extend(split(node.astext()))
          elif isinstance(node, nodes.title):
              title = node.astext()
              ids = node.parent["ids"]
              word_store.titles.append((title, ids[0] if ids else None))
              word_store.title_words.extend(split(title))
          for child in node.children:
              _visit_nodes(child)
  
      word_store = WordStore()
      split = self.lang.split
      language = self.lang.lang
      _visit_nodes(doctree)
      return word_store
  
imports: from __future__ import annotations
  import dataclasses
  import functools
  import html
  import json
  import pickle
  import re
  from importlib import import_module
  from os import path
  from typing import IO, TYPE_CHECKING, Any
  from docutils import nodes
  from docutils.nodes import Element, Node
  from sphinx import addnodes, package_dir
  from sphinx.environment import BuildEnvironment
  from sphinx.util.index_entries import split_index_msg
  from sphinx.search.en import SearchEnglish
label_desc: Use image node_id 10 for calling the IndexBuilder obj's underlying member method code with example usage: obj._word_collector(doctree) and returns: word_store