utils package

Submodules

evaluate_from_file module

utils.evaluate_from_file.CocoScore(ref, hyp, metrics_list=None, language='en')

Obtains the COCO scores from the references and hypotheses.

Parameters:
  • ref – Dictionary of reference sentences (id, sentence)
  • hyp – Dictionary of hypothesis sentences (id, sentence)
  • metrics_list – List of metrics to evaluate on
  • language – Language of the sentences (for METEOR)
Returns:

dictionary of scores

utils.evaluate_from_file.evaluate_from_file(args)

Evaluate translation hypotheses from a file or a list of files of references. :param args: Evaluation parameters :return: None

utils.evaluate_from_file.load_textfiles(references, hypotheses)

Loads the references and hypothesis text files.

Parameters:
  • references – References files.
  • hypotheses – Hypotheses file.
Returns:

preprocess_binary_word_vectors module

utils.preprocess_binary_word_vectors.parse_args()
utils.preprocess_binary_word_vectors.word2vec2npy(v_path, base_path_save, dest_filename)

Preprocess pretrained binary vectors and stores them in a suitable format. :param v_path: Path to the binary vectors file. :param base_path_save: Path where the formatted vectors will be stored. :param dest_filename: Filename of the formatted vectors.

preprocess_text_word_vectors module

utils.preprocess_text_word_vectors.parse_args()
utils.preprocess_text_word_vectors.txtvec2npy(v_path, base_path_save, dest_filename)

Preprocess pretrained text vectors and stores them in a suitable format :param v_path: Path to the text vectors file. :param base_path_save: Path where the formatted vectors will be stored. :param dest_filename: Filename of the formatted vectors.

utils module

utils.utils.update_parameters(params, updates, restrict=False)

Updates the parameters from params with the ones specified in updates :param params: Parameters dictionary to update :param updates: Updater dictionary :param restrict: If True, parameters from the original

dict are not overwritten.
Returns:

Module contents