def get_wmt_enfr_dev_set(directory):
 dev_name = 'newstest2013'
 dev_path = os.path.join(directory, dev_name)
 if (not (gfile.Exists((dev_path + '.fr')) and gfile.Exists((dev_path + '.en')))):
  dev_file = maybe_download(directory, 'dev-v2.tgz', _WMT_ENFR_DEV_URL)
  print(('Extracting tgz file %s' % dev_file))
  with tarfile.open(dev_file, 'r:gz') as dev_tar:
   fr_dev_file = dev_tar.getmember((('dev/' + dev_name) + '.fr'))
   en_dev_file = dev_tar.getmember((('dev/' + dev_name) + '.en'))
   fr_dev_file.name = (dev_name + '.fr')
   en_dev_file.name = (dev_name + '.en')
   dev_tar.extract(fr_dev_file, directory)
   dev_tar.extract(en_dev_file, directory)
 return dev_path

def get_wmt_enfr_dev_set ( directory ) : dev_name = 'newstest2013' dev_path = os . path . join ( directory , dev_name ) if ( not ( gfile . Exists ( ( dev_path + '.fr' ) ) and gfile . Exists ( ( dev_path + '.en' ) ) ) ) : dev_file = maybe_download ( directory , 'dev-v2.tgz' , _WMT_ENFR_DEV_URL ) print ( ( 'Extracting tgz file %s' % dev_file ) ) with tarfile . open ( dev_file , 'r:gz' ) as dev_tar : fr_dev_file = dev_tar . getmember ( ( ( 'dev/' + dev_name ) + '.fr' ) ) en_dev_file = dev_tar . getmember ( ( ( 'dev/' + dev_name ) + '.en' ) ) fr_dev_file . name = ( dev_name + '.fr' ) en_dev_file . name = ( dev_name + '.en' ) dev_tar . extract ( fr_dev_file , directory ) dev_tar . extract ( en_dev_file , directory ) return dev_path
download the wmt en-fr training corpus to directory unless its there .