class_docstr: N-Gram walking strategy which relabels the n-grams in random walks to
  define a mapping from one-to-many. The intuition behind this is that the
  predecessors of a node that two different walks have in common can be
  different.
  
  Attributes:
      _is_support_remote: True if the walking strategy can be used with a
          remote Knowledge Graph, False Otherwise
          Defaults to True.
      _n_gram_map: Stores the mapping of N-gram.
          Defaults to {}.
      grams: The N-gram to relabel.
          Defaults to 3.
      kg: The global KG used later on for the worker process.
          Defaults to None.
      max_depth: The maximum depth of one walk.
      max_walks: The maximum number of walks per entity.
          Defaults to None.
      random_state: The random state to use to keep random determinism with
          the walking strategy.
          Defaults to None.
      sampler: The sampling strategy.
          Defaults to UniformSampler.
      wildcards: The wildcards to be used to match sub-sequences with small
          differences to be mapped onto the same label.
          Defaults to None.
docstr: Extracts random walks for an entity based on a Knowledge Graph.
  
  Args:
      kg: The Knowledge Graph.
      entity: The root node to extract walks.
  
  Returns:
      A dictionary having the entity as key and a list of tuples as value
      corresponding to the extracted walks.
docstr_tok: ["Extracts","random","walks","for","an","entity","based","on","a","Knowledge","Graph",".","Args",":","kg",":","The","Knowledge","Graph",".","entity",":","The","root","node","to","extract","walks",".","Returns",":","A","dictionary","having","the","entity","as","key","and","a","list","of","tuples","as","value","corresponding","to","the","extracted","walks","."]
code: def _extract(self, kg: KG, entity: Vertex) -> EntityWalks:
      """Extracts random walks for an entity based on a Knowledge Graph.
  
      Args:
          kg: The Knowledge Graph.
          entity: The root node to extract walks.
  
      Returns:
          A dictionary having the entity as key and a list of tuples as value
          corresponding to the extracted walks.
  
      """
      canonical_walks: Set[SWalk] = set()
      for walk in self.extract_walks(kg, entity):
          canonical_walks.add(tuple(self._take_n_grams(walk)))
  
          # Introduce wild-cards and re-calculate n-grams
          if self.wildcards is None:
              continue
  
          for wildcard in self.wildcards:
              for idx in itertools.combinations(
                  range(1, len(walk)), wildcard
              ):
                  new_walk = list(walk).copy()
                  for ix in idx:
                      new_walk[ix] = Vertex("*")
                  canonical_walks.add(
                      tuple(self._take_n_grams(new_walk))  # type: ignore
                  )
      return {entity.name: list(canonical_walks)}
  
file_path: pyRDF2Vec/pyrdf2vec/walkers/ngram.py
imports: import itertools
  from typing import Dict, List, Optional, Set, Tuple
  import attr
  from pyrdf2vec.graphs import KG, Vertex
  from pyrdf2vec.typings import EntityWalks, SWalk, Walk
  from pyrdf2vec.walkers import RandomWalker
label_desc: Use image node_id 2 for calling the NGramWalker obj's underlying member method code with example usage: obj._extract(kg, entity) and returns: dict