Beispiel #1
0
    plt.plot(x_axis, point_2, label=label_2)
    plt.ylabel(y_label)
    plt.savefig(save_path)
    plt.clf()


#############################################################Load the Dataset#######################################################
#Load the Dataset
data_path = ARGS.data_path
trained_model_output_path = ARGS.trained_model_path
source_language = ARGS.sr
target_language = ARGS.tg
BPE_dataset_suffix = '.norm.tok.lc.10000bpe'
dataset_suffix = '.norm.tok.lc'
#Initilalize a Meteor Scorer
Meteor_Scorer = Meteor(target_language)

#Create the directory for the trained_model_output_path
if not os.path.isdir(trained_model_output_path):
    os.mkdir(trained_model_output_path)

#Load the training dataset
train_source = load_data(
    os.path.join(data_path,
                 'train' + BPE_dataset_suffix + '.' + source_language))
train_target = load_data(
    os.path.join(data_path,
                 'train' + BPE_dataset_suffix + '.' + target_language))

print('The size of Training Source and Training Target is: {},{}'.format(
    len(train_source), len(train_target)))
Beispiel #2
0
###################### Data Relevant Area #########################
source_language = 'en'
TARGET_LANGUAGE = 'DE'  # FR or DE
target_language = TARGET_LANGUAGE.lower()
data_path = "data/AmbiguousCOCO/"  # Define the Directory of the Data Path
data_path = f"data/Multi30K_{TARGET_LANGUAGE}/"  # Define the Directory of the Test Data Path
vocab_path = f"data/Multi30K_{TARGET_LANGUAGE}/"  # Define the Directory of the vocabulary file
models_order = ['1', '2', '3']

BPE_dataset_suffix = ".norm.tok.lc.10000bpe"
dataset_suffix = ".norm.tok.lc"
dataset_im_suffix = ".norm.tok.lc.10000bpe_ims"

## Initilalize a Meteor Scorer
Meteor_Scorer = Meteor(target_language)

## Load the test dataset
test_source = load_data(
    os.path.join(data_path, f"{split}{BPE_dataset_suffix}.{source_language}"))
test_target = load_data(
    os.path.join(data_path, f"{split}{BPE_dataset_suffix}.{target_language}"))
print(
    f"The size of Test Source and Test Target is: {len(test_source)} <=> {len(test_target)}"
)

## Load the original test dataset
test_ori_source = load_data(
    os.path.join(data_path, f"{split}{dataset_suffix}.{source_language}"))
test_ori_target = load_data(
    os.path.join(data_path, f"{split}{dataset_suffix}.{target_language}"))