Implement step 17 modules: threads/messages, notifications with automation (submission.created, idea.created, grant_call.opened), innovation test feedback, admin panel (submissions, verify, metrics, grant call status), Middleman adaptation and partnerships. Split multi-type files into one type per file and replace object-valued dictionaries with string-valued maps in data contracts (migrations 0006/0007).
20 lines
626 B
C#
20 lines
626 B
C#
namespace TarninaHub.Application.Matchmaking;
|
|
|
|
|
|
public static class SemanticRanker
|
|
{
|
|
public static IReadOnlyList<RankedItem<T>> Rank<T>(
|
|
IReadOnlyList<float> queryVector,
|
|
IEnumerable<(T Item, IReadOnlyList<float> Vector)> candidates,
|
|
int topK,
|
|
double minScore = 0)
|
|
{
|
|
return candidates
|
|
.Select(candidate => new RankedItem<T>(candidate.Item, VectorMath.CosineSimilarity(queryVector, candidate.Vector)))
|
|
.Where(ranked => ranked.Score >= minScore)
|
|
.OrderByDescending(ranked => ranked.Score)
|
|
.Take(topK)
|
|
.ToList();
|
|
}
|
|
}
|