private string GetBaseForm(WordInformation word) { if (WordInformation.IsHave(word.BaseForm)) { return(word.BaseForm); } return(word.Surface); }
private WordInformationModel GetWordInformationModel(WordInformation wordInfor, string romajiWords, int index) { string baseForm; string reading; string pronunciation; string conjugation; bool isChecked = false; bool isInDicionary = false; if (wordInfor.IsSymbol() || String.IsNullOrWhiteSpace(wordInfor.Surface)) { reading = null; pronunciation = null; baseForm = null; conjugation = null; isChecked = false; isInDicionary = false; } else { reading = wordInfor.Reading; pronunciation = romajiWords; isInDicionary = wordInfor.IsInDictionary; baseForm = wordInfor.BaseForm; var wrodConjugation = wordInfor.Conjugation; if (WordInformation.IsHave(wrodConjugation)) { conjugation = wrodConjugation; } else { conjugation = null; } if (CurrentSelectedIndex == NO_INDEX && isInDicionary) { CurrentSelectedIndex = index; isChecked = true; } } SolidColorBrush borderColor = GetBorderColor(wordInfor); var word = new WordInformationModel(wordInfor.Surface, conjugation, baseForm, reading, pronunciation, isInDicionary, isChecked, borderColor); word.Index = index; return(word); }
private static List <JmdictEntity> GetMatchedWords(WordInformation word, Database dictionary, string queryCommmand, bool isSkipSurfaceIfHasBaseForm, string conjungation = null) { //Use Dictionary to ensure unique entries Dictionary <int, JmdictEntity> entries = new Dictionary <int, JmdictEntity>(); if (WordInformation.IsHave(word.BaseForm)) { if (word.IsMaybeAmbiguousGodan()) { var allVariants = GetPossibleGodanVerb(word); AddPossibleGodanVerbsDictionaryEntry(allVariants, dictionary, entries, conjungation); if (allVariants.Count == 1) { AddPossibleSpecialSuruVerb(word, dictionary, conjungation, entries); } } else { if (word.IsIAdjectiveConjugation()) { HandleIAdjective(word, dictionary, conjungation, entries); } else if (word.IsVerb()) { HandleVerb(word, dictionary, conjungation, entries); } else if (word.IsAuxiliaryVerb()) { AddVerbDictionaryEntry(word.BaseForm, dictionary, entries, conjungation); } else { AddAllDictionaryEntry(word.BaseForm + queryCommmand, dictionary, entries); } } } if (word.BaseForm == null || entries.Count == 0 || !word.BaseForm.EqualsOrdinalIgnore(word.Surface)) { if (entries.Count == 0 || !isSkipSurfaceIfHasBaseForm) { AddAllDictionaryEntry(word.Surface + queryCommmand, dictionary, entries); } } return(entries.Values.ToList()); }