def normalize_sent(r, sent_len, avg_len):
    """
  normalizes the ranking of sentences
  based on effect of their length on ranking
  also reduces chances that noisy short sentences that might have
  passed through the NLP toolkit make it into summaries or answers
  """
    if not r:
        r = 0
    if sent_len > 2 * avg_len or sent_len < min(5, avg_len / 4):
        return 0
    factor = 1 / (1 + abs(sent_len - avg_len) + sent_len)
    return r * factor
