def write_corpus_as_lines(dataset, filepath):
    """
    Take Dataset or corpus, split it into lines, and write it to `filepath`.
    Return the total number of lines, and max length line.
    """
    total_sentence_count = 0
    maxlen = 0
    with open(filepath, 'w') as f:
        for entry in dataset:
            if isinstance(entry, dict):
                entry = entry['text']
            lines = entry.strip().split('\n')
            for line in lines:
                sentences = line.split('.')
                total_sentence_count += len(sentences)
                for sentence in sentences:
                    maxlen = max(len(line), maxlen)
                    f.write(sentence+'.\n')
    return total_sentence_count, maxlen