(file_path, source)
return data
Read file, where each sentence is dilineated by a `\n`.
    @param file_path (str): path to file containing corpus
    @param source (str): "tgt" or "src" indicating whether text
        is of the source language or target language
Read file, where each sentence is dilineated by a `\n`.
Read file where each sentence is dilineated by a \ n .
def read_corpus(file_path, source):
    """ Read file, where each sentence is dilineated by a `\n`.
    @param file_path (str): path to file containing corpus
    @param source (str): "tgt" or "src" indicating whether text
        is of the source language or target language
    """
    data = []
    for line in open(file_path):
        sent = nltk.word_tokenize(line)
        # only append <s> and </s> to the target sentence
        if source == 'tgt':
            sent = ['<s>'] + sent + ['</s>']
        data.append(sent)

    return data
def read_corpus ( file_path , source ) : data = [ ] for line in open ( file_path ) : sent = nltk . word_tokenize ( line ) # only append <s> and </s> to the target sentence if source == 'tgt' : sent = [ '<s>' ] + sent + [ '</s>' ] data . append ( sent ) return data