src/anagramsolver/containers/WordlistContainer.cs
/// <summary>
/// Load wordlist together with wordlength, remove duplicates 
/// </summary>
/// <param name="anagramCtrl"></param>
Load wordlist together with wordlength, remove duplicates
Load wordlist together with wordlength remove duplicates
public void Filter1_CreateListOfWordsHavingLettersFromAnagram(IAnagramContainer anagramCtrl)
        {
            _listFilter1_WorddictHavingAllowedChars = new Dictionary<string, int>();
            var lettersNotInAnagram = anagramCtrl.LettersNotInAnagram.DistinctDataWithoutSpace;
            _listUnfiltered0_Wordlist.ForEach(word => {
                var inCommonCharsCount = lettersNotInAnagram.Intersect(word).Count();
                if (inCommonCharsCount == 0)
                {
                    try
                    {
                        _listFilter1_WorddictHavingAllowedChars.Add(word, word.Length);
                    }
                    catch (Exception)
                    {
                    }
                }
            });
        }
public void Filter1_CreateListOfWordsHavingLettersFromAnagram ( IAnagramContainer anagramCtrl ) { _listFilter1_WorddictHavingAllowedChars = new Dictionary < string , int > ( ) ; var lettersNotInAnagram = anagramCtrl . LettersNotInAnagram . DistinctDataWithoutSpace ; _listUnfiltered0_Wordlist . ForEach ( word => { var inCommonCharsCount = lettersNotInAnagram . Intersect ( word ) . Count ( ) ; if ( inCommonCharsCount == 0 ) { try { _listFilter1_WorddictHavingAllowedChars . Add ( word , word . Length ) ; } catch ( Exception ) { } } } ) ; }
Load wordlist together with wordlength, remove duplicates
Load wordlist together with wordlength remove duplicates
// preapare lists // Create new list having letters that are contained anagram - the words might still have too many of the allowed chars // If a word don't have any of the letters not in the anagram, then it is a possible match // A dict that uses word as key - it will throw if duplicates - remove duplicates in the same operation // Save as array for fast lookup by index - Droppet - this was slower than the dict //_listFilter1_WordArrayHavingAllowedChars = _listFilter1_WorddictHavingAllowedChars.Keys.ToArray();
anagramCtrl
IAnagramContainer
None