Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var wordCount  = 0;
            var badCount   = 0;
            var totalCount = 0;
            var table      = WordsCommon.GetAllData();

            using (var file = File.OpenText(@"c:\Temp\2of12inf.txt"))
                while (!file.EndOfStream)
                {
                    var word = file.ReadLine().Trim();
                    if (word.EndsWith("%", System.StringComparison.Ordinal))
                    {
                        word = word.Substring(0, word.Length - 1);
                    }
                    if (WordRegex.IsMatch(word))
                    {
                        wordCount++;
                        table.AddRow(word);
                    }
                    else
                    {
                        badCount++;
                    }
                    totalCount++;
                }
            //WordsCommon.UpdateTable(table);
        }
Exemplo n.º 2
0
        static ToSentenceCase()
        {
            var commonTable = WordsCommon.GetAllData();

            CommonWords = commonTable.ToDictionary(row => row.Word, row => null as object,
                                                   StringComparer.OrdinalIgnoreCase);
            var phrasesTable = WordsPhrases.GetAllData();

            Phrases = phrasesTable.ToLookup(row => row.FirstWord,
                                            row => row.FirstWord + PrependSpace(row.RestOfPhrase),
                                            StringComparer.OrdinalIgnoreCase);
            var leadersTable = WordsLeaders.GetAllData();

            Leaders = leadersTable.ToDictionary(row => AppendSpace(row.Leader),
                                                row => AppendSpace(row.Leader), StringComparer.OrdinalIgnoreCase);
            var followersTable = WordsFollowers.GetAllData();

            Followers = followersTable.ToDictionary(row => PrependSpace(row.Follower),
                                                    row => PrependSpace(row.Follower), StringComparer.OrdinalIgnoreCase);
        }