private SimpleResponse ReadSingleForm(Word w, WordForm f, bool isLast) { var wordForm = f.Word; var accent = f.GetAccentIndex(); var grammemes = new List <string>(); // pos grammemes.Add(f.Tag.Pos switch { Pos.None => "", Pos.Noun => "существительное", Pos.Verb => "глагол", Pos.Adjective => "прилагательное", Pos.Adverb => "наречие", Pos.Numeral => "числительное", Pos.Participle => "причастие", Pos.Transgressive => "междометие", Pos.Pronoun => "местоимение", Pos.Preposition => "предлог", Pos.Conjunction => "союз", Pos.Particle => "частица", Pos.Interjection => "деепричастие", Pos.Predicative => "предикатив", Pos.Parenthesis => "вводное слово", _ => "" });
public IViewComponentResult Invoke(WordForm wordForm) { var contextTypeNames = _config.ContextTypeName.Split("|"); var contextTypeName = Formatters[wordForm](contextTypeNames); return(View("Default", contextTypeName)); // Views/Shared/Components/StimuliTypeName/Default.cshtml }
public WordForm GetMainForm(string wordForm) { WordForm result = null; string query = @" select Id, NormalFormId,Raw, IsNormalForm from simplemorf2 where NormalFormId = ( select NormalFormId from simplemorf2 where Raw = @wordForm limit 1) and IsNormalForm = 1 limit 1; "; using (var conn = new MySqlConnection(_dbConnString)){ conn.Open(); var command = new MySqlCommand(query, conn); command.Parameters.AddWithValue("@wordForm", wordForm); using (var reader = command.ExecuteReader()){ while (reader.Read()) { result = new WordForm() { Id = reader.GetInt32(reader.GetOrdinal("Id")), MainFormId = reader.GetInt32(reader.GetOrdinal("NormalFormId")), Raw = reader.GetString(reader.GetOrdinal("Raw")), IsMainForm = reader.GetBoolean(reader.GetOrdinal("IsNormalForm")) }; break; } } } return(result); }
public static WordForm FindSimilarSourceForm(string form, Predicate <WordForm> filter = null) { if (filter == null) { filter = (w) => true; } var wordForm = new WordForm { Form = form }; var res = BinarySearcher.FindSimilar(Items, wordForm, new StringReverseComparer <WordForm>(), filter); if (res.Equals(default(WordForm))) { return(res); } var s1 = form; var s2 = res.Form; GetDifferenceReverse(ref s1, ref s2); if (res.SourceForm.StartsWith(s2)) { res.SourceForm = s1 + res.SourceForm.Substring(s2.Length); res.Form = form; return(res); } return(default(WordForm)); }
public IEnumerable <WordForm> GetWordForms(int wordFormId) { var result = new List <WordForm>(); string query = @" select Id, NormalFormId,Raw, IsNormalForm from simplemorf2 where NormalFormId = ( select NormalFormId from simplemorf2 where Id = @wordFormId limit 1); "; using (var conn = new MySqlConnection(_dbConnString)){ conn.Open(); var command = new MySqlCommand(query, conn); command.Parameters.AddWithValue("@wordFormId", wordFormId); using (var reader = command.ExecuteReader()){ while (reader.Read()) { var wf = new WordForm() { Id = reader.GetInt32(reader.GetOrdinal("Id")), MainFormId = reader.GetInt32(reader.GetOrdinal("NormalFormId")), Raw = reader.GetString(reader.GetOrdinal("Raw")), IsMainForm = reader.GetBoolean(reader.GetOrdinal("IsNormalForm")) }; result.Add(wf); } } } return(result); }
public static List <Item> AddSample(this List <Item> items, WordForm wordForm, WordDefinition word, int index = 0) { items.Add(new Item { Text = $@" <h5>{wordForm.StressedWord} <i>({word.Translations.FirstOrDefault()})</i> <span class='text-muted small'>{wordForm.FormDescription}</span></h5> <h1>{wordForm.Samples[index].SampleText.Replace(wordForm.Word, $"<b><u>{wordForm.StressedWord}</u></b>")}</h1> <footer class='text-center'>{wordForm.Samples[index].Translation}</footer> ", Audio = wordForm.Samples[index].AudioSource.Uri.AbsoluteUri, Word = wordForm.Word, Id = wordForm.Samples[index].Key }); items.Add(new Item { Text = $@" <h5>{wordForm.StressedWord} <i>({word.Translations.FirstOrDefault()})</i> <span class='text-muted small'>{wordForm.FormDescription}</span></h5> <h1>{wordForm.Samples[index].SampleText.Replace(wordForm.Word, $"<b><u>{wordForm.StressedWord}</u></b>")}</h1> <footer class='text-center'>{wordForm.Samples[index].Translation}</footer> ", Read = wordForm.Samples[index].Translation, Word = wordForm.Word, Id = wordForm.Samples[index].Key }); items.Add(new Item { Text = $@" <h5>{wordForm.StressedWord} <i>({word.Translations.FirstOrDefault()})</i> <span class='text-muted small'>{wordForm.FormDescription}</span></h5> <h1>{wordForm.Samples[index].SampleText.Replace(wordForm.Word, $"<b><u>{wordForm.StressedWord}</u></b>")}</h1> <footer class='text-center'>{wordForm.Samples[index].Translation}</footer> ", Audio = wordForm.Samples[index].AudioSource.Uri.AbsoluteUri, Word = wordForm.Word, Id = wordForm.Samples[index].Key }); return(items); }
public static IEnumerable <WordForm> FindAllSourceForm(string form) { var wordForm = new WordForm { Form = form }; return(BinarySearcher.FindAll(Items, wordForm, new StringReverseComparer <WordForm>())); }
public static List <Item> ReadEnglishFormDescription(this List <Item> items, WordForm wordForm, WordDefinition word) { items.Add(new Item { Read = wordForm.FormDescription + " form" }); return(items); }
public static List <Item> PlayRussianAudios(this List <Item> items, WordForm wordForm, WordDefinition word) { for (int i = 0; i < 3 && i < wordForm.AudioSources.Count; i++) { items.PlayRussianAudio(wordForm, word, i).AddPause(1); } return(items); }
public static List <Item> AddSamples(this List <Item> items, WordForm wordForm, WordDefinition word) { for (int i = 0; i < wordForm.Samples.Count; i++) { items.AddSample(wordForm, word, i).AddPause(2); } return(items); }
private void WriteWordForm(HtmlTextWriter writer, WordForm wordForm) { writer.AddAttribute(HtmlTextWriterAttribute.Class, CssWordArticle); if (wordForm.Name == wordForm.WordInfo.Word.Name) { writer.AddAttribute("id", CreateId(WordIdPrefix, wordForm.WordInfo.Word.Name)); } writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Class, CssWordForm); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.WriteLine(wordForm.Title); writer.RenderEndTag(); if (wordForm.Name != wordForm.WordInfo.Word.Name) { writer.AddAttribute(HtmlTextWriterAttribute.Class, CssWordRef); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write("see: "); writer.AddAttribute(HtmlTextWriterAttribute.Href, "#" + CreateId(WordIdPrefix, wordForm.WordInfo.Word.Name)); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.Write(wordForm.WordInfo.Word.Name); writer.RenderEndTag(); writer.RenderEndTag(); } else { ArticleLexer parser = new ArticleLexer(); List <Token> tokens = parser.Parse(wordForm.WordInfo.Word.Description); bool afterNewLine = false; foreach (Token token in tokens) { if (token.Type == TokenType.NewLine) { if (afterNewLine) { writer.WriteLine("<br/>"); } afterNewLine = true; } else { afterNewLine = false; WriteToken(writer, token); } } } writer.RenderEndTag(); }
/// <summary> /// Добавляет новую лексему к модели. /// </summary> /// <param name="lexem">Лексема.</param> public void AddLexem(WordForm lexem) { ulong tagOut = (ulong)Tag.NoWord; ulong tag = (ulong)lexem.Tag; if (builder.TryGetValue(lexem.Word, out tagOut)) { tag |= tagOut; } builder.Insert(lexem.Word, tag); }
public override string ToString() { StringBuilder result = new StringBuilder(200); result.Append("word: ").Append(WordForm.ToString()).Append(" | "); result.Append("position: ").Append(Position.ToString()).Append(" | "); result.Append("lemma: ").Append(Lemma.ToString()).Append(" | "); result.Append("cpos: ").Append(CPOSTag.ToString()).Append(" | "); result.Append("parent: ").Append(HeadNumber.ToString()).Append(" | "); result.Append("count: ").Append(TokenCount.ToString()).Append(" | ").Append("chasbidegi:").Append(ChasbidegiType.ToString()); return(result.ToString()); }
public EsEntry Step2_MakeEsEntry() { var ws = WordForm.Split(' '); var ls = Lemma.Split(' '); var ps = PosTag.Split(' '); switch (ws.Length) { case 1: return(new EsEntry { Key = Key, N = N, W0 = $"µ{ws[0]}µ", L0 = $"µ{ls[0]}µ", P0 = $"µ{ps[0]}µ", }); case 2: return(new EsEntry { Key = Key, N = N, W0 = $"µ{ws[0]}µ", W1 = $"µ{ws[1]}µ", L0 = $"µ{ls[0]}µ", L1 = $"µ{ls[1]}µ", P0 = $"µ{ps[0]}µ", P1 = $"µ{ps[1]}µ", }); case 3: return(new EsEntry { Key = Key, N = N, W0 = $"µ{ws[0]}µ", W1 = $"µ{ws[1]}µ", W2 = $"µ{ws[2]}µ", L0 = $"µ{ls[0]}µ", L1 = $"µ{ls[1]}µ", L2 = $"µ{ls[2]}µ", P0 = $"µ{ps[0]}µ", P1 = $"µ{ps[1]}µ", P2 = $"µ{ps[2]}µ", }); } return(null); }
public IViewComponentResult Invoke(WordForm wordForm, bool describeDecoration) { var targetTypeNames = _config.TargetTypeName.Split("|"); var targetTypeName = Formatters[wordForm](targetTypeNames); if (describeDecoration) { var targetDecorationFormats = _config.TargetDecorationFormat.Split("|"); var targetDecorationFormat = Formatters[wordForm](targetDecorationFormats); targetTypeName = string.Format(targetDecorationFormat, targetTypeName); } return(View("Default", targetTypeName)); // Views/Shared/Components/TargetTypeName/Default.cshtml }
public static List <Item> PlayRussianAudio(this List <Item> items, WordForm wordForm, WordDefinition word, int index = 0) { items.Add(new Item { Text = $@" <h5><span class='text-muted small'>{word.WordType} {wordForm.FormDescription} - {string.Join(", ", word.Tags)}</span></h5> <h1>{wordForm.StressedWord}</h1> <footer class='text-center'>{string.Join(", ", word.Translations)}</footer> ", Audio = wordForm.AudioSources[index].Uri.AbsoluteUri, Word = wordForm.Word, Id = wordForm.AudioSources[index].Key }); return(items); }
public async Task TestTatoebaSentenceProviderAsync() { var word = new WordForm { Word = "учиться" }; //var sentenceProvider = new TatoebaSentenceProvider(); //var sentences = await sentenceProvider.GetSentences(word); //Assert.IsTrue(words.Count() == 1, "Expected 1 words in the collection"); //Assert.IsTrue(words.First().WordType == "noun"); //Assert.IsTrue(words.First().WordForms.Count == 12); //Assert.IsTrue(words.First().Tags.Contains("inanimate")); //Assert.IsTrue(words.First().Tags.Contains("female")); //Assert.IsTrue(words.First().Rank == 69); }
private void Search(object sender, EventArgs eventArgs) { if (!searchPending) { return; } if (!SearchEnabled) { return; } if (WordList == null) { return; } searchPending = false; string searchText = (SearchText ?? "").Trim(); IEnumerable <WordForm> forms = WordList.GetAllForms(); List <WordForm> filteredForms = forms.Where(w => w.Name.StartsWith(searchText, true, CultureInfo.InvariantCulture)).OrderBy(w => w.Name).ToList(); WordForm matchingWordForm = null; foreach (WordForm wordForm in filteredForms) { if (wordForm.Name.Equals(searchText, StringComparison.InvariantCultureIgnoreCase)) { if (matchingWordForm == null || wordForm.WordInfo.Word.Name.Equals(searchText, StringComparison.InvariantCultureIgnoreCase)) { matchingWordForm = wordForm; } } } MatchingWords = new ObservableCollection <WordForm>(filteredForms); if (matchingWordForm != null) { CurrentWordForm = matchingWordForm; } }
/// <inheritdoc /> public string ConvertToOrdinal(int number, WordForm wordForm) => Transformer.Transform(Inner.ConvertToOrdinal(number, wordForm));
public static List <Item> AddWordIntro(this List <Item> items, WordDefinition word, WordForm wordForm) { items.Add(new Item { Text = $"<h1>{wordForm.StressedWord}</h1><h2>{string.Join(", ", word.Translations)}</h2>", Word = word.Word.Word, Id = wordForm.Key }); return(items); }
public void GetDataPins_Entries_Ok() { WordFormsPart part = GetEmptyPart(); for (int n = 1; n <= 3; n++) { // La Lb Lc var form = new WordForm { Lemma = "L" + new string((char)('a' + n - 1), 1), Pos = n % 2 == 0? "even" : "odd" }; // LA LB LC form.Lid = form.Lemma.ToUpperInvariant(); if (n == 2) { form.Variants.Add(new VariantForm { Value = "Váriant" }); } part.Forms.Add(form); } List <DataPin> pins = part.GetDataPins(null).ToList(); Assert.Equal(14, pins.Count); DataPin pin = pins.Find(p => p.Name == "tot-count"); Assert.NotNull(pin); TestHelper.AssertPinIds(part, pin); Assert.Equal("3", pin.Value); pin = pins.Find(p => p.Name == "pos" && p.Value == "odd"); Assert.NotNull(pin); TestHelper.AssertPinIds(part, pin); pin = pins.Find(p => p.Name == "pos" && p.Value == "even"); Assert.NotNull(pin); TestHelper.AssertPinIds(part, pin); pin = pins.Find(p => p.Name == "variant" && p.Value == "variant"); Assert.NotNull(pin); TestHelper.AssertPinIds(part, pin); pin = pins.Find(p => p.Name == "u-variant" && p.Value == "Váriant"); Assert.NotNull(pin); TestHelper.AssertPinIds(part, pin); for (char c = 'a'; c <= 'c'; c++) { char uc = char.ToUpper(c); pin = pins.Find(p => p.Name == "lid" && p.Value == $"L{uc}"); Assert.NotNull(pin); TestHelper.AssertPinIds(part, pin); pin = pins.Find(p => p.Name == "lemma" && p.Value == $"l{c}"); Assert.NotNull(pin); TestHelper.AssertPinIds(part, pin); pin = pins.Find(p => p.Name == "u-lemma" && p.Value == $"L{c}"); Assert.NotNull(pin); TestHelper.AssertPinIds(part, pin); } }
/// <summary> /// Запускает процесс обучения модели. /// </summary> /// <param name="corporaFile">Исходный файл корпуса.</param> /// <param name="sentCount">Количество предложений, которые будут прочитаны.</param> /// <param name="concurrent"><c>true</c>, если обучение должно происходить /// параллельно (для такого варианта может понадобиться больше памяти, но /// процесс займёт меньше времени).</param> /// <remarks>Может занять очень много времени и использовать большое /// количество памяти.</remarks> public void Train(string corporaFile, ICorporaReader reader, int sentCount, bool concurrent) { punctuation = new List <string>(); sentenceDelimiters = new List <string>(); reader.Open(corporaFile); //читаем заданное количество предложений int i = 0; foreach (var sentence in reader.ReadSentences(sentCount)) { //запишем все знаки пунктуации, которые встретим foreach (var punc in sentence.Where(a => (a.Tag & Tag.Punctuation) != 0 && !punctuation.Contains(a.Word))) { punctuation.Add(punc.Word); } WordForm last = sentence.Last(); if ((last.Tag & Tag.Punctuation) != 0 && !sentenceDelimiters.Contains(last.Word)) { sentenceDelimiters.Add(last.Word); } if (sentence.Count(lexem => lexem.Tag == Tag.NoWord) == 0) { #if DEBUG i++; Console.Write(string.Format("\rПредложений прочитано: {0}", i)); #endif //строим все возможные окна длины 7 foreach (var window in Utils.BuildAllWindows(sentence, 7)) { Tag tag = window.Skip(3).First().Tag; //тэг разгадываемого слова foreach (var group in groups) //для каждой группы { group.AddVector(window.ToVector(nGramm, entClass), tag); } } } } if (concurrent) //обучаем параллельно { Parallel.ForEach <TagGroup>(groups, (group) => { group.Train(true); }); } else { //обучаем последовательно i = 0; foreach (var group in groups) { group.Train(false); #if DEBUG Console.WriteLine("Закончено обучение группы " + i); #endif i++; } } string pattern = @"(-?\d+(?:\.\d+)?|"; foreach (var sign in punctuation) { pattern += Regex.Escape(sign) + "+|"; } pattern = pattern + @"\s+)"; this.lexemPattern = new Regex(pattern); this.sentencePattern = new Regex(@"(\.+|!|\?)"); reader.Close(); }
/// <summary> /// Трунирует модель целиком. /// </summary> /// <param name="corporaFile">Файл корпуса.</param> /// <param name="reader">Объект для чтения корпуса.</param> /// <param name="sentCount">Количество предложений.</param> /// <param name="concurrent">Установить <c>true</c>, если необходимо выполнить параллельно. </param> private void TrainFull(string corporaFile, ICorporaReader reader, int sentCount, bool concurrent) { reader.Open(corporaFile); punctuation = new List <string>(); sentenceDelimiters = new List <string>(); reader.Open(corporaFile); //читаем заданное количество предложений foreach (var sentence in reader.ReadSentences(sentCount)) { //предлоги в корпусе не имеют падежа, а союзы не имеют типа //чтобы добавить эту информацию, воспользуемся модифицированным словарём foreach (var lexem in sentence) { if (serviceTags.ContainsKey(lexem.Word.ToLower())) { lexem.Tag = serviceTags[lexem.Word]; } } //запишем все знаки пунктуации, которые встретим foreach (var punc in sentence.Where(a => (a.Tag & Tag.Punctuation) != 0 && !a.Word.Any((c) => char.IsLetter(c)) && !punctuation.Contains(a.Word))) { punctuation.Add(punc.Word); } WordForm last = sentence.Last(); if ((last.Tag & Tag.Punctuation) != 0 && !sentenceDelimiters.Contains(last.Word)) { sentenceDelimiters.Add(last.Word); } if (sentence.Count(lexem => lexem.Tag == Tag.NoWord || lexem.Tag == Tag.Unfixed) == 0) { //строим все возможные окна длины 7 foreach (var window in Utils.BuildAllWindows(sentence, 7)) { Tag tag = window.Skip(3).First().Tag; //тэг разгадываемого слова foreach (var group in groups) //для каждой группы { group.AddVector(window.ToVector(nGramm, entClass), tag); } } } } if (concurrent) //обучаем параллельно { Parallel.ForEach(groups, (group) => { group.Train(true); }); } else { foreach (var group in groups) { group.Train(false); } } string pattern = @"(-?\d+(?:\.\d+)?|"; foreach (var sign in punctuation) { pattern += Regex.Escape(sign) + "+|"; } pattern = pattern + @"\s+)"; this.lexemPattern = new Regex(pattern); this.sentencePattern = new Regex(@"(\.+|!|\?)"); reader.Close(); }
// Get data properties depending on the type. public string GetItemProperty(int id, ServerData data, PropertyData property) { switch (data) { case ServerData.Video: Video video = _context.Videos.Where(u => u.Id == id).FirstOrDefault(); if (video == null) { return(null); } switch (property) { case PropertyData.Name: return(video.Name); case PropertyData.Description: return(video.Description); case PropertyData.Path: return(video.Path); case PropertyData.Imgpath: return(video.ImgPath); case PropertyData.SubPath: return(video.SubPath); case PropertyData.Year: return(video.Year == null? null: video.Year.ToString()); case PropertyData.Created: return(video.Created.ToLongDateString()); } break; case ServerData.Book: Book book = _context.Books.Where(u => u.Id == id).FirstOrDefault(); if (book == null) { return(null); } switch (property) { case PropertyData.Name: return(book.Name); case PropertyData.Description: return(book.Description); case PropertyData.Path: return(book.Path); case PropertyData.Imgpath: return(book.ImgPath); case PropertyData.Year: return(book.Year == null ? null : book.Year.ToString()); case PropertyData.Created: return(book.Created.ToLongDateString()); } break; case ServerData.Game: Game game = _context.Games.Where(u => u.Id == id).FirstOrDefault(); if (game == null) { return(null); } switch (property) { case PropertyData.Name: return(game.Name); case PropertyData.Description: return(game.Description); } break; case ServerData.Grammar: Grammar grammar = _context.Grammars.Where(u => u.Id == id).FirstOrDefault(); if (grammar == null) { return(null); } switch (property) { case PropertyData.Name: return(grammar.Title); case PropertyData.Description: return(grammar.Description); } break; case ServerData.Rule: Entities.Rule rule = _context.Rules.Where(u => u.Id == id).FirstOrDefault(); switch (property) { case PropertyData.Name: return(rule?.Name); } break; case ServerData.GrammarExample: GrammarExample ge = _context.GrammarExamples.Where(u => u.Id == id).FirstOrDefault(); switch (property) { case PropertyData.Name: return(ge?.Name); } break; case ServerData.GrammarException: GrammarException gex = _context.Exceptions.Where(u => u.Id == id).FirstOrDefault(); switch (property) { case PropertyData.Name: return(gex?.Name); } break; case ServerData.Role: Role role = _context.Roles.Where(u => u.Id == id).FirstOrDefault(); switch (property) { case PropertyData.Name: return(role?.Name); } break; case ServerData.User: User user = _context.Users.Where(u => u.Id == id).FirstOrDefault(); if (user == null) { return(null); } switch (property) { case PropertyData.Name: case PropertyData.Login: return(user.Username); case PropertyData.Imgpath: return(user.Avatar); case PropertyData.Password: return(user.Password); case PropertyData.ScoreCount: int score = 0; foreach (Score item in _context.Scores.Where(s => s.UserID == user.Id).ToList()) { score += item.ScoreCount; } return(score.ToString()); case PropertyData.Level: return(user.Level.ToString()); case PropertyData.Role: return(user.RoleID.ToString()); case PropertyData.RolesName: return(_context.Roles.Where(r => r.Id == user.RoleID).FirstOrDefault()?.Name); } break; case ServerData.VideoCategory: VideoCategory videoCategory = _context.VideoCategories.Where(u => u.Id == id).FirstOrDefault(); if (videoCategory == null) { return(null); } switch (property) { case PropertyData.Name: return(videoCategory.Name); } break; case ServerData.BookCategory: BookCategory bookCategory = _context.BookCategories.Where(u => u.Id == id).FirstOrDefault(); if (bookCategory == null) { return(null); } switch (property) { case PropertyData.Name: return(bookCategory.Name); } break; case ServerData.Word: Word word = _context.Dictionary.Where(u => u.Id == id).FirstOrDefault(); if (word == null) { return(null); } switch (property) { case PropertyData.Name: return(word.Name); case PropertyData.Imgpath: return(word.ImgPath); case PropertyData.PluralForm: return(_context.WordForms.Where(f => f.Id == word.FormID).FirstOrDefault()?.PluralForm); case PropertyData.PastForm: return(_context.WordForms.Where(f => f.Id == word.FormID).FirstOrDefault()?.PastForm); case PropertyData.PastThForm: return(_context.WordForms.Where(f => f.Id == word.FormID).FirstOrDefault()?.PastThForm); case PropertyData.Transcription: return(word.TranscriptionID == null? null: word.TranscriptionID.ToString()); } break; case ServerData.WordForm: WordForm wordForm = _context.WordForms.Where(u => u.Id == id).FirstOrDefault(); if (wordForm == null) { return(null); } switch (property) { case PropertyData.PastForm: return(wordForm.PastForm); case PropertyData.PastThForm: return(wordForm.PastThForm); case PropertyData.PluralForm: return(wordForm.PluralForm); } break; case ServerData.Group: WordsGroup group = _context.Groups.Where(u => u.Id == id).FirstOrDefault(); if (group == null) { return(null); } switch (property) { case PropertyData.Name: return(group.Name); } break; case ServerData.WordCategory: WordCategory wordCategory = _context.WordCategories.Where(u => u.Id == id).FirstOrDefault(); if (wordCategory == null) { return(null); } switch (property) { case PropertyData.Name: return(wordCategory.Name); case PropertyData.Abbreviation: return(wordCategory.Abbreviation); } break; case ServerData.Transcription: Transcription transcription = _context.Transcriptions.Where(u => u.Id == id).FirstOrDefault(); if (transcription == null) { return(null); } switch (property) { case PropertyData.British: return(transcription.British); case PropertyData.Canadian: return(transcription.Canadian); case PropertyData.Australian: return(transcription.Australian); case PropertyData.American: return(transcription.American); } break; case ServerData.Translation: Translation translation = _context.Translations.Where(u => u.Id == id).FirstOrDefault(); if (translation == null) { return(null); } switch (property) { case PropertyData.Name: return(translation.Name); } break; case ServerData.Definition: Definition definition = _context.Definitions.Where(u => u.Id == id).FirstOrDefault(); if (definition == null) { return(null); } switch (property) { case PropertyData.Name: return(definition.Name); } break; case ServerData.Author: Author author = _context.Authors.Where(u => u.Id == id).FirstOrDefault(); if (author == null) { return(null); } switch (property) { case PropertyData.Name: return(author.Name); case PropertyData.Surname: return(author.Surname); } break; case ServerData.Example: Example example = _context.Examples.Where(u => u.Id == id).FirstOrDefault(); if (example == null) { return(null); } switch (property) { case PropertyData.Name: return(example.Name); } break; case ServerData.VideoBookmark: VideoBookmark videoBookmark = _context.VideoBookmarks.Where(u => u.Id == id).FirstOrDefault(); if (videoBookmark == null) { return(null); } switch (property) { case PropertyData.Position: return(videoBookmark.Position.ToString()); } break; case ServerData.Bookmark: Bookmark bookmark = _context.Bookmarks.Where(u => u.Id == id).FirstOrDefault(); if (bookmark == null) { return(null); } switch (property) { case PropertyData.Position: return(bookmark.Position.ToString()); } break; } return(null); }
/// <inheritdoc /> public string Convert(int number, string numberString, GrammaticalGender gender, WordForm wordForm) => Transformer.Transform(Inner.Convert(number, numberString, gender, wordForm));
/// <inheritdoc /> public string Convert(long number, bool addAnd, WordForm wordForm) => Transformer.Transform(Inner.Convert(number, addAnd, wordForm));
/// <inheritdoc /> public string Convert(long number, WordForm wordForm, GrammaticalGender gender, bool addAnd = true) => Transformer.Transform(Inner.Convert(number, wordForm, gender, addAnd));
/// <inheritdoc /> public string ConvertToOrdinal(int number, GrammaticalGender gender, WordForm wordForm) => Transformer.Transform(Inner.ConvertToOrdinal(number, gender, wordForm));
/// <inheritdoc /> public string Convert(int number, string numberString, WordForm wordForm) => Transformer.Transform(Inner.Convert(number, numberString, wordForm));