class_docstr: Currently supports validation for: hexameter, hendecasyllables, pentameter.
class_docstr_tok: ["Currently","supports","validation","for",":","hexameter",",","hendecasyllables",",","pentameter","."]
docstr: Find the closest group of matching valid patterns.
  
  :patterns: a list of patterns
  :scansion: the scansion pattern thus far
  :return: list of the closest valid patterns; only candidates with a matching length/number of syllables are considered.
docstr_tok: ["Find","the","closest","group","of","matching","valid","patterns",".",":","patterns",":","a","list","of","patterns",":","scansion",":","the","scansion","pattern","thus","far",":","return",":","list","of","the","closest","valid","patterns",";","only","candidates","with","a","matching","length\/number","of","syllables","are","considered","."]
code: def _closest_patterns(
      self, patterns: List[str], scansion: str
  ) -> List[str]:
      """
      Find the closest group of matching valid patterns.
  
      :patterns: a list of patterns
      :scansion: the scansion pattern thus far
      :return: list of the closest valid patterns; only candidates with a matching length/number of syllables are considered.
      """
      pattern = scansion.replace(" ", "")
      pattern = pattern.replace(self.constants.FOOT_SEPARATOR, "")
      ending = pattern[-1]
      candidate = (
          pattern[: len(pattern) - 1] + self.constants.OPTIONAL_ENDING
      )
      cans = [
          (DamerauLevenshtein.distance(candidate, x), x)
          for x in patterns
          if len(x) == len(candidate)
      ]
      if cans:
          cans = sorted(cans, key=lambda tup: tup[0])
          top = cans[0][0]
          return [can[1][:-1] + ending for can in cans if can[0] == top]
      return []
  
file_path: cltk/src/cltk/prosody/lat/metrical_validator.py
imports: import logging
  from typing import List
  from rapidfuzz.distance import DamerauLevenshtein
  from cltk.prosody.lat.scansion_constants import ScansionConstants
label_desc: Use image node_id 12 for calling the MetricalValidator obj's underlying member method code with example usage: obj._closest_patterns(patterns, scansion) and returns: list, unknown