code: def crf_state_coef(crf):
      attr_index = {
          name: idx for idx, name in enumerate(crf.attributes_)
      }
      class_index = {
          cls_name: idx for idx, cls_name in enumerate(crf.classes_)
      }
  
      n_features = len(crf.attributes_)
      n_classes = len(crf.classes_)
      coef = sp.dok_matrix((n_classes, n_features))
  
      for (feat, cls), value in crf.state_features_.items():
          coef[class_index[cls], attr_index[feat]] = value
  
      return coef.tocsr()
  
file_path: eli5/eli5/sklearn_crfsuite/explain_weights.py
imports: from __future__ import absolute_import
  import numpy
  from scipy import sparse
  from sklearn_crfsuite import CRF
  from eli5.base import Explanation, TargetExplanation, TransitionFeatureWeights
  from eli5.explain import explain_weights
  from eli5.utils import get_target_display_names
  from eli5._feature_names import FeatureNames
  from eli5._feature_weights import get_top_features
label_desc: Use image node_id 2 for calling a global function with example usage: crf_state_coef(crf) and returns: coef