code: def extract_intent_entities(dataset, entity_filter=None):
      intent_entities = {intent: set() for intent in dataset[INTENTS]}
      for intent_name, intent_data in iteritems(dataset[INTENTS]):
          for utterance in intent_data[UTTERANCES]:
              for chunk in utterance[DATA]:
                  if ENTITY in chunk:
                      if entity_filter and not entity_filter(
                          chunk[ENTITY]
                      ):
                          continue
                      intent_entities[intent_name].add(chunk[ENTITY])
      return intent_entities
  
file_path: snips-nlu/snips_nlu/dataset/utils.py
imports: from __future__ import unicode_literals
  from future.utils import iteritems, itervalues
  from snips_nlu.constants import DATA, ENTITIES, ENTITY, INTENTS, TEXT, UTTERANCES
  from snips_nlu.entity_parser.builtin_entity_parser import is_gazetteer_entity
label_desc: Use image node_id 2 for calling a global function with example usage: extract_intent_entities(dataset, entity_filter) and returns: intent_entities