FITKMS_business.Util.RecommendationService.CompleteItemProfile C# (CSharp) Метод

CompleteItemProfile() приватный Метод

private CompleteItemProfile ( List articles ) : void
articles List
Результат void
        private void CompleteItemProfile(List<ItemProfile> articles)
        {
            Dictionary<Tagovi, int> tagsFreq = new Dictionary<Tagovi,int>();
            //Broj članaka u klasteru
            int articleNum = articles.Count;

            foreach (ItemProfile item in articles)
            {
                tagsFreq.Clear();
                foreach (Tagovi tag in item.ItemTags.Keys)
                {
                    tagsFreq.Add(tag, (int)Connection.dm.fsp_Tagovi_CountWithinArticles(tag.TagID).FirstOrDefault());
                }

                //Pronaći tag koji se najviše puta ponavlja
                int maxFreq = tagsFreq.Values.Max();

                double tagTF = 0;
                foreach (var tag in tagsFreq)
                {
                    tagTF = (double)tag.Value/ maxFreq;
                    if (tagTF < 0.2) //Treshold iznosi 0.2
                    {
                        tagsFreq.Remove(tag.Key);
                        item.ItemTags.Remove(tag.Key);
                    }
                    else
                    {
                        int articleNumByTag = 0;
                        foreach (var a in articles)
                        {
                            if (a.TagExists(tag.Key))
                                articleNumByTag++;
                        }

                        if (articleNumByTag != 0) //Dodati u ItemProfile
                            item.ItemTags[tag.Key] = tag.Value * Math.Log10((double)articles.Count / articleNumByTag);

                    }
                }

            }
        }