I’m looking to write a semantic distance function for phrases (5 words or less) that can map multi-word synonyms together. My domain is e-commerce fashion - here are some required examples for a solution:
“Red shoes” would be close to “Orange sandals”
“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";
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
NetPairEmbeddingOperator[NetChain[{EmbeddingLayer[],LongShortTermMemoryLayer[],SequenceLastLayer[]}]
$\endgroup$