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: Takes the N-Grams.
  
  Args:
      walk: The walk.
  
  Returns:
      The N-Grams.
docstr_tok: ["Takes","the","N-Grams",".","Args",":","walk",":","The","walk",".","Returns",":","The","N-Grams","."]
code: def _take_n_grams(self, walk: Walk) -> List[str]:
      """Takes the N-Grams.
  
      Args:
          walk: The walk.
  
      Returns:
          The N-Grams.
  
      """
      n_gram_walk = []
      for i, vertex in enumerate(walk):
          if i == 0 or i % 2 == 1 or i < self.grams:
              n_gram_walk.append(vertex.name)
          else:
              n_gram = tuple(
                  walk[j].name
                  for j in range(max(0, i - (self.grams - 1)), i + 1)
              )
              if n_gram not in self._n_gram_map:
                  self._n_gram_map[n_gram] = str(len(self._n_gram_map))
              n_gram_walk.append(self._n_gram_map[n_gram])
      return n_gram_walk
  
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 1 for calling the NGramWalker obj's underlying member method code with example usage: obj._take_n_grams(walk) and returns: n_gram_walk