This repository was archived by the owner on Jan 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ namespace HuggingFace . API {
2
+ public class SentenceSimilarity {
3
+ /// <summary>
4
+ /// Find the best similiarity score
5
+ /// </summary>
6
+ /// <param name="similarityScores">An array of similarity scores between each context phrase and the sentence.</param>
7
+ /// <returns>The index of the maximum similarity score.</returns>
8
+ public float FindBestSimilarityScoreValue ( float [ ] similarityScores )
9
+ {
10
+ float maxScore = scores . Max ( ) ;
11
+ return maxScore
12
+ }
13
+
14
+ /// <summary>
15
+ /// Finds the index of the maximum similarity score in the given array of similarity scores.
16
+ /// </summary>
17
+ /// <param name="similarityScores">An array of similarity scores representing the similarity between each context phrase and the sentence.</param>
18
+ /// <returns>The index of the maximum similarity score in the array.</returns>
19
+ public float FindBestSimilarityScoreIndex ( float [ ] similarityScores )
20
+ {
21
+ float maxScore = FindBestSimilarityScoreValue ( similarityScores )
22
+ float maxScore = similarityScores . ToList ( ) . IndexOf ( maxScore ) ;
23
+
24
+ return maxScore
25
+ }
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments