Question: I face a problem where I need to compute similarities over bilingual (English and French) texts. The "database" looks like this:

```
+-+-+-+
| |F|E|
+-+-+-+
|1|X|X|
+-+-+-+
|2| |X|
+-+-+-+
|3|X| |
+-+-+-+
|4|X| |
+-+-+-+
|5| |X|
+-+-+-+
|6|X|X|
+-+-+-+
|7|X| |
+-+-+-+

```

which means that I have English and French texts (variable long single sentences) for each "item" with either in both version (in this case the versions are loose translations of each other) or only in one language.

The task is to find the closest item ID for any incoming new sentence irrespective the actual language of either of the sentence in the "database" or of the incoming sentence (that is, the matching sentence in the "database" needn't necessarily be in the same language as the incoming sentence as long as the meaning is the closest). I hope this goal explanation is clear.

Originally I planned to build a word2vec from scratch for both languages (the vocabulary is quite specific so I would have preferred my own word2vec) and find similarities only for the corresponding language for each new sentence but this would omit all candidates from the items where the corresponding language sentences are missing.

So I wonder if generating a common word2vec encoding for the combined corpus is viable (the word2vec method itself being language agnostic) but I cannot figure out if such a solution would be superior.

Additionally, the number of the sentences is not very large (about 10.000) maybe word2vec generation from scratch is not the best idea on one hand, but there are really specific terms in the corpora on the other hand.

Answer: 
This paper from Amazon explains how you can use aligned bilingual word embeddings to generate a similarity score between two sentences of different languages. Used movie subtitles in four language pairs (English to German, French, Portuguese and Spanish) to show the efficiency of their system. 

["Unsupervised Quality Estimation Without Reference Corpus for Subtitle Machine Translation Using Word Embeddings"](https://ieeexplore.ieee.org/document/8665529)
You could take pretrained embedder on multiple languages, then check distances between the encodings. There's unofficial `pypi` port of Facebook's [LASER](https://pypi.org/project/laserembeddings/). It's langauge-agnostic and pretrained on both `en` and `fr`.

```
from laserembeddings import Laser

laser = Laser()

sentence_en = 'My name is Hendrik'
sentence_fr = 'Je suis Hendrik'

en_embedding = laser.embed_sentences([sentence_en], lang='en')[0]
fr_embedding = laser.embed_sentences([sentence_fr], lang='fr')[0]

```

Embeddings are 1024-element NumPy array. You can calculate some metric between embeddings i.e. euclidean.

```
import numpy as np

distance = np.linalg.norm(en_embedding - fr_embedding)

```

The good thing is you have defined similarity in your DB, so you can learn the threshold for your distance metric and check execatly how well it fares.