예제 #1
0
        public static void OutputClosestWords(Vocabulary vocabulary, Representation representation, double tolerance = 0.5)
        {
            var nearbyWords = representation.GetClosestFrom(vocabulary.Words.Where(x => x != representation), 20)
                              .Where(x => x.DistanceValue > tolerance).ToList();

            if (nearbyWords.Any())
            {
                Console.WriteLine(representation.WordOrNull + ":");
                Console.WriteLine("   " + string.Join(", ", nearbyWords.Select(x => x.Representation.WordOrNull)));
                Console.WriteLine();
            }
        }