class_docstr: Spanish rule-based lemmatizer with morph-based rule selection.
class_docstr_tok: ["Spanish","rule-based","lemmatizer","with","morph-based","rule","selection","."]
docstr: Lemmatize an adjective.
  
  word (str): The word to lemmatize.
  features (List[str]): The morphological features as a list of Feat=Val
      pairs.
  index (List[str]): The POS-specific lookup list.
  
  RETURNS (List[str]): The list of lemmas.
docstr_tok: ["Lemmatize","an","adjective",".","word","(","str",")",":","The","word","to","lemmatize",".","features","(","List","[","str","]",")",":","The","morphological","features","as","a","list","of","Feat=Val","pairs",".","index","(","List","[","str","]",")",":","The","POS-specific","lookup","list",".","RETURNS","(","List","[","str","]",")",":","The","list","of","lemmas","."]
code: def lemmatize_adj(
      self, word: str, features: List[str], rule: str, index: List[str]
  ) -> List[str]:
      """
      Lemmatize an adjective.
  
      word (str): The word to lemmatize.
      features (List[str]): The morphological features as a list of Feat=Val
          pairs.
      index (List[str]): The POS-specific lookup list.
  
      RETURNS (List[str]): The list of lemmas.
      """
  
      # Initialize empty lists for the generated lemmas
      possible_lemmas = []
      selected_lemmas = []
  
      # Apply lemmatization rules
      for old, new in self.lookups.get_table("lemma_rules").get(
          rule, []
      ):
          possible_lemma = re.sub(old + "$", new, word)
          if possible_lemma != word:
              possible_lemmas.append(possible_lemma)
  
      # Additional rule for plurals that go from esdrújula to grave and end in
      # 'n' or 's', e.g., jóvenes -> joven
      additional_lemmas = []
      if "Number=Plur" in features:
          for possible_lemma in possible_lemmas:
              if possible_lemma.endswith(
                  "n"
              ) or possible_lemma.endswith("s"):
                  for old, new in self.lookups.get_table(
                      "lemma_rules"
                  ).get("accents", []):
                      additional_lemmas.append(
                          re.sub(old, new, possible_lemma)
                      )
      possible_lemmas.extend(additional_lemmas)
  
      for lemma in possible_lemmas:
          if lemma in index:
              selected_lemmas.append(lemma)
      # If one or more of the created possible lemmas are in the lookup list,
      # return all of them
      if len(selected_lemmas) > 0:
          return selected_lemmas
      elif len(possible_lemmas) > 0:
          return possible_lemmas
      else:
          return [word]
  
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 4 for calling the SpanishLemmatizer obj's underlying member method code with example usage: obj.lemmatize_adj(word, features, rule, index) and returns: selected_lemmas, possible_lemmas, list