code: def build(cls, dataset, parser_usage, resources):
      from snips_nlu_parsers import GazetteerEntityParser
      from snips_nlu.dataset import validate_and_format_dataset
  
      dataset = validate_and_format_dataset(dataset)
      language = dataset[LANGUAGE]
      custom_entities = {
          entity_name: deepcopy(entity)
          for entity_name, entity in iteritems(dataset[ENTITIES])
          if not is_builtin_entity(entity_name)
      }
      if parser_usage == CustomEntityParserUsage.WITH_AND_WITHOUT_STEMS:
          for ent in viewvalues(custom_entities):
              stemmed_utterances = _stem_entity_utterances(
                  ent[UTTERANCES], language, resources
              )
              ent[UTTERANCES] = _merge_entity_utterances(
                  ent[UTTERANCES], stemmed_utterances
              )
      elif parser_usage == CustomEntityParserUsage.WITH_STEMS:
          for ent in viewvalues(custom_entities):
              ent[UTTERANCES] = _stem_entity_utterances(
                  ent[UTTERANCES], language, resources
              )
      elif parser_usage is None:
          raise ValueError(
              "A parser usage must be defined in order to fit "
              "a CustomEntityParser"
          )
      configuration = _create_custom_entity_parser_configuration(
          custom_entities,
          language=dataset[LANGUAGE],
          stopwords_fraction=STOPWORDS_FRACTION,
      )
      parser = GazetteerEntityParser.build(configuration)
      return cls(parser, language, parser_usage)
  
imports: from __future__ import unicode_literals
  import json
  import operator
  from copy import deepcopy
  from pathlib import Path
  from future.utils import iteritems, viewvalues
  from snips_nlu.common.utils import json_string
  from snips_nlu.constants import END, ENTITIES, LANGUAGE, MATCHING_STRICTNESS, START, UTTERANCES, LICENSE_INFO
  from snips_nlu.entity_parser.builtin_entity_parser import is_builtin_entity
  from snips_nlu.entity_parser.custom_entity_parser_usage import CustomEntityParserUsage
  from snips_nlu.entity_parser.entity_parser import EntityParser
  from snips_nlu.preprocessing import stem, tokenize, tokenize_light
  from snips_nlu.result import parsed_entity
label_desc: Use image node_id 5 for calling the CustomEntityParser obj's underlying member method code with example usage: obj.build(cls, dataset, parser_usage, resources) and returns: cls