@@ -73,8 +73,8 @@ def load_metadata(args, parser):
73
73
try :
74
74
# Load YAML
75
75
metadata_yaml = yaml .safe_load (args .metadata )
76
- yamlpath = os .path .dirname (os .path .abspath (args .metadata .name ))
77
- metadata_yaml ["yamlpath " ] = yamlpath
76
+ yamldir = os .path .dirname (os .path .abspath (args .metadata .name ))
77
+ metadata_yaml ["yamldir " ] = yamldir
78
78
79
79
# Read language pair and tokenizers
80
80
args .source_lang = metadata_yaml ["source_lang" ]
@@ -86,32 +86,32 @@ def load_metadata(args, parser):
86
86
87
87
# Load classifier
88
88
try :
89
- args .clf = joblib .load ( os .path .join ( yamlpath , metadata_yaml ["classifier" ]))
89
+ args .clf = joblib .load ( os .path .join ( yamldir , metadata_yaml ["classifier" ]))
90
90
except :
91
91
args .clf = joblib .load (metadata_yaml ["classifier" ])
92
92
args .clf .n_jobs = 1
93
93
args .classifier_type = metadata_yaml ["classifier_type" ]
94
94
95
95
# Load probabilistic dictionaries
96
96
try :
97
- args .dict_sl_tl = ProbabilisticDictionary ( os .path .join (yamlpath , metadata_yaml ["source_dictionary" ]))
97
+ args .dict_sl_tl = ProbabilisticDictionary ( os .path .join (yamldir , metadata_yaml ["source_dictionary" ]))
98
98
except :
99
99
args .dict_sl_tl = ProbabilisticDictionary (metadata_yaml ["source_dictionary" ])
100
100
try :
101
- args .dict_tl_sl = ProbabilisticDictionary ( os .path .join (yamlpath , metadata_yaml ["target_dictionary" ]))
101
+ args .dict_tl_sl = ProbabilisticDictionary ( os .path .join (yamldir , metadata_yaml ["target_dictionary" ]))
102
102
except :
103
103
args .dict_tl_sl = ProbabilisticDictionary (metadata_yaml ["target_dictionary" ])
104
104
105
105
# Load wordfreqs
106
106
try :
107
- args .sl_word_freqs = WordZipfFreqDist ( os .path .join ( yamlpath , metadata_yaml ["source_word_freqs" ]))
107
+ args .sl_word_freqs = WordZipfFreqDist ( os .path .join ( yamldir , metadata_yaml ["source_word_freqs" ]))
108
108
except :
109
109
try :
110
110
args .sl_word_freqs = WordZipfFreqDist (metadata_yaml ["source_word_freqs" ])
111
111
except :
112
112
args .sl_word_freqs = None
113
113
try :
114
- args .tl_word_freqs = WordZipfFreqDist ( os .path .join ( yamlpath , metadata_yaml ["target_word_freqs" ]))
114
+ args .tl_word_freqs = WordZipfFreqDist ( os .path .join ( yamldir , metadata_yaml ["target_word_freqs" ]))
115
115
except :
116
116
try :
117
117
args .tl_word_freqs = WordZipfFreqDist (metadata_yaml ["target_word_freqs" ])
@@ -153,7 +153,7 @@ def load_metadata(args, parser):
153
153
logging .warning ("Porn removal not present in metadata, disabling." )
154
154
else :
155
155
try :
156
- args .porn_removal = fasttext .load_model (os .path .join (yamlpath , metadata_yaml ['porn_removal_file' ]))
156
+ args .porn_removal = fasttext .load_model (os .path .join (yamldir , metadata_yaml ['porn_removal_file' ]))
157
157
except :
158
158
args .porn_removal = fasttext .load_model (args .metadata_yaml ['porn_removal_file' ])
159
159
else :
0 commit comments