Open Rahulvks opened 7 years ago
The error is in the read_langs function. Just use this lines = open('/Users/dsg281/Downloads/fra-eng/%s-%s.txt' % (lang1, lang2)).read().strip().split('\n')
Anyway, this is basic python, you should ask in stackoverflow not in the repo issue.
def prepare_data(lang1_name, lang2_name, reverse=False): input_lang, output_lang, pairs = read_langs(lang1_name, lang2_name, reverse) print("Read %s sentence pairs" % len(pairs))
input_lang, output_lang, pairs = prepare_data('eng', 'fra', True)
Print an example pair
print(random.choice(pairs))