public SpellingCorrectionTester(AutoCompleteMethods autoCompleteMethod, Languages language)
        {
            switch (autoCompleteMethod)
            {
                case AutoCompleteMethods.NGram:
                    autoComplete = new NGramAutoComplete();
                    break;
                case AutoCompleteMethods.Basic:
                    autoComplete = new BasicAutoComplete();
                    break;
                default:
                    throw new ArgumentOutOfRangeException("autoCompleteMethod", autoCompleteMethod, null);
            }

            Configure(language);
        }
        public SpellingCorrectionTester(AutoCompleteMethods autoCompleteMethod, Languages language)
        {
            switch (autoCompleteMethod)
            {
            case AutoCompleteMethods.NGram:
                autoComplete = new NGramAutoComplete();
                break;

            case AutoCompleteMethods.Basic:
                autoComplete = new BasicAutoComplete();
                break;

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

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

            try
            {
                manageAutoComplete = CreateAutoComplete();

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

                //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);
            }
        }
 public void Arrange()
 {
     autoComplete = CreateAutoComplete();
 }
Example #5
0
 public void Arrange()
 {
     autoComplete = CreateAutoComplete();
     SuggestionsTestCaseSource = GetTestCases();
 }
Example #6
0
        public void LoadDictionary()
        {
            Log.InfoFormat("LoadDictionary called. Keyboard language setting is '{0}'.", Settings.Default.KeyboardAndDictionaryLanguage);

            try
            {
                entries = new Dictionary<string, List<DictionaryEntry>>();
                manageAutoComplete = CreateAutoComplete();

                //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 #7
0
 public void Arrange()
 {
     autoComplete = CreateAutoComplete();
 }
Example #8
0
 public DictionaryService(IManageAutoComplete<DictionaryEntry> autoComplete)
 {
     this.autoComplete = autoComplete;
     MigrateLegacyDictionaries();
     LoadDictionary();
 }