code: def _get_per_word_occurrence_values(
      doc: Doc,
      normalize: Optional[str],
      stop_words: set[str],
      window_size: int,
  ) -> dict[int, dict[str, list]]:
      """
      Get base values for each individual occurrence of a word, to be aggregated
      and combined into a per-word score.
      """
      word_occ_vals: collections.defaultdict = collections.defaultdict(
          lambda: collections.defaultdict(list)
      )
  
      def _is_upper_cased(tok):
          return tok.is_upper or (
              tok.is_title and not tok.is_sent_start
          )
  
      attr_name = _get_attr_name(normalize, False)
      padding = [None] * window_size
      for sent_idx, sent in enumerate(doc.sents):
          sent_padded = itertoolz.concatv(padding, sent, padding)
          for window in itertoolz.sliding_window(
              1 + (2 * window_size), sent_padded
          ):
              lwords, word, rwords = (
                  window[:window_size],
                  window[window_size],
                  window[window_size + 1 :],
              )
              w_id = getattr(word, attr_name)
              if word.is_stop:
                  stop_words.add(w_id)
              word_occ_vals[w_id]["is_uc"].append(_is_upper_cased(word))
              word_occ_vals[w_id]["sent_idx"].append(sent_idx)
              word_occ_vals[w_id]["l_context"].extend(
                  getattr(w, attr_name)
                  for w in lwords
                  if not (w is None or w.is_punct or w.is_space)
              )
              word_occ_vals[w_id]["r_context"].extend(
                  getattr(w, attr_name)
                  for w in rwords
                  if not (w is None or w.is_punct or w.is_space)
              )
      return word_occ_vals
  
file_path: textacy/src/textacy/extract/keyterms/yake.py
imports: from __future__ import annotations
  import collections
  import functools
  import math
  import operator
  import statistics
  from typing import Collection, Iterable, Optional
  from cytoolz import itertoolz
  from spacy.tokens import Doc, Token
  from ...None import errors, utils
  from ..None import utils
label_desc: Use image node_id 3 for calling a global function with example usage: _get_per_word_occurrence_values(doc, normalize, stop_words, window_size) and returns: word_occ_vals, unknown