class_docstr: Extracts and encodes lexical syntactic features.
  
  Given a sequence of tokens, this featurizer produces a sequence of features
  where the `t`-th feature encodes lexical and syntactic information about the `t`-th
  token and it's surrounding tokens.
  
  In detail: The lexical syntactic features can be specified via a list of
  configurations `[c_0, c_1, ..., c_n]` where each `c_i` is a list of names of
  lexical and syntactic features (e.g. `low`, `suffix2`, `digit`).
  For a given tokenized text, the featurizer will consider a window of size `n`
  around each token and evaluate the given list of configurations as follows:
  - It will extract the features listed in `c_m` where `m = (n-1)/2` if n is even and
    `n/2` from token `t`
  - It will extract the features listed in `c_{m-1}`,`c_{m-2}` ... ,  from the last,
    second to last, ... token before token `t`, respectively.
  - It will extract the features listed `c_{m+1}`, `c_{m+1}`, ... for the first,
    second, ... token `t`, respectively.
  It will then combine all these features into one feature for position `t`.
  
  Example:
    If we specify `[['low'], ['upper'], ['prefix2']]`, then for each position `t`
    the `t`-th feature will encode whether the token at position `t` is upper case,
    where the token at position `t-1` is lower case and the first two characters
    of the token at position `t+1`.
docstr: Converts the raw features to one-hot encodings.
  
  Requires the "feature" to index dictionary, i.e. the featurizer must have
  been trained.
  
  Args:
    sentence_features: a list of feature dictionaries where the `t`-th feature
      dictionary maps a tuple containing
      - a position (in the window) and
      - a supported feature name
      to the raw feature value extracted from the window around the `t`-th token.
  
  Returns:
     a sparse matrix where the `i`-th row is a multi-hot vector that encodes the
     raw features extracted from the window around the `i`-th token
docstr_tok: ["Converts","the","raw","features","to","one-hot","encodings",".","Requires","the","``","feature","''","to","index","dictionary",",","i.e",".","the","featurizer","must","have","been","trained",".","Args",":","sentence_features",":","a","list","of","feature","dictionaries","where","the","`","t","`","-th","feature","dictionary","maps","a","tuple","containing","-","a","position","(","in","the","window",")","and","-","a","supported","feature","name","to","the","raw","feature","value","extracted","from","the","window","around","the","`","t","`","-th","token",".","Returns",":","a","sparse","matrix","where","the","`","i","`","-th","row","is","a","multi-hot","vector","that","encodes","the","raw","features","extracted","from","the","window","around","the","`","i","`","-th","token"]
code: def _map_raw_features_to_indices(
      self, sentence_features: List[Dict[Tuple[int, Text], Any]]
  ) -> scipy.sparse.coo_matrix:
      """Converts the raw features to one-hot encodings.
  
      Requires the "feature" to index dictionary, i.e. the featurizer must have
      been trained.
  
      Args:
        sentence_features: a list of feature dictionaries where the `t`-th feature
          dictionary maps a tuple containing
          - a position (in the window) and
          - a supported feature name
          to the raw feature value extracted from the window around the `t`-th token.
  
      Returns:
         a sparse matrix where the `i`-th row is a multi-hot vector that encodes the
         raw features extracted from the window around the `i`-th token
      """
      rows = []
      cols = []
      shape = (len(sentence_features), self._number_of_features)
      for token_idx, token_features in enumerate(sentence_features):
          for (
              position_and_feature_name,
              feature_value,
          ) in token_features.items():
              mapping = self._feature_to_idx_dict.get(
                  position_and_feature_name
              )
              if not mapping:
                  continue
              feature_idx = mapping.get(feature_value, -1)
              if feature_idx > -1:
                  rows.append(token_idx)
                  cols.append(feature_idx)
      data = np.ones(len(rows))
      return scipy.sparse.coo_matrix(
          (data, (np.array(rows), np.array(cols))), shape=shape
      )
  
imports: from __future__ import annotations
  import logging
  from collections import OrderedDict
  import scipy.sparse
  import numpy
  from typing import Any, Dict, Text, List, Tuple, Callable, Set, Optional, Type, Union
  from rasa.engine.graph import ExecutionContext, GraphComponent
  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.tokenizers.spacy_tokenizer import POS_TAG_KEY, SpacyTokenizer
  from rasa.nlu.tokenizers.tokenizer import Token, Tokenizer
  from rasa.nlu.featurizers.sparse_featurizer.sparse_featurizer import SparseFeaturizer
  from rasa.nlu.constants import TOKENS_NAMES
  from rasa.shared.constants import DOCS_URL_COMPONENTS
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.nlu.training_data.message import Message
  from rasa.shared.nlu.constants import TEXT
  from rasa.shared.exceptions import InvalidConfigException
  import rasa.shared.utils.io
  import rasa.utils.io
label_desc: Use image node_id 15 for calling the LexicalSyntacticFeaturizer obj's underlying member method code with example usage: obj._map_raw_features_to_indices(sentence_features) and returns: scipy