Esempio n. 1
0
        public static void Fill()
        {
            var      languages         = new LanguagesQuery(LanguageShortName.Unknown, LanguageShortName.Unknown);
            Language language          = languages.GetByShortName(LanguageShortName.En);
            long     englishLanguageId = language.Id;

            IPronunciationQuery pronunciationQuery = new SentencesQuery();

            pronunciationQuery.FillSpeak(englishLanguageId);

            pronunciationQuery = new WordsQuery();
            pronunciationQuery.FillSpeak(englishLanguageId);
        }
Esempio n. 2
0
        public void Write(XElement root)
        {
            _sitemapItemWriter.WriteUrlToResult(root, UrlBuilder.GetSentenceHomeUrl(), 0.75m, ChangeFrequency.MONTHLY);

            ISentencesQuery sentencesQuery = new SentencesQuery();
            List <SourceWithTranslation> sourcesWithTranslation = sentencesQuery.GetByCount(_userLanguages,
                                                                                            SentenceType.Separate,
                                                                                            COUNT_SENTENCES);

            foreach (SourceWithTranslation sourceWithTranslation in sourcesWithTranslation)
            {
                string url =
                    UrlBuilder.GetSentenceHomeTrainerUrl(
                        sourceWithTranslation.Source.Id.ToString(CultureInfo.InvariantCulture),
                        sourceWithTranslation.Translation.Id.ToString(CultureInfo.InvariantCulture));
                _sitemapItemWriter.WriteUrlToResult(root, url, 0.2m, ChangeFrequency.YEARLY);
            }
        }
Esempio n. 3
0
        public void Fill()
        {
            var csvReader = new CsvReader(@"C:\Projects\StudyLanguages\1.csv");

            string[] line;
            var      sentences = new SentencesQuery();
            var      languages = new LanguagesQuery(LanguageShortName.Unknown, LanguageShortName.Unknown);
            Language english   = languages.GetByShortName(LanguageShortName.En);
            Language russian   = languages.GetByShortName(LanguageShortName.Ru);

            do
            {
                line = csvReader.ReadLine();
                if (line != null)
                {
                    SourceWithTranslation sentenceWithTranslation =
                        sentences.GetOrCreate(SentenceType.Separate,
                                              new PronunciationForUser(IdValidator.INVALID_ID, line[0],
                                                                       false, english.Id),
                                              new PronunciationForUser(IdValidator.INVALID_ID, line[1],
                                                                       false, russian.Id),
                                              null, null);
                    Console.WriteLine("{0}: {1}", sentenceWithTranslation != null ? "Сохранено" : "Не сохранено",
                                      line.Aggregate((e1, e2) => e1 + " -> " + e2));
                }
            } while (line != null);

            /* for (int i = 1; i <= 100000; i++) {
             *  SentenceWithTranslation sentenceWithTranslation =
             *      sentences.CreateSentencencesWithTranslation(english, "Test sentence number " + i, russian,
             *                                                  "Тестовое предложение № " + i);
             *  if (sentenceWithTranslation == null) {
             *      Console.WriteLine("Не удалось сохранить предложение {0}. Нажмите Enter...", i);
             *      Console.ReadLine();
             *  }
             *
             *  if (i % 10000 == 0) {
             *      Console.WriteLine("Сохранено {0} предложений", i);
             *  }
             * }*/
        }
Esempio n. 4
0
        private static byte[] GetPronunciation(long id, SpeakerDataType type)
        {
            IPronunciationQuery pronunciationQuery = null;

            if (type == SpeakerDataType.Word)
            {
                pronunciationQuery = new WordsQuery();
            }
            else if (type == SpeakerDataType.Sentence)
            {
                pronunciationQuery = new SentencesQuery();
            }
            if (pronunciationQuery == null)
            {
                LoggerWrapper.LogTo(LoggerName.Errors).ErrorFormat(
                    "SpeakerController.GetPronunciation передан некорректный тип {0}", type);
                return(null);
            }
            IPronunciation pronunciationEntity = pronunciationQuery.GetById(id);

            return(pronunciationEntity != null ? pronunciationEntity.Pronunciation : null);
        }
Esempio n. 5
0
 public HomeController()
 {
     _query             = new SentencesQuery();
     _shuffleController = new ShuffleController(_query, "Index", SectionId.Sentences);
 }