class_docstr: Reader for NLU training data.
docstr: Extract an entity from a chunk if present.
docstr_tok: ["Extract","an","entity","from","a","chunk","if","present","."]
code: def _extract_entity(
      chunk: Dict[Text, Any], current_offset: int
  ) -> Optional[Dict[Text, Any]]:
      """Extract an entity from a chunk if present."""
      entity = None
      if "meta" in chunk or "alias" in chunk:
          start = current_offset
          text = chunk["text"]
          end = start + len(text)
          entity_type = chunk.get("alias", chunk["meta"])
          if entity_type != "@sys.ignore":
              entity = rasa.shared.nlu.training_data.util.build_entity(
                  start, end, text, entity_type
              )
  
      return entity
  
imports: import logging
  import os
  from pathlib import Path
  from typing import Any, Dict, Optional, Text, List, Tuple, Union
  import rasa.shared.nlu.training_data.util
  from rasa.shared.constants import DOCS_BASE_URL
  from rasa.shared.nlu.training_data.formats.readerwriter import TrainingDataReader
  from rasa.shared.nlu.training_data.util import transform_entity_synonyms
  import rasa.shared.utils.io
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.nlu.training_data.message import Message
label_desc: Use image node_id 4 for calling the DialogflowReader obj's underlying member method code with example usage: obj._extract_entity(chunk, current_offset) and returns: entity