本文整理汇总了C#中SortedSet.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# SortedSet.Skip方法的具体用法?C# SortedSet.Skip怎么用?C# SortedSet.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SortedSet
的用法示例。
在下文中一共展示了SortedSet.Skip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NameAnalysis
public void NameAnalysis()
{
Logger.Log("Analyzing names", Logger.TabChange.Increase);
var nodeNames = NodeNameGrouper.NodeNames();
Logger.Log("Longest name is " + nodeNames.Max(n => n.Key.Length) + " characters long");
var alphabet = nodeNames.Keys.SelectMany(s => s.AsEnumerable()).Distinct().OrderBy(c => c);
Logger.Log(alphabet.Count() + " characters in alphabet \"" + alphabet.Aggregate(string.Empty, (s, c) => s + c) + "\"");
var reducedAlphabet = nodeNames.Keys.SelectMany(s => s.ToLower().Where(c => 'a' <= c && c <= 'z')).Distinct().OrderBy(c => c);
Logger.Log(reducedAlphabet.Count() + " characters in alphabet \"" + reducedAlphabet.Aggregate(string.Empty, (s, c) => s + c) + "\"");
var commonWords = EveryName
.SelectMany(n => n.Replace(",", "").Replace(".", "").Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(na => na.Trim().ToUpper()))
.GroupBy(n => n).OrderByDescending(g => g.Count()).Take(25).Select(g => g.Key + " " + g.Count()).ToArray();
Logger.Log(commonWords.Length + " most common words: " + commonWords.Aggregate("", (c, s) => c + "," + s).Remove(0, 1));
{
var names = new SortedSet<string>[16];
names[0] = new SortedSet<string>();
foreach (var line in InputData.Paths.Select(l => l.Split('|')))
{
foreach (var name in line)
{
names[0].Add(name.Trim());
}
}
foreach (int i in Enumerable.Range(0, InputData.TrainingSets.Length))
{
names[i + 1] = new SortedSet<string>();
foreach (var line in InputData.TrainingSets[i].Select(l => l.Split('|')))
{
names[i + 1].Add(line[0].Trim());
names[i + 1].Add(line[1].Trim());
}
}
Logger.Log("The unique names in each set are: " + names.Skip(1).Aggregate("paths " + names[0].Count, (c, s) => c + ", " + s.Count));
Logger.Log("Train 1 and 2 have " + names[1].Intersect(names[2]).Count() + " names in common");
var trainingCommonNames = names.Skip(2).Aggregate(new SortedSet<string>(names[1]), (s, c) => { s.IntersectWith(c); return s; });
Logger.Log("The training sets have " + trainingCommonNames.Count + " names in common");
Logger.Log("The training and path sets have " + trainingCommonNames.Intersect(names[0]).Count() + " names in common");
}
Logger.Log("Names analyzed", Logger.TabChange.Decrease);
}