Passing series of DF into sentence transformers encode function for paragraph similarity
I have a pandas dataframe and one of the series is a selection of paragraphs that I wish to compare for similarity. The mean wordcount is 62, so quite short.typically to get embeddings I would use this syntax; (with sentences being a list of sentences)sentence_embeddings = model.encode(sentences)as I am reading from the dataframe with multiple paragraphs it needs to be in a for loop?for sentence in series:sentence_embeddings[sentence]=model.encode(sentence)however this syntax is incorrect if anyone can suggest how I can make this work.
2022-06-17T06:48:07Z
I used the following to convert the DF series into a listlist_out = df[‘column_name’].values.tolist()If there is a more elegant way please post it here.