コード例 #1
0
        static void Main(string[] args)
        {
            TextParserTool textparser = new TextParserTool();

            var intergenText = "Intergen is New Zealand's most experienced provider of Microsoft based business solutions. We focus on delivering business value in our solutions and work closely with Microsoft to ensure we have the best possible understanding of their technologies and directions. Intergen is a Microsoft Gold Certified Partner with \nthis status recognising us as an \"elite business partner\" for implementing \nsolutions based on our capabilities and experience with Microsoft products.";

            textparser.PrintResultsToConsole(intergenText);
        }
コード例 #2
0
        public void PrintResultsToConsole(string input)

        {
            TextParserTool textparser = new TextParserTool();

            var thirdLargestWord      = string.Join(", ", FindThirdLongestWord(NumberOfWords(input)).ToList());
            var CountOfThirdWordChars = FindThirdLongestWord(NumberOfWords(input)).Key;

            Console.WriteLine("The number of words in the sample text is {0}.", textparser.NumberOfWords(input).Length);
            Console.WriteLine("\n");
            Console.WriteLine("The number of sentences is {0}.", textparser.GetSentenceCount(input));
            Console.WriteLine("\n");
            Console.WriteLine("The longest sentence is : {0}.", textparser.LongestSentence(input));
            Console.WriteLine("\n");
            Console.WriteLine("The most frequent word is : {0}.", MostFrequentWord(NumberOfWords(input)));
            Console.WriteLine("\n");
            Console.WriteLine("The joint third most longest words are {0}.\n\nThese words both have a character count of : {1}.", thirdLargestWord, CountOfThirdWordChars);
            Console.ReadLine();
        }