code: def compute_csls_accuracy(
      x_src, x_tgt, lexicon, lexicon_size=-1, k=10, bsz=1024
  ):
      if lexicon_size < 0:
          lexicon_size = len(lexicon)
      idx_src = list(lexicon.keys())
  
      x_src /= np.linalg.norm(x_src, axis=1)[:, np.newaxis] + 1e-8
      x_tgt /= np.linalg.norm(x_tgt, axis=1)[:, np.newaxis] + 1e-8
  
      sr = x_src[list(idx_src)]
      sc = np.dot(sr, x_tgt.T)
      similarities = 2 * sc
      sc2 = np.zeros(x_tgt.shape[0])
      for i in range(0, x_tgt.shape[0], bsz):
          j = min(i + bsz, x_tgt.shape[0])
          sc_batch = np.dot(x_tgt[i:j, :], x_src.T)
          dotprod = np.partition(sc_batch, -k, axis=1)[:, -k:]
          sc2[i:j] = np.mean(dotprod, axis=1)
      similarities -= sc2[np.newaxis, :]
  
      nn = np.argmax(similarities, axis=1).tolist()
      correct = 0.0
      for k in range(0, len(lexicon)):
          if nn[k] in lexicon[idx_src[k]]:
              correct += 1.0
      return correct / lexicon_size
  
file_path: fastText/alignment/utils.py
imports: import io
  import numpy
  import collections
label_desc: Use image node_id 10 for calling a global function with example usage: compute_csls_accuracy(x_src, x_tgt, lexicon, lexicon_size, k, bsz) and returns: unknown