I would like ask for ideas

So I have sub-sentences, embedded in the context of their respective full-sentences. Then, I have other full-sentences and I would like to find a) if they have similar sub-sentences b) if yes, what is the best alignment between the sub-sentence and the full-sentence.

I have implemented 2 different approaches so far:

  1. calculate an average of the sub-sentence across each dimensions. Then using a sliding-window of the same-length as the sub-sentence, I went over the full-sentence, every step I extracted the embeddings for that, got its average and calucalted cosine similarity against the query sub-sentence. Then, I plotted this value accross the full-sentence, and tried to find the region with the highest similarity. This worked reasonably well, but there is a room for improvement

  2. Using the embedding matrix, calculating cosine similarity in an all-against-all manner: this way, I end up with a matrix of (length sub-sentence) x length(full sentence), with a value of cosine similarity in each cell. I yet to find a method to extract the most probably region from this matrix.

My question is: are there known better way to do this? I tried to search, but struggle to find other things so far (I might be able to do soft cosine similarity as well, but need to work on that more).

Thank you for your ideas!



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.