class_docstr: Main class to use for intent parsing
  
  A :class:`SnipsNLUEngine` relies on a list of :class:`.IntentParser`
  object to parse intents, by calling them successively using the first
  positive output.
  
  With the default parameters, it will use the two following intent parsers
  in this order:
  
  - a :class:`.DeterministicIntentParser`
  - a :class:`.ProbabilisticIntentParser`
  
  The logic behind is to first use a conservative parser which has a very
  good precision while its recall is modest, so simple patterns will be
  caught, and then fallback on a second parser which is machine-learning
  based and will be able to parse unseen utterances while ensuring a good
  precision and recall.
class_docstr_tok: ["Main","class","to","use","for","intent","parsing","A",":","class",":","`","SnipsNLUEngine","`","relies","on","a","list","of",":","class",":","`",".IntentParser","`","object","to","parse","intents",",","by","calling","them","successively","using","the","first","positive","output",".","With","the","default","parameters",",","it","will","use","the","two","following","intent","parsers","in","this","order",":","-","a",":","class",":","`",".DeterministicIntentParser","`","-","a",":","class",":","`",".ProbabilisticIntentParser","`","The","logic","behind","is","to","first","use","a","conservative","parser","which","has","a","very","good","precision","while","its","recall","is","modest",",","so","simple","patterns","will","be","caught",",","and","then","fallback","on","a","second","parser","which","is","machine-learning","based","and","will","be","able","to","parse","unseen","utterances","while","ensuring","a","good","precision","and","recall","."]
docstr: Loads a :class:`SnipsNLUEngine` instance from a directory path
  
  The data at the given path must have been generated using
  :func:`~SnipsNLUEngine.persist`
  
  Args:
      path (str): The path where the nlu engine is stored
  
  Raises:
      LoadingError: when some files are missing
      IncompatibleModelError: when trying to load an engine model which
          is not compatible with the current version of the lib
docstr_tok: ["Loads","a",":","class",":","`","SnipsNLUEngine","`","instance","from","a","directory","path","The","data","at","the","given","path","must","have","been","generated","using",":","func",":","`","~SnipsNLUEngine.persist","`","Args",":","path","(","str",")",":","The","path","where","the","nlu","engine","is","stored","Raises",":","LoadingError",":","when","some","files","are","missing","IncompatibleModelError",":","when","trying","to","load","an","engine","model","which","is","not","compatible","with","the","current","version","of","the","lib"]
code: def from_path(cls, path, **shared):
      """Loads a :class:`SnipsNLUEngine` instance from a directory path
  
      The data at the given path must have been generated using
      :func:`~SnipsNLUEngine.persist`
  
      Args:
          path (str): The path where the nlu engine is stored
  
      Raises:
          LoadingError: when some files are missing
          IncompatibleModelError: when trying to load an engine model which
              is not compatible with the current version of the lib
      """
      directory_path = Path(path)
      model_path = directory_path / "nlu_engine.json"
      if not model_path.exists():
          raise LoadingError(
              "Missing nlu engine model file: %s" % model_path.name
          )
  
      with model_path.open(encoding="utf8") as f:
          model = json.load(f)
      model_version = model.get("model_version")
      if model_version is None or model_version != __model_version__:
          bypass_version_check = shared.get(BYPASS_VERSION_CHECK, False)
          if bypass_version_check:
              logger.warning(
                  "Incompatible model version found. The library expected "
                  "'%s' but the loaded engine is '%s'. The NLU engine may "
                  "not load correctly.",
                  __model_version__,
                  model_version,
              )
          else:
              raise IncompatibleModelError(model_version)
  
      dataset_metadata = model["dataset_metadata"]
      if shared.get(RESOURCES) is None and dataset_metadata is not None:
          language = dataset_metadata["language_code"]
          resources_dir = directory_path / "resources" / language
          if resources_dir.is_dir():
              resources = load_resources_from_dir(resources_dir)
              shared[RESOURCES] = resources
  
      if shared.get(BUILTIN_ENTITY_PARSER) is None:
          path = model["builtin_entity_parser"]
          if path is not None:
              parser_path = directory_path / path
              shared[
                  BUILTIN_ENTITY_PARSER
              ] = BuiltinEntityParser.from_path(parser_path)
  
      if shared.get(CUSTOM_ENTITY_PARSER) is None:
          path = model["custom_entity_parser"]
          if path is not None:
              parser_path = directory_path / path
              shared[
                  CUSTOM_ENTITY_PARSER
              ] = CustomEntityParser.from_path(parser_path)
  
      config = cls.config_type.from_dict(model["config"])
      nlu_engine = cls(config=config, **shared)
      nlu_engine.dataset_metadata = dataset_metadata
      intent_parsers = []
      for parser_idx, parser_name in enumerate(model["intent_parsers"]):
          parser_config = config.intent_parsers_configs[parser_idx]
          intent_parser_path = directory_path / parser_name
          intent_parser = IntentParser.load_from_path(
              intent_parser_path, parser_config.unit_name, **shared
          )
          intent_parsers.append(intent_parser)
      nlu_engine.intent_parsers = intent_parsers
      return nlu_engine
  
imports: from __future__ import unicode_literals
  import json
  import logging
  from builtins import str
  from collections import defaultdict
  from pathlib import Path
  from future.utils import iteritems, itervalues
  from snips_nlu.__about__ import __model_version__, __version__
  from snips_nlu.common.dataset_utils import get_slot_name_mappings
  from snips_nlu.common.log_utils import log_elapsed_time
  from snips_nlu.common.utils import check_persisted_path, fitted_required, json_string
  from snips_nlu.constants import AUTOMATICALLY_EXTENSIBLE, BUILTIN_ENTITY_PARSER, CUSTOM_ENTITY_PARSER, ENTITIES, ENTITY_KIND, LANGUAGE, RESOLVED_VALUE, RES_ENTITY, RES_INTENT, RES_INTENT_NAME, RES_MATCH_RANGE, RES_PROBA, RES_SLOTS, RES_VALUE, RESOURCES, BYPASS_VERSION_CHECK
  from snips_nlu.dataset import validate_and_format_dataset
  from snips_nlu.default_configs import DEFAULT_CONFIGS
  from snips_nlu.entity_parser import CustomEntityParser
  from snips_nlu.entity_parser.builtin_entity_parser import BuiltinEntityParser, is_builtin_entity
  from snips_nlu.exceptions import InvalidInputError, IntentNotFoundError, LoadingError, IncompatibleModelError
  from snips_nlu.intent_parser import IntentParser
  from snips_nlu.pipeline.configs import NLUEngineConfig
  from snips_nlu.pipeline.processing_unit import ProcessingUnit
  from snips_nlu.resources import load_resources_from_dir, persist_resources
  from snips_nlu.result import builtin_slot, custom_slot, empty_result, extraction_result, is_empty, parsing_result
label_desc: Use image node_id 9 for calling the SnipsNLUEngine obj's underlying member method code with example usage: obj.from_path(cls, path) and returns: nlu_engine