Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var collection = new CharCountCollection("poultry outwits ants");
            var list       = new RegexFilterList(collection, File.ReadAllText("wordlist"));

            var sb          = new StringBuilder();
            var collBuilder = new CombinationBuilder();
            var lst         = collBuilder.GetPossibleMatches(list, collection);
        }
Example #2
0
        public static string ToRegex(this CharCountCollection collection)
        {
            var sb = new StringBuilder();

            foreach (var charCount in collection)
            {
                sb.Append(charCount.Character);
            }
            return($@"\n(?<word>[{sb.ToString()}]{{1,{collection.TotalLength()}}})\r");
        }
Example #3
0
        private void Combine(RegexFilterList list, CharCountCollection collection, List <string> current)
        {
            if (current == null)
            {
                current = new List <string>();
            }

            var l = list.Copy();
            var c = collection.Copy();

            if (current.Any())
            {
                c.MakeWord(current.Last());
            }

            if (!l.Any())
            {
                return;
            }


            foreach (var word in l)
            {
                if (current.Contains(word))
                {
                    continue;
                }
                if (c.Any())
                {
                    current.Add(word);
                    Combine(l, c, current);
                }
                else
                {
                    current.Add(word);
                    _combinations.Add(current.Aggregate((i, j) => i + " " + j));
                }
            }
        }
Example #4
0
 public IEnumerable <string> GetPossibleMatches(RegexFilterList list, CharCountCollection collection)
 {
     Combine(list, collection, null);
     return(_combinations);
 }