class_docstr: Latin Decliner based on Collatinus data and approach to declining words for Latin
  
  .. code-block:: python
  
     # Ensure you have downloaded the corpus latin_models_cltk before running this
     from cltk.stem.lat.declension import CollatinusDecliner
  
     decliner = CollatinusDecliner()
     print(decliner.decline("via"))
  
      [
          ('via', '--s----n-'), ('via', '--s----v-'), ('viam', '--s----a-'), ('viae', '--s----g-'),
          ('viae', '--s----d-'), ('via', '--s----b-'), ('viae', '--p----n-'), ('viae', '--p----v-'),
          ('vias', '--p----a-'), ('viarum', '--p----g-'), ('viis', '--p----d-'), ('viis', '--p----b-')
      ]
class_docstr_tok: ["Latin","Decliner","based","on","Collatinus","data","and","approach","to","declining","words","for","Latin","..","code-block",":",":","python","#","Ensure","you","have","downloaded","the","corpus","latin_models_cltk","before","running","this","from","cltk.stem.lat.declension","import","CollatinusDecliner","decliner","=","CollatinusDecliner","(",")","print","(","decliner.decline","(","``","via","''",")",")","[","(","'via","'",",","'","--","s","--","--","n-","'",")",",","(","'via","'",",","'","--","s","--","--","v-","'",")",",","(","'viam","'",",","'","--","s","--","--","a-","'",")",",","(","'viae","'",",","'","--","s","--","--","g-","'",")",",","(","'viae","'",",","'","--","s","--","--","d-","'",")",",","(","'via","'",",","'","--","s","--","--","b-","'",")",",","(","'viae","'",",","'","--","p","--","--","n-","'",")",",","(","'viae","'",",","'","--","p","--","--","v-","'",")",",","(","'vias","'",",","'","--","p","--","--","a-","'",")",",","(","'viarum","'",",","'","--","p","--","--","g-","'",")",",","(","'viis","'",",","'","--","p","--","--","d-","'",")",",","(","'viis","'",",","'","--","p","--","--","b-","'",")","]"]
docstr: Decline a lemma
  
  .. warning:: POS are incomplete as we do not detect the type outside of verbs, participle and adjective.
  
  :raise CLTKException: When the lemma is unknown to our data
  
  :param lemma: Lemma (Canonical form) to decline
  :type lemma: str
  :param flatten: If set to True, returns a list of forms without natural language information about them
  :type flatten: bool
  :param collatinus_dict: If sets to True, Dictionary of grammatically valid forms, including variants, with keys         corresponding to morpho informations.
  :type collatinus_dict: bool
  :return: List of tuple where first value is the form and second the pos, ie [("sum", "v1ppip---")]
  :rtype: list or dict
docstr_tok: ["Decline","a","lemma","..","warning",":",":","POS","are","incomplete","as","we","do","not","detect","the","type","outside","of","verbs",",","participle","and","adjective",".",":","raise","CLTKException",":","When","the","lemma","is","unknown","to","our","data",":","param","lemma",":","Lemma","(","Canonical","form",")","to","decline",":","type","lemma",":","str",":","param","flatten",":","If","set","to","True",",","returns","a","list","of","forms","without","natural","language","information","about","them",":","type","flatten",":","bool",":","param","collatinus_dict",":","If","sets","to","True",",","Dictionary","of","grammatically","valid","forms",",","including","variants",",","with","keys","corresponding","to","morpho","informations",".",":","type","collatinus_dict",":","bool",":","return",":","List","of","tuple","where","first","value","is","the","form","and","second","the","pos",",","ie","[","(","``","sum","''",",","``","v1ppip","--","-","''",")","]",":","rtype",":","list","or","dict"]
code: def decline(
      self,
      lemma: str,
      flatten: bool = False,
      collatinus_dict: bool = False,
  ) -> List[Tuple[str, str]]:
      """ Decline a lemma
  
          .. warning:: POS are incomplete as we do not detect the type outside of verbs, participle and adjective.
  
          :raise CLTKException: When the lemma is unknown to our data
  
          :param lemma: Lemma (Canonical form) to decline
          :type lemma: str
          :param flatten: If set to True, returns a list of forms without natural language information about them
          :type flatten: bool
          :param collatinus_dict: If sets to True, Dictionary of grammatically valid forms, including variants, with keys\
           corresponding to morpho informations.
          :type collatinus_dict: bool
          :return: List of tuple where first value is the form and second the pos, ie [("sum", "v1ppip---")]
          :rtype: list or dict
  
          """
  
      if lemma in self._lemmas:
          # Get data information
          lemma_entry = self._lemmas[lemma]
      elif (
          lemma in self._mapped and self._mapped[lemma] in self._lemmas
      ):
          # Get data information
          lemma = self._mapped[lemma]
          lemma_entry = self._lemmas[self._mapped[lemma]]
      else:
          raise CLTKException("%s is unknown" % lemma)
      model = self._models[lemma_entry["model"]]
  
      # Get the roots
      roots = self._getRoots(lemma, model=model)
      # Get the known forms in order
      keys = sorted([int(key) for key in model["des"].keys()])
      forms_data = [(key, model["des"][str(key)]) for key in keys]
  
      # Generate the return dict
      forms = {key: [] for key in keys}
      for key, form_list in forms_data:
          for form in form_list:
              root_id, endings = tuple(form)
              for root in roots[root_id]:
                  for ending in endings:
                      forms[key].append(root + ending)
  
      # sufd means we have the original forms of the parent but we add a suffix
      if len(model["sufd"]):
          # For each constant form1
          for key, iter_forms in forms.items():
              new_forms = []
              # We add the constant suffix
              for sufd in model["sufd"]:
                  new_forms += [form + sufd for form in iter_forms]
              forms[key] = new_forms
  
      # If we need a secure version of the forms. For example, if we have variants
      if len(model["suf"]):
          cached_forms = {
              k: v + [] for k, v in forms.items()
          }  # Making cache without using copy
  
          # For each suffix
          # The format is [suffix characters, [modified forms]]
          for suffixes in model["suf"]:
              suffix, modified_forms = suffixes[0], suffixes[1]
              for modified_form in modified_forms:
                  forms[modified_form] += [
                      f + suffix for f in cached_forms[modified_form]
                  ]
          # We update with the new roots
  
      # If some form do not exist, we delete them prehentively
      if len(model["abs"]):
          for abs_form in model["abs"]:
              if abs_form in forms:
                  del forms[abs_form]
  
      if flatten:
          return list(
              [
                  form
                  for case_forms in forms.values()
                  for form in case_forms
              ]
          )
      elif collatinus_dict:
          return forms
      else:
          return list(
              [
                  (form, self.__getPOS(key))
                  for key, case_forms in forms.items()
                  for form in case_forms
              ]
          )
  
file_path: cltk/src/cltk/morphology/lat.py
imports: import json
  import os
  import re
  from typing import Dict, List, Tuple
  from cltk.core.exceptions import CLTKException
  from cltk.utils import CLTK_DATA_DIR
label_desc: Use image node_id 5 for calling the CollatinusDecliner obj's underlying member method code with example usage: obj.decline(lemma, flatten, collatinus_dict) and returns: list, forms, list