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: Performs intent parsing on the provided *text* by calling its intent
  parsers successively
  
  Args:
      text (str): Input
      intents (str or list of str, optional): If provided, reduces the
          scope of intent parsing to the provided list of intents.
          The ``None`` intent is never filtered out, meaning that it can
          be returned even when using an intents scope.
      top_n (int, optional): when provided, this method will return a
          list of at most ``top_n`` most likely intents, instead of a
          single parsing result.
          Note that the returned list can contain less than ``top_n``
          elements, for instance when the parameter ``intents`` is not
          None, or when ``top_n`` is greater than the total number of
          intents.
  
  Returns:
      dict or list: the most likely intent(s) along with the extracted
      slots. See :func:`.parsing_result` and :func:`.extraction_result`
      for the output format.
  
  Raises:
      NotTrained: When the nlu engine is not fitted
      InvalidInputError: When input type is not unicode
docstr_tok: ["Performs","intent","parsing","on","the","provided","*","text","*","by","calling","its","intent","parsers","successively","Args",":","text","(","str",")",":","Input","intents","(","str","or","list","of","str",",","optional",")",":","If","provided",",","reduces","the","scope","of","intent","parsing","to","the","provided","list","of","intents",".","The","``","None","``","intent","is","never","filtered","out",",","meaning","that","it","can","be","returned","even","when","using","an","intents","scope",".","top_n","(","int",",","optional",")",":","when","provided",",","this","method","will","return","a","list","of","at","most","``","top_n","``","most","likely","intents",",","instead","of","a","single","parsing","result",".","Note","that","the","returned","list","can","contain","less","than","``","top_n","``","elements",",","for","instance","when","the","parameter","``","intents","``","is","not","None",",","or","when","``","top_n","``","is","greater","than","the","total","number","of","intents",".","Returns",":","dict","or","list",":","the","most","likely","intent","(","s",")","along","with","the","extracted","slots",".","See",":","func",":","`",".parsing_result","`","and",":","func",":","`",".extraction_result","`","for","the","output","format",".","Raises",":","NotTrained",":","When","the","nlu","engine","is","not","fitted","InvalidInputError",":","When","input","type","is","not","unicode"]
code: def parse(self, text, intents=None, top_n=None):
      """Performs intent parsing on the provided *text* by calling its intent
      parsers successively
  
      Args:
          text (str): Input
          intents (str or list of str, optional): If provided, reduces the
              scope of intent parsing to the provided list of intents.
              The ``None`` intent is never filtered out, meaning that it can
              be returned even when using an intents scope.
          top_n (int, optional): when provided, this method will return a
              list of at most ``top_n`` most likely intents, instead of a
              single parsing result.
              Note that the returned list can contain less than ``top_n``
              elements, for instance when the parameter ``intents`` is not
              None, or when ``top_n`` is greater than the total number of
              intents.
  
      Returns:
          dict or list: the most likely intent(s) along with the extracted
          slots. See :func:`.parsing_result` and :func:`.extraction_result`
          for the output format.
  
      Raises:
          NotTrained: When the nlu engine is not fitted
          InvalidInputError: When input type is not unicode
      """
      if not isinstance(text, str):
          raise InvalidInputError(
              "Expected unicode but received: %s" % type(text)
          )
  
      if isinstance(intents, str):
          intents = {intents}
      elif isinstance(intents, list):
          intents = set(intents)
  
      if intents is not None:
          for intent in intents:
              if (
                  intent
                  not in self.dataset_metadata["slot_name_mappings"]
              ):
                  raise IntentNotFoundError(intent)
  
      if top_n is None:
          none_proba = 0.0
          for parser in self.intent_parsers:
              res = parser.parse(text, intents)
              if is_empty(res):
                  none_proba = res[RES_INTENT][RES_PROBA]
                  continue
              resolved_slots = self._resolve_slots(text, res[RES_SLOTS])
              return parsing_result(
                  text, intent=res[RES_INTENT], slots=resolved_slots
              )
          return empty_result(text, none_proba)
  
      intents_results = self.get_intents(text)
      if intents is not None:
          intents_results = [
              res
              for res in intents_results
              if res[RES_INTENT_NAME] is None
              or res[RES_INTENT_NAME] in intents
          ]
      intents_results = intents_results[:top_n]
      results = []
      for intent_res in intents_results:
          slots = self.get_slots(text, intent_res[RES_INTENT_NAME])
          results.append(extraction_result(intent_res, slots))
      return results
  
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 5 for calling the SnipsNLUEngine obj's underlying member method code with example usage: obj.parse(text, intents, top_n) and returns: results, empty_result, parsing_result