Skip to content

Commit

Permalink
fix: 我是傻逼, 不应该缓存这玩意儿的
Browse files Browse the repository at this point in the history
  • Loading branch information
SlimeNull committed Jan 14, 2024
1 parent eb15e2c commit 81b8088
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions CurvaLauncher/Apis/StringApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,15 @@ public float LevenShtein<T>(IEnumerable<T> value1, IEnumerable<T> value2)
return 1 - (float)d[length1, length2] / Math.Max(length1, length2);
}



readonly List<int> cosineSimilarity_arrA = new();
readonly List<int> cosineSimilarity_arrB = new();
public float CosineSimilarity<T>(IEnumerable<T> value1, IEnumerable<T> value2) where T : IEquatable<T>
{
//去重
T[] sl = value1.Union(value2).ToArray();

//获取重复次数
List<int> arrA = cosineSimilarity_arrA;
List<int> arrB = cosineSimilarity_arrB;
List<int> arrA = new();
List<int> arrB = new();

foreach (var c in sl)
{
arrA.Add(value1.Where(x => x.Equals(c)).Count());
Expand Down

0 comments on commit 81b8088

Please sign in to comment.