class_docstr: Implements conditional random fields (CRF) to do named entity recognition.
class_docstr_tok: ["Implements","conditional","random","fields","(","CRF",")","to","do","named","entity","recognition","."]
docstr: Loads trained component (see parent class for full docstring).
docstr_tok: ["Loads","trained","component","(","see","parent","class","for","full","docstring",")","."]
code: def load(
      cls,
      config: Dict[Text, Any],
      model_storage: ModelStorage,
      resource: Resource,
      execution_context: ExecutionContext,
      **kwargs: Any,
  ) -> CRFEntityExtractor:
      """Loads trained component (see parent class for full docstring)."""
      import joblib
  
      try:
          entity_taggers = OrderedDict()
          with model_storage.read_from(resource) as model_dir:
              # We have to load in the same order as we persisted things as otherwise
              # the predictions might be off
              file_names = sorted(model_dir.glob("**/*.pkl"))
              if not file_names:
                  logger.debug(
                      "Failed to load model for 'CRFEntityExtractor'. "
                      "Maybe you did not provide enough training data and "
                      "no model was trained."
                  )
                  return cls(config, model_storage, resource)
  
              for file_name in file_names:
                  name = file_name.stem[1:]
                  entity_taggers[name] = joblib.load(file_name)
  
              return cls(
                  config, model_storage, resource, entity_taggers
              )
      except ValueError:
          logger.warning(
              f"Failed to load {cls.__name__} from model storage. Resource "
              f"'{resource.name}' doesn't exist."
          )
          return cls(config, model_storage, resource)
  
imports: from __future__ import annotations
  from collections import OrderedDict
  from enum import Enum
  import logging
  import typing
  import numpy
  from typing import Any, Dict, List, Optional, Text, Tuple, Callable, Type
  import rasa.nlu.utils.bilou_utils
  import rasa.shared.utils.io
  import rasa.utils.train_utils
  from rasa.engine.graph import GraphComponent, ExecutionContext
  from rasa.engine.recipes.default_recipe import DefaultV1Recipe
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
  from rasa.nlu.test import determine_token_labels
  from rasa.nlu.tokenizers.spacy_tokenizer import POS_TAG_KEY
  from rasa.nlu.extractors.extractor import EntityExtractorMixin
  from rasa.nlu.tokenizers.tokenizer import Token, Tokenizer
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.nlu.training_data.message import Message
  from rasa.nlu.constants import TOKENS_NAMES
  from rasa.shared.nlu.constants import TEXT, ENTITIES, ENTITY_ATTRIBUTE_TYPE, ENTITY_ATTRIBUTE_GROUP, ENTITY_ATTRIBUTE_ROLE, NO_ENTITY_TAG, SPLIT_ENTITIES_BY_COMMA, SPLIT_ENTITIES_BY_COMMA_DEFAULT_VALUE
  from rasa.shared.constants import DOCS_URL_COMPONENTS
  from rasa.utils.tensorflow.constants import BILOU_FLAG, FEATURIZERS
label_desc: Use image node_id 14 for calling the CRFEntityExtractor obj's underlying member method code with example usage: obj.load(cls, config, model_storage, resource, execution_context) and returns: cls, cls, cls