Esempio n. 1
0
        public static CategoryRatio CreateUniformRatio(string[] categories)
        {
            CategoryRatio cr = new CategoryRatio();

            foreach (string category in categories)
            {
                cr.AddWeight(category, 1d / categories.Length);
            }

            return(cr);
        }
Esempio n. 2
0
        public static CategoryRatio CreateUniformRatio(SimilarQuery query)
        {
            CategoryRatio cr = new CategoryRatio();

            List <string> categories = new List <string>();

            foreach (TermContainer tc in query.containers)
            {
                foreach (TermsObject to in tc.terms)
                {
                    categories.AddRange(to.categories);
                }
            }

            foreach (string category in categories)
            {
                cr.AddWeight(category, 1d / categories.Count);
            }

            return(cr);
        }