Get max Semantic Similarity score in Studio Web (String→String over Google Sheet)

Hello Guys !
Hope you’re doing well.

I’m working on a project that categorizes user messages (Bug, Question, etc.). I iterate over emails in my Gmail inbox and categorize each message.

When a request looks like a system bug, I check a Google Spreadsheet to see whether a similar issue has already been reported, using the Semantic Similarity activity inside a For Each Row loop. If the similarity score is very low compared to the existing issues, I add the new one to the list (likely a new bug). Otherwise, I don’t add anything.

My goal is to retrieve the maximum similarity score. Is there a direct way to do this? I see that the Semantic Similarity activity can output a List of similarity scores, but, as far as I understand, that output doesn’t work in **“String to string”**mode. Since I’m operating over a Google Spreadsheet row by row, I haven’t managed to use “String to list” (with a List of String input).

Do you have any ideas on how I can collect the scores and get the max in this scenario? Do I need to resort to custom code, or is there a no-code pattern that works in Studio Web?

Many thanks,
Simon

An this is the screen for my Semantic Similarity activity :slight_smile:

@Simon_DA_ROS

Read whole gsheet column at once and then dt.AsEnumerable.Select(function(x) x("ColumnName").ToString).ToArray will give array of sentences taken from gsheet..so no for each row is needed

Cheers

Hi @Anil_G, thanks for your reply!

I tried your suggestion with an Assign activity: I created a variable called toVariable of type String[] , and in the expression editor I used readRange.DataTable.AsEnumerable().Select(Function(x) x("Known Issue Description").ToString()).ToArray() . So I should get an array of strings, which is the type required in the Comparison array.

Fyi, the output of toVariable is
string[7] { “Dashboard takes too long to load after login”, “Limited filter options available in analytics view”, “Mobile and desktop apps do not sync correctly”, “Password reset link missing on login page”, “App interface not optimized for low-light (no dark mode)”, “Occasional delay in reflecting changes in reports”, “Error occurs when uploading large CSV files” }

However, when I check the output listOfSimilarityScores , I only see this: [{"string":"Dashboard takes too long to load after login","similarityScore":0.3,"similarityExplanation":"Low similarity due to differing contexts and intents. The primary string focuses on a missing password reset link, which is a functionality issue related to account recovery. The comparison string discusses a performance issue (slow loading) after login, which is unrelated to account recovery. Both strings share a loose connection through the theme of the login process, but the key concepts and vocabulary diverge significantly."}] .

It looks like it only works on the first element of my array, do you know why this happens? Also, with your method, which activity should I use?

Thank you !!