Skip to content

Instantly share code, notes, and snippets.

@eileen-code4fun
Created January 21, 2022 06:01
Show Gist options
  • Save eileen-code4fun/df99a7cef8e10e8a7c79b6dc2314d928 to your computer and use it in GitHub Desktop.
Save eileen-code4fun/df99a7cef8e10e8a7c79b6dc2314d928 to your computer and use it in GitHub Desktop.
Translation Load
import tensorflow as tf
def split(text):
parts = tf.strings.split(text, sep='\t')
return parts[0], parts[1]
dataset = tf.data.TextLineDataset(['spa.txt']).map(split)
eng_dataset = dataset.map(lambda eng, spa : eng)
spa_dataset = dataset.map(lambda eng, spa : spa)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment