def clean_line(self, line):
    """Clean a line with some regex rules.

    Args:
      line: string, line to be processed and returned

    Returns:
      string
    """

    line = line.lower()
    line = re.sub("[^a-z .!?'\t\\\\]", '', line)
    line = re.sub("\\\\['] ", " '", line)
    line = re.sub('[\\\\]', ' ', line)
    line = re.sub('[.]', ' . ', line)
    line = re.sub('[?]', ' ? ', line)
    line = re.sub('[!]', ' ! ', line)
    line = re.sub("[ ]'[ ]", ' ', line)
    line = re.sub("n't", " n't", line)

    return line
Clean a line with some regex rules.

    Args:
      line: string, line to be processed and returned

    Returns:
      string
    
tensor2tensor/data_generators/dialog_opensubtitles.py