class_docstr: Class for evaluating the performance of mapping W
class_docstr_tok: ["Class","for","evaluating","the","performance","of","mapping","W"]
docstr: Generates best translation pairs
  Arguments:
       sess(tf.session): Tensorflow session
       dict_type(str): S2T-Source2Target, S2T&T2S (Both)
  Returns:
      Numpy array of max_dict x 2 or smaller
docstr_tok: ["Generates","best","translation","pairs","Arguments",":","sess","(","tf.session",")",":","Tensorflow","session","dict_type","(","str",")",":","S2T-Source2Target",",","S2T","&","T2S","(","Both",")","Returns",":","Numpy","array","of","max_dict","x","2","or","smaller"]
code: def generate_dictionary(self, sess, dict_type="S2T"):
      """
      Generates best translation pairs
      Arguments:
           sess(tf.session): Tensorflow session
           dict_type(str): S2T-Source2Target, S2T&T2S (Both)
      Returns:
          Numpy array of max_dict x 2 or smaller
      """
      avg1, avg2 = self.calc_avg_dist(sess)
      s2t_dico = self.get_candidates(sess, avg1, avg2)
      print(
          "Completed generating S2T dictionary of size "
          + str(len(s2t_dico))
      )
      if dict_type == "S2T":
          map_src_ind = np.asarray(
              [s2t_dico[x][0] for x in range(len(s2t_dico))]
          )
          tra_tgt_ind = np.asarray(
              [s2t_dico[x][1] for x in range(len(s2t_dico))]
          )
          return [map_src_ind, tra_tgt_ind]
      if dict_type == "S2T&T2S":
          # This case we are running Target 2 Source mappings
          t2s_dico = self.get_candidates(
              sess, avg2, avg1, swap_score=True
          )
          print(
              "Completed generating T2S dictionary of size "
              + str(len(t2s_dico))
          )
          t2s_dico = np.concatenate(
              [t2s_dico[:, 1:], t2s_dico[:, :1]], 1
          )
          # Find the common pairs between S2T and T2S
          s2t_candi = set([(a, b) for a, b in s2t_dico])
          t2s_candi = set([(a, b) for a, b in t2s_dico])
          final_pairs = s2t_candi & t2s_candi
          dico = np.asarray(list([[a, b] for (a, b) in final_pairs]))
          print(
              "Completed generating final dictionary of size "
              + str(len(final_pairs))
          )
          return dico
  
file_path: nlp-architect/examples/crosslingembs/evaluate.py
imports: from __future__ import print_function, division
  import numpy
  import tensorflow
  from nlp_architect.data.fasttext_emb import get_eval_data
label_desc: Use image node_id 14 for calling the Evaluate obj's underlying member method code with example usage: obj.generate_dictionary(sess, dict_type) and returns: list, dico