class_docstr: Feature extractor for text classification relying on ngrams tfidf and
  optionally word cooccurrences features
class_docstr_tok: ["Feature","extractor","for","text","classification","relying","on","ngrams","tfidf","and","optionally","word","cooccurrences","features"]
code: def _fit_cooccurrence_vectorizer(
      self, x, classes, none_class, dataset
  ):
      import numpy as np
      from sklearn.feature_selection import chi2
  
      non_null_x = (d for d, c in zip(x, classes) if c != none_class)
      self.cooccurrence_vectorizer = CooccurrenceVectorizer(
          config=self.config.cooccurrence_vectorizer_config,
          builtin_entity_parser=self.builtin_entity_parser,
          custom_entity_parser=self.custom_entity_parser,
          resources=self.resources,
          random_state=self.random_state,
      )
      x_cooccurrence = self.cooccurrence_vectorizer.fit(
          non_null_x, dataset
      ).transform(x)
      if not self.cooccurrence_vectorizer.word_pairs:
          return self
      _, pval = chi2(x_cooccurrence, classes)
  
      top_k = int(
          self.config.added_cooccurrence_feature_ratio
          * len(self.tfidf_vectorizer.idf_diag)
      )
  
      # No selection if k is greater or equal than the number of word pairs
      if top_k >= len(self.cooccurrence_vectorizer.word_pairs):
          return self
  
      top_k_cooccurrence_ix = np.argpartition(
          pval, top_k - 1, axis=None
      )[:top_k]
      top_k_cooccurrence_ix = set(top_k_cooccurrence_ix)
      top_word_pairs = [
          pair
          for pair, i in iteritems(
              self.cooccurrence_vectorizer.word_pairs
          )
          if i in top_k_cooccurrence_ix
      ]
  
      self.cooccurrence_vectorizer.limit_word_pairs(top_word_pairs)
      return self
  
imports: from __future__ import division, unicode_literals
  import json
  from builtins import str, zip
  from copy import deepcopy
  from pathlib import Path
  from future.utils import iteritems
  from snips_nlu.common.utils import json_string, fitted_required, replace_entities_with_placeholders, check_persisted_path
  from snips_nlu.constants import DATA, ENTITY, ENTITY_KIND, LANGUAGE, NGRAM, TEXT, ENTITIES
  from snips_nlu.dataset import get_text_from_chunks, validate_and_format_dataset
  from snips_nlu.entity_parser.builtin_entity_parser import is_builtin_entity
  from snips_nlu.exceptions import _EmptyDatasetUtterancesError, LoadingError
  from snips_nlu.languages import get_default_sep
  from snips_nlu.pipeline.configs import FeaturizerConfig
  from snips_nlu.pipeline.configs.intent_classifier import CooccurrenceVectorizerConfig, TfidfVectorizerConfig
  from snips_nlu.pipeline.processing_unit import ProcessingUnit
  from snips_nlu.preprocessing import stem, tokenize_light
  from snips_nlu.resources import get_stop_words, get_word_cluster
  from snips_nlu.slot_filler.features_utils import get_all_ngrams
label_desc: Use image node_id 8 for calling the Featurizer obj's underlying member method code with example usage: obj._fit_cooccurrence_vectorizer(x, classes, none_class, dataset) and returns: self, self, self