class_docstr: Intent parser using pattern matching in a deterministic manner
  
  This intent parser is very strict by nature, and tends to have a very good
  precision but a low recall. For this reason, it is interesting to use it
  first before potentially falling back to another parser.
class_docstr_tok: ["Intent","parser","using","pattern","matching","in","a","deterministic","manner","This","intent","parser","is","very","strict","by","nature",",","and","tends","to","have","a","very","good","precision","but","a","low","recall",".","For","this","reason",",","it","is","interesting","to","use","it","first","before","potentially","falling","back","to","another","parser","."]
docstr: Fits the intent parser with a valid Snips dataset
docstr_tok: ["Fits","the","intent","parser","with","a","valid","Snips","dataset"]
code: def fit(self, dataset, force_retrain=True):
      """Fits the intent parser with a valid Snips dataset"""
      logger.info("Fitting deterministic intent parser...")
      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)
      self.language = dataset[LANGUAGE]
      self.regexes_per_intent = dict()
      entity_placeholders = _get_entity_placeholders(
          dataset, self.language
      )
      self.slot_names_to_entities = get_slot_name_mappings(dataset)
      self.group_names_to_slot_names = _get_group_names_to_slot_names(
          self.slot_names_to_entities
      )
      self._stop_words_whitelist = get_stop_words_whitelist(
          dataset, self._stop_words
      )
  
      # Do not use ambiguous patterns that appear in more than one intent
      all_patterns = set()
      ambiguous_patterns = set()
      intent_patterns = dict()
      for intent_name, intent in iteritems(dataset[INTENTS]):
          patterns = self._generate_patterns(
              intent_name, intent[UTTERANCES], entity_placeholders
          )
          patterns = [
              p
              for p in patterns
              if len(p) < self.config.max_pattern_length
          ]
          existing_patterns = {p for p in patterns if p in all_patterns}
          ambiguous_patterns.update(existing_patterns)
          all_patterns.update(set(patterns))
          intent_patterns[intent_name] = patterns
  
      for intent_name, patterns in iteritems(intent_patterns):
          patterns = [
              p for p in patterns if p not in ambiguous_patterns
          ]
          patterns = patterns[: self.config.max_queries]
          regexes = [re.compile(p, re.IGNORECASE) for p in patterns]
          self.regexes_per_intent[intent_name] = regexes
      return self
  
imports: from __future__ import unicode_literals
  import json
  import logging
  import re
  from builtins import str
  from collections import defaultdict
  from pathlib import Path
  from future.utils import iteritems, itervalues
  from snips_nlu.common.dataset_utils import get_slot_name_mappings
  from snips_nlu.common.log_utils import log_elapsed_time, log_result
  from snips_nlu.common.utils import check_persisted_path, deduplicate_overlapping_items, fitted_required, json_string, ranges_overlap, regex_escape, replace_entities_with_placeholders
  from snips_nlu.constants import DATA, END, ENTITIES, ENTITY, INTENTS, LANGUAGE, RES_INTENT, RES_INTENT_NAME, RES_MATCH_RANGE, RES_SLOTS, RES_VALUE, SLOT_NAME, START, TEXT, UTTERANCES, RES_PROBA
  from snips_nlu.dataset import validate_and_format_dataset
  from snips_nlu.dataset.utils import get_stop_words_whitelist
  from snips_nlu.entity_parser.builtin_entity_parser import is_builtin_entity
  from snips_nlu.exceptions import IntentNotFoundError, LoadingError
  from snips_nlu.intent_parser.intent_parser import IntentParser
  from snips_nlu.pipeline.configs import DeterministicIntentParserConfig
  from snips_nlu.preprocessing import normalize_token, tokenize, tokenize_light
  from snips_nlu.resources import get_stop_words
  from snips_nlu.result import empty_result, extraction_result, intent_classification_result, parsing_result, unresolved_slot
label_desc: Use image node_id 11 for calling the DeterministicIntentParser obj's underlying member method code with example usage: obj.fit(dataset, force_retrain) and returns: self