code: async def _rank_text(self, choices):
          
  
          tl = self.request.get_layer(l.RawText)
          best = 0.0
  
          for slug, params in choices.items():
              strings = []
  
              if params['intent']:
                  intent = getattr(intents, params['intent'])
                  strings += await intent.strings(self.request)
  
              if params['text']:
                  strings.append((params['text'],))
  
              matcher = Matcher([tuple(Trigram(y) for y in x) for x in strings])
              score = matcher % Trigram(await render(tl.text, self.request))
  
              if score > best:
                  self.chosen = params
                  self.slug = slug
                  best = score
  
          if self.when is None or self.slug == self.when:
              return best
docs: Try to match the TextLayer with choice's intents.