public static CategoryRatio CreateUniformRatio(string[] categories) { CategoryRatio cr = new CategoryRatio(); foreach (string category in categories) { cr.AddWeight(category, 1d / categories.Length); } return(cr); }
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); }