示例#1
0
        public LanguageIndexer(LanguageSettings languageSettings)
        {
            LanguageSettings = languageSettings;
            Exclusions       = (from item in LanguageSettings.Tokens.Where(y => y.Type == TokenTypeOption.Stop) select item.Content).ToList();

            HashSet <char> hs = new HashSet <char>();

            if (LanguageSettings.Tokens.Any(y => y.Type.Equals(TokenTypeOption.Whitelist)))
            {
                foreach (var item in LanguageSettings.Tokens.Where(x => x.Type.Equals(TokenTypeOption.Whitelist)))
                {
                    foreach (var c in item.Content.ToCharArray())
                    {
                        if (hs.Add(c))
                        {
                            Whitelist.Add(c);
                        }
                    }
                }
            }
            else
            {
                Whitelist.AddRange(Span(65, 90));
                Whitelist.AddRange(Span(97, 122));
            }
        }