Exemplo n.º 1
0
        public override int SimilarityScore(PostBase post)
        {
            var otherPost       = (GelbooruPost)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 != "" && w != "#solo"));
            List <string> postTags = new List <string>(otherPost.GetTags().Split(' ').Where(w => w != "#tagme" && w != "" && w != "#solo"));

            foreach (var tag in thisTags.Intersect(postTags))
            {
                if (ImportantTags.Contains(tag))
                {
                    similarityScore += 100;
                }
                else
                {
                    similarityScore += 1;
                }
            }
            //similarityScore += thisTags.Intersect(postTags).Count();

            if (!GetPostAuthor().Equals("danbooru") && GetPostAuthor().Equals(otherPost.GetPostAuthor()))
            {
                similarityScore += 100;
            }

            if (ParentId != null && otherPost.ParentId != null)
            {
                if (ParentId.Equals(otherPost.ParentId))
                {
                    similarityScore += 100;
                }
            }

            return(similarityScore);
        }
Exemplo n.º 2
0
 public override bool IsSimilar(PostBase post, int trashold = 2)
 {
     return(SimilarityScore(post) >= trashold);
 }
Exemplo n.º 3
0
 public override bool Equals(PostBase other)
 {
     return(Md5.Equals(other.GetHash()));
 }