title: Product matching in Python and TensorFlow
body: <p>I am trying to do a product matching between retail articles from different sellers. They use different names for the same article.
  I want to compare the articles from several sellers with the articles that are my database, to know if they are the same. I use the entire name for the comparisons not each word.</p>
  <p>I applied this in Python with TensorFlow; with the USE (Universal Sentence Encoder) multilingual (I am working in Spanish language) I obtain the word embeddings for each article and the correlation matrix. Like this I can see the closest articles.</p>
  <p>But I would like to use a dictionary for the names of my articles: the key would be the article name of my database, and the values would be different combinations (possibilities) of the description article. I would like to pass this dictionary like input to the model but I don't know how I can do it.</p>
  <p>The code to obtain word embeddings:</p>
  <pre><code>module_url = &quot;https://tfhub.dev/google/universal-sentence-encoder-multilingual/3&quot;
  model = hub.load(module_url)
  print (&quot;module %s loaded&quot; % module_url)
  model(input)
  </code></pre>
  <p>To obtain the heatmap to show the similarities:</p>
  <pre><code>def plot_similarity(labels, features, rotation):
    corr = np.inner(features, features)
    sns.set(font_scale=1.2)       # Tamaño de la fuente del heatmap.
    plt.subplots(figsize=(30,30))  #Para aumentar el tamaño por defecto del heatmap.
    g = sns.heatmap(
        corr,                     # Datos
        annot=True,               # Muestra el valor numérico de la correlación.
        xticklabels= labels,      # Etiquetas eje X.
        yticklabels= labels,      # Etiquetas eje Y.
        vmin=0.8,                 # Era = 0, aumentamos el valor para que se muestren la progresión de color a partir del 80 %.
        vmax=1,
        cmap=&quot;YlOrRd&quot;)            # Color del heatmap.
    g.set_xticklabels(labels, rotation=rotation)
    g.set_title(&quot;Semantic Textual Similarity&quot;)
    #Guardamos el gráfico y lo exportamos:
    plt.savefig('Heatmap exported.png', dpi = 400)
    files.download('Heatmap exported.png')
  
  def run_and_plot(messages_):
    message_embeddings_ = embed(messages_)
    plot_similarity(messages_, message_embeddings_, 90)
  </code></pre>
  <p>Then I run:</p>
  <pre><code>run_and_plot(my_list_of_articles)
  </code></pre>
  <p>And I obtain the heatmap.</p>
  <p>I want to change 'my_list_of_articles' to using a dictionary. In this moment that object is a Python list.</p>
  <p>I know I need to train a Neural Network of unstructured text; if I test many combinations of the same articles the NN can learn which article is, but I don't know how to do this.</p>
  <p>Thank you very much in advance.</p>