class_docstr: Spanish rule-based lemmatizer with morph-based rule selection.
class_docstr_tok: ["Spanish","rule-based","lemmatizer","with","morph-based","rule","selection","."]
code: def rule_lemmatize(self, token: Token) -> List[str]:
      cache_key = (token.orth, token.pos, str(token.morph))
      if cache_key in self.cache:
          return self.cache[cache_key]
      string = token.text
      pos = token.pos_.lower()
      features = set(token.morph)
      if pos in ("", "eol", "space"):
          return [string.lower()]
      if pos in (
          "adp",
          "cconj",
          "intj",
          "part",
          "propn",
          "punct",
          "sconj",
          "sym",
          "x",
      ):
          if token.is_sent_start and pos != "propn":
              return [string.lower()]
          else:
              return [string]
  
      string = string.lower()
      exc = self.lookups.get_table("lemma_exc").get(pos, {}).get(string)
      if exc is not None:
          lemmas = list(exc)
      else:
          if pos == "aux":
              rule_pos = "verb"
          else:
              rule_pos = pos
          rule = self.select_rule(rule_pos, list(features))
          index = self.lookups.get_table("lemma_index").get(
              rule_pos, []
          )
          lemmas = getattr(self, "lemmatize_" + rule_pos)(
              string, features, rule, index
          )
          # Remove duplicates but preserve the ordering
          lemmas = list(dict.fromkeys(lemmas))
  
      self.cache[cache_key] = lemmas
      return lemmas
  
file_path: spaCy/spacy/lang/es/lemmatizer.py
imports: import re
  from typing import List, Optional, Tuple
  from ...pipeline import Lemmatizer
  from ...tokens import Token
label_desc: Use image node_id 2 for calling the SpanishLemmatizer obj's underlying member method code with example usage: obj.rule_lemmatize(token) and returns: lemmas, self, list, list, list