public string[] Transform_RussianDictionary_StringRepresentation(double[] numbers)
        {
            var dictionary = new RussianDictionary().Create();
            var words      = new Words(dictionary);

            return(numbers.Transform(new WordsDecorator <double, string>(words, dictionary)));
        }
Exemplo n.º 2
0
        private void languageInit()
        {
            int[] languageCodes = map_language.Keys.ToArray();
            int   languageCode  = -1;

            foreach (int lc in languageCodes)
            {
                if (map_language[lc].Equals(languageName))
                {
                    languageCode = lc;
                    break;
                }
            }

            switch (languageCode)
            {
            case 1:
                language = new EnglishDictionary();
                break;

            case 2:
                language = new RussianDictionary();
                break;

            case 3:
                language = new PolishDictionary();
                break;

            default:
                throw new NotExistingDictionaryException();
            }
        }
Exemplo n.º 3
0
 public IActionResult SearchWord(string word)
 {
     try
     {
         RussianDictionary w = _dbContext.RussianDictionaries.FirstOrDefault(a => a.Word == word);
         return(Json(w.Definition));
     }
     catch (Exception)
     {
         return(Json("Неккоректно введено слово, или по введенному слову данных нет."));
     }
 }
Exemplo n.º 4
0
        public void Dictionary()
        {
            if (!_dbContext.RussianDictionaries.Any())
            {
                var filePath = "Files/russian_nouns_with_definition.txt";
                var lines    = File.ReadAllLines(filePath);

                foreach (var line in lines)
                {
                    RussianDictionary w = new RussianDictionary();

                    string[] words = line.Split(new char[] { ':' });

                    w.Word       = words[0];
                    w.Definition = line;

                    _dbContext.RussianDictionaries.Add(w);
                }
                _dbContext.SaveChanges();
            }
        }