public void Start_goodSize(int howManyChanges, int size)
        {
            var adder  = new DiacriticMarksAdder();
            var result = adder.Start(Word, howManyChanges);

            Assert.Equal(size, result.Count);
        }
        public void Start_ExistItem(int howManyChanges)
        {
            var adder  = new DiacriticMarksAdder();
            var result = adder.Start(Word, howManyChanges);

            foreach (var item in _res)
            {
                var contains = result.Contains(item);
                Assert.True(contains);
            }
        }
コード例 #3
0
        private static void Initialize()
        {
            var data          = new DataBaseManager(new MySqlConnectionFactory(), Settings.Server, Settings.DbName, Settings.DbUser, Settings.DbPassword);
            var queryProvider = Settings.AlphabeticalTables
                ? (IQueryProvider) new SqlQueryProviderAlpha(Settings.TableNames)
                : new SqlQueryProvider(Settings.TableNames);

            if (Settings.UseDictionary)
            {
                if (_dictionary == null)
                {
                    _dictionary = LoadDictionary();
                    _main       = _dictionary;
                }
            }
            else
            {
                if (_unigrams == null)
                {
                    _unigrams = LoadUnigrams();
                    _main     = _unigrams;
                }
            }

            _diacriticMarksAdder = new DiacriticMarksAdder();
            _splitter            = Settings.SentenceSpliterOn ? new SentencesSplitter() : null;
            _iManager            = Settings.IgnorePunctationMarks ? new InterpunctionManager() : null;
            _connector           = (Settings.NoOfMethod == 0) ? (INgramsConnector) new UpDown() : new Hierarchy();

            _analyzer = new DiacriticMarksRestorer(_diacriticMarksAdder, _main, _splitter, _iManager, _connector);

            _analyzer.SetData(data);
            _analyzer.SetQueryProvider(queryProvider);
            _analyzer.SetNgram(Settings.Type);
            Timer.Interval = 90;
            Timer.Elapsed += OnTimerElapsed;
        }