class_docstr: Slot filler which uses Linear-Chain Conditional Random Fields underneath
  
  Check https://en.wikipedia.org/wiki/Conditional_random_field to learn
  more about CRFs
docstr: Fits the slot filler
  
  Args:
      dataset (dict): A valid Snips dataset
      intent (str): The specific intent of the dataset to train
          the slot filler on
  
  Returns:
      :class:`CRFSlotFiller`: The same instance, trained
docstr_tok: ["Fits","the","slot","filler","Args",":","dataset","(","dict",")",":","A","valid","Snips","dataset","intent","(","str",")",":","The","specific","intent","of","the","dataset","to","train","the","slot","filler","on","Returns",":",":","class",":","`","CRFSlotFiller","`",":","The","same","instance",",","trained"]
code: def fit(self, dataset, intent):
      """Fits the slot filler
  
      Args:
          dataset (dict): A valid Snips dataset
          intent (str): The specific intent of the dataset to train
              the slot filler on
  
      Returns:
          :class:`CRFSlotFiller`: The same instance, trained
      """
      logger.info("Fitting %s slot filler...", intent)
      dataset = validate_and_format_dataset(dataset)
      self.load_resources_if_needed(dataset[LANGUAGE])
      self.fit_builtin_entity_parser_if_needed(dataset)
      self.fit_custom_entity_parser_if_needed(dataset)
  
      for factory in self.features_factories:
          factory.custom_entity_parser = self.custom_entity_parser
          factory.builtin_entity_parser = self.builtin_entity_parser
          factory.resources = self.resources
  
      self.language = dataset[LANGUAGE]
      self.intent = intent
      self.slot_name_mapping = get_slot_name_mapping(dataset, intent)
  
      if not self.slot_name_mapping:
          # No need to train the CRF if the intent has no slots
          return self
  
      augmented_intent_utterances = augment_utterances(
          dataset,
          self.intent,
          language=self.language,
          resources=self.resources,
          random_state=self.random_state,
          **self.config.data_augmentation_config.to_dict(),
      )
  
      crf_samples = [
          utterance_to_sample(
              u[DATA], self.config.tagging_scheme, self.language
          )
          for u in augmented_intent_utterances
      ]
  
      for factory in self.features_factories:
          factory.fit(dataset, intent)
  
      # Ensure that X, Y are safe and that the OUTSIDE label is learnt to
      # avoid segfault at inference time
      # pylint: disable=C0103
      X = [
          self.compute_features(sample[TOKENS], drop_out=True)
          for sample in crf_samples
      ]
      Y = [[tag for tag in sample[TAGS]] for sample in crf_samples]
      X, Y = _ensure_safe(X, Y)
  
      # ensure ascii tags
      Y = [[_encode_tag(tag) for tag in y] for y in Y]
  
      # pylint: enable=C0103
      self.crf_model = _get_crf_model(self.config.crf_args)
      self.crf_model.fit(X, Y)
  
      logger.debug(
          "Most relevant features for %s:\n%s",
          self.intent,
          DifferedLoggingMessage(self.log_weights),
      )
      return self
  
imports: from __future__ import unicode_literals
  import base64
  import json
  import logging
  import math
  import os
  import shutil
  import tempfile
  from builtins import range
  from copy import deepcopy
  from pathlib import Path
  from future.utils import iteritems
  from snips_nlu.common.dataset_utils import get_slot_name_mapping
  from snips_nlu.common.dict_utils import UnupdatableDict
  from snips_nlu.common.io_utils import mkdir_p
  from snips_nlu.common.log_utils import DifferedLoggingMessage, log_elapsed_time
  from snips_nlu.common.utils import check_persisted_path, fitted_required, json_string
  from snips_nlu.constants import DATA, LANGUAGE
  from snips_nlu.data_augmentation import augment_utterances
  from snips_nlu.dataset import validate_and_format_dataset
  from snips_nlu.exceptions import LoadingError
  from snips_nlu.pipeline.configs import CRFSlotFillerConfig
  from snips_nlu.preprocessing import tokenize
  from snips_nlu.slot_filler.crf_utils import OUTSIDE, TAGS, TOKENS, tags_to_slots, utterance_to_sample
  from snips_nlu.slot_filler.feature import TOKEN_NAME
  from snips_nlu.slot_filler.feature_factory import CRFFeatureFactory
  from snips_nlu.slot_filler.slot_filler import SlotFiller
label_desc: Use image node_id 5 for calling the CRFSlotFiller obj's underlying member method code with example usage: obj.fit(dataset, intent) and returns: self, self