<jupyter_start><jupyter_text>XLM-R<jupyter_code>from sentence_transformers import SentenceTransformer, util 
model = SentenceTransformer("stsb-xlm-r-multilingual") 
azeri_sentences = ['Pişik çöldə oturur', 
              'Bir adam gitara çalır', 
              'Mən makaron sevirəm', 
              'Yeni film möhtəşəmdir', 
              'Pişik bağda oynayır', 
              'Bir qadın televizora baxır', 
              'Yeni film çox möhtəşəmdir', 
              'Pizzanı sevirsən?'] 

english_sentences = ['The cat sits outside', 
             'A man is playing guitar', 
             'I love pasta', 
             'The new movie is awesome',
             'The cat plays in the garden', 
             'A woman watches TV', 
             'The new movie is so great', 
             'Do you like pizza?'] 
azeri_representation = model.encode(azeri_sentences) 
english_representation = model.encode(english_sentences) 
results = [] 

for azeri_sentence, query in zip(azeri_sentences, azeri_representation): 
  id_, score = util.semantic_search( 
              query,english_representation)[0][0].values() 
  results.append({ 
      "azeri": azeri_sentence, 
      "english": english_sentences[id_], 
      "score": round(score, 4) 
  }) 
import pandas as pd 
pd.DataFrame(results)<jupyter_output><empty_output><jupyter_text>LaBSE<jupyter_code>model = SentenceTransformer("LaBSE")
azeri_representation = model.encode(azeri_sentences) 
english_representation = model.encode(english_sentences) 
results = [] 

for azeri_sentence, query in zip(azeri_sentences, azeri_representation): 
  id_, score = util.semantic_search( 
              query,english_representation)[0][0].values() 
  results.append({ 
      "azeri": azeri_sentence, 
      "english": english_sentences[id_], 
      "score": round(score, 4) 
  }) 
import pandas as pd 
pd.DataFrame(results)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10249601699415826, 'fraction_numerical': 0.003186404673393521, 'mean_word_length': 3.008510638297872, 'pattern_counts': {'":': 6, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '656096', 'license': 'MIT', 'n_tokens_mistral': 674, 'n_tokens_neox': 608, 'n_words': 129, 'path': 'CH09/CH09b_Cross_lingual_text_similarity.ipynb', 'repo_name': 'sharif618/Mastering-Transformers', 'size': '1883'}