#NEWLINE# def get_wmt_enfr_train_set( directory ) : #NEWLINE# #INDENT# "Download the WMT en-fr training corpus to directory unless it's there." #NEWLINE# train_path = os . path . join ( directory , 'giga-fren.release2' ) #NEWLINE# if ( not ( gfile . Exists ( ( train_path + '.fr' ) ) and gfile . Exists ( ( train_path + '.en' ) ) ) ) : #NEWLINE# #INDENT# corpus_file = maybe_download ( directory , 'training-giga-fren.tar' , _WMT_ENFR_TRAIN_URL ) #NEWLINE# print ( ( 'Extracting tar file %s' % corpus_file ) ) #NEWLINE# with tarfile . open ( corpus_file , 'r' ) as corpus_tar : #NEWLINE# #INDENT# corpus_tar . extractall ( directory ) #NEWLINE# #UNINDENT# gunzip_file ( ( train_path + '.fr.gz' ) , ( train_path + '.fr' ) ) #NEWLINE# gunzip_file ( ( train_path + '.en.gz' ) , ( train_path + '.en' ) ) #NEWLINE# #UNINDENT# return train_path