Пример #1
0
        public Task <List <LiteTag> > FindTagsAsync(ulong guildId, string name, int stop)
        {
            int tolerance = LiteConfiguration.Load().RelatedTagsLimit;
            var tags      = Tags.Where(x => x.GuildId == guildId && x.Aliases.Any(y => LevenshteinDistance.Compute(name, y) <= tolerance));
            var selected  = tags.OrderBy(x => x.Aliases.Sum(y => LevenshteinDistance.Compute(name, y))).Take(stop);

            return(Task.FromResult(selected.ToList()));
        }