public override int SimilarityScore(PostBase post) { var otherPost = (DanbooruPost)post; int similarityScore = 0; if (FileUrl.Contains(".gif") || FileUrl.Contains(".webm") || FileUrl.Contains(".mp4")) { return(-1000000); } List <string> thisTags = new List <string>(TagStringGeneral.Split(' ').Where(w => w != "#tagme" && w != "" && w != "#solo")); List <string> postTags = new List <string>(otherPost.TagStringGeneral.Split(' ').Where(w => w != "#tagme" && w != "" && w != "#solo")); var generalIntersect = thisTags.Intersect(postTags); thisTags = new List <string>(TagStringCharacter.Split(' ')); postTags = new List <string>(otherPost.TagStringCharacter.Split(' ')); var characterIntersect = thisTags.Intersect(postTags); thisTags = new List <string>(TagStringCopyright.Split(' ')); postTags = new List <string>(otherPost.TagStringCopyright.Split(' ')); var copyrightIntersect = thisTags.Intersect(postTags); thisTags = new List <string>(TagStringArtist.Split(' ')); postTags = new List <string>(otherPost.TagStringArtist.Split(' ')); var artistIntersect = thisTags.Intersect(postTags); similarityScore += generalIntersect.Count(); similarityScore += characterIntersect.Count() * 10; similarityScore += generalIntersect.Count() * 100; similarityScore += generalIntersect.Count() * 1000; return(similarityScore); }
public override int SimilarityScore(PostBase post) { var otherPost = (YanderePost)post; int similarityScore = 0; if (FileUrl.Contains(".gif") || FileUrl.Contains(".webm")) { return(-10); } List <string> thisTags = new List <string>(GetTags().Split(' ').Where(w => w != "#tagme" && w != "")); List <string> postTags = new List <string>(otherPost.GetTags().Split(' ').Where(w => w != "#tagme" && w != "")); similarityScore += thisTags.Intersect(postTags).Count(); if (GetPostAuthor().Equals(otherPost.GetPostAuthor())) { similarityScore += 10; } if (ParentId != null && otherPost.ParentId != null) { if (ParentId.Equals(otherPost.ParentId)) { similarityScore += 10; } } return(similarityScore); }