Example #1
0
        public void LoadDictionary()
        {
            Log.InfoFormat("LoadDictionary called. Keyboard language setting is '{0}'.", Settings.Default.KeyboardAndDictionaryLanguage);

            try
            {
                managedSuggestions = CreateSuggestions();

                // Create reference to the actual storage of the dictionary entries.
                entries = managedSuggestions.GetEntries();

                //Load the user dictionary
                var userDictionaryPath = GetUserDictionaryPath(Settings.Default.KeyboardAndDictionaryLanguage);

                if (File.Exists(userDictionaryPath))
                {
                    LoadUserDictionaryFromFile(userDictionaryPath);
                }
                else
                {
                    LoadDictionaryFromLanguageFile();
                }
            }
            catch (Exception exception)
            {
                PublishError(this, exception);
            }
        }
Example #2
0
        public void LoadDictionary()
        {
            Log.InfoFormat("LoadDictionary called. Keyboard language setting is '{0}'.", Settings.Default.KeyboardAndDictionaryLanguage);

            try
            {
                managedSuggestions = CreateSuggestions();

                if (suggestionMethod == SuggestionMethods.Presage)
                {
                    // If using external dictionary, such as Presage, don't bother loading/saving user dictionaries.
                    return;
                }

                // Create reference to the actual storage of the dictionary entries.
                entries = managedSuggestions.GetEntries();

                //Load the user dictionary
                var userDictionaryPath = GetUserDictionaryPath(Settings.Default.KeyboardAndDictionaryLanguage);

                if (File.Exists(userDictionaryPath))
                {
                    LoadUserDictionaryFromFile(userDictionaryPath);
                }
                else
                {
                    LoadDictionaryFromLanguageFile();
                }
            }
            catch (Exception exception)
            {
                PublishError(this, exception);
            }
        }
Example #3
0
        public SpellingCorrectionTester(SuggestionMethods SuggestionMethod, Languages language)
        {
            switch (SuggestionMethod)
            {
            case SuggestionMethods.NGram:
                managedSuggestion = new NGramAutoComplete();
                break;

            case SuggestionMethods.Basic:
                managedSuggestion = new BasicAutoComplete();
                break;

            case SuggestionMethods.Presage:
                managedSuggestion = new PresageSuggestions();
                break;

            default:
                throw new ArgumentOutOfRangeException("SuggestionMethod", SuggestionMethod, null);
            }

            Configure(language);
        }
        public void LoadDictionary()
        {
            Log.InfoFormat("LoadDictionary called. Keyboard language setting is '{0}'.", Settings.Default.KeyboardAndDictionaryLanguage);

            try
            {
                entries            = new Dictionary <string, List <DictionaryEntry> >();
                managedSuggestions = CreateSuggestions();

                //Load the user dictionary
                var userDictionaryPath = GetUserDictionaryPath(Settings.Default.KeyboardAndDictionaryLanguage);

                if (File.Exists(userDictionaryPath))
                {
                    LoadUserDictionaryFromFile(userDictionaryPath);
                }
                else
                {
                    //Load the original dictionary
                    var originalDictionaryPath = Path.GetFullPath(string.Format(@"{0}{1}{2}", OriginalDictionariesSubPath, Settings.Default.KeyboardAndDictionaryLanguage, DictionaryFileType));

                    if (File.Exists(originalDictionaryPath))
                    {
                        LoadOriginalDictionaryFromFile(originalDictionaryPath);
                        SaveUserDictionaryToFile(); //Create a user specific version of the dictionary
                    }
                    else
                    {
                        throw new ApplicationException(string.Format(Resources.DICTIONARY_FILE_NOT_FOUND_ERROR, originalDictionaryPath));
                    }
                }
            }
            catch (Exception exception)
            {
                PublishError(this, exception);
            }
        }
Example #5
0
 public void Arrange()
 {
     autoComplete = CreateAutoComplete();
     SuggestionsTestCaseSource = GetTestCases();
 }
Example #6
0
 public void Arrange()
 {
     autoComplete = CreateAutoComplete();
 }