7
$\begingroup$

I’m looking to write a semantic distance function for phrases (5 words or less) that can map multi-word synonyms together. Here are some examples:

  1. “Red shoes” would be close to “Orange sandals”

  2. “Blue leopard purse” would be close to “violet spotted handbag”

Here's the type of data that I'm starting with, a static list of synonyms:

exampleSyns = CloudGet @ "https://www.wolframcloud.com/obj/832467b7-87d8-4544-a0ba-3b461a9a4e99";

enter image description here

Approaches I've tried

I have tried the obvious thing of using the distance of BERT vectors, but this doesn’t work well enough at the moment.

Are lists of synonyms and antonyms built-in somewhere? If so we could use them, but this seems like a general enough problem that there are probably easier approaches that I don’t know of.

I’m sure there’s an easier approach to handling this problem in Mathematica that people in NLP could help with.

Related & References

$\endgroup$

This question has an open bounty worth +250 reputation from M.R. ending in 7 hours.

Looking for an answer drawing from credible and/or official sources.

  • 3
    $\begingroup$ Can you share your BERT code? That would have been my first guess as well. $\endgroup$ – Carl Lange Aug 28 at 6:04
  • 1
    $\begingroup$ NetPairEmbeddingOperator[NetChain[{EmbeddingLayer[],LongShortTermMemoryLayer[],SequenceLastLayer[]}] $\endgroup$ – Alexey Golyshev Aug 28 at 6:26
  • 1
    $\begingroup$ Using a large enough text corpus can provide these kind of synonyms. Do you want to deal with large text data, or you just want to utilize some database or a trained neural network? $\endgroup$ – Anton Antonov Oct 17 at 10:35
  • 1
    $\begingroup$ @M.R. I plan to post an answer after two-three days. $\endgroup$ – Anton Antonov Oct 25 at 6:00
  • 1
    $\begingroup$ @AntonAntonov two-three or twenty three? ;) $\endgroup$ – M.R. Nov 6 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.