internal void Deserialize(Pullenti.Morph.Internal.ByteArrayWrapper str, ref int pos) { byte b = str.DeserializeByte(ref pos); Transitive = b != 0; int sh = str.DeserializeShort(ref pos); Questions = (Pullenti.Semantic.Utils.QuestionType)sh; sh = str.DeserializeShort(ref pos); if (sh != 0) { string pr = str.DeserializeString(ref pos); Pullenti.Morph.MorphCase cas = new Pullenti.Morph.MorphCase(); cas.Value = (short)sh; Agent = new NextModelItem(pr, cas); } sh = str.DeserializeShort(ref pos); if (sh != 0) { string pr = str.DeserializeString(ref pos); Pullenti.Morph.MorphCase cas = new Pullenti.Morph.MorphCase(); cas.Value = (short)sh; Pacient = new NextModelItem(pr, cas); } sh = str.DeserializeShort(ref pos); if (sh != 0) { string pr = str.DeserializeString(ref pos); Pullenti.Morph.MorphCase cas = new Pullenti.Morph.MorphCase(); cas.Value = (short)sh; Instrument = new NextModelItem(pr, cas); } int cou = str.DeserializeShort(ref pos); for (; cou > 0; cou--) { string pref = str.DeserializeString(ref pos); if (pref == null) { pref = ""; } Pullenti.Morph.MorphCase cas = new Pullenti.Morph.MorphCase(); sh = str.DeserializeShort(ref pos); cas.Value = (short)sh; if (Nexts == null) { Nexts = new Dictionary <string, Pullenti.Morph.MorphCase>(); } Nexts.Add(pref, cas); } }
public int CompareTo(NextModelItem other) { int i = string.Compare(Preposition, other.Preposition); if (i != 0) { return(i); } if (this._casRank() < other._casRank()) { return(-1); } if (this._casRank() > other._casRank()) { return(1); } return(0); }
public static void Initialize() { if (Items != null) { return; } Items = new List <NextModelItem>(); Items.Add(new NextModelItem("", Pullenti.Morph.MorphCase.Nominative)); Items.Add(new NextModelItem("", Pullenti.Morph.MorphCase.Genitive)); Items.Add(new NextModelItem("", Pullenti.Morph.MorphCase.Dative)); Items.Add(new NextModelItem("", Pullenti.Morph.MorphCase.Accusative)); Items.Add(new NextModelItem("", Pullenti.Morph.MorphCase.Instrumental)); Items.Add(new NextModelItem("", Pullenti.Morph.MorphCase.Prepositional)); foreach (string s in new string[] { "ИЗ", "ОТ", "С", "ИЗНУТРИ" }) { Items.Add(new NextModelItem(s, Pullenti.Morph.MorphCase.Genitive, null, Pullenti.Semantic.Utils.QuestionType.WhereFrom)); } Items.Add(new NextModelItem("В", Pullenti.Morph.MorphCase.Accusative, null, Pullenti.Semantic.Utils.QuestionType.WhereTo)); Items.Add(new NextModelItem("НА", Pullenti.Morph.MorphCase.Accusative, null, Pullenti.Semantic.Utils.QuestionType.WhereTo)); Items.Add(new NextModelItem("ПО", Pullenti.Morph.MorphCase.Accusative, null, Pullenti.Semantic.Utils.QuestionType.WhereTo)); Items.Add(new NextModelItem("К", Pullenti.Morph.MorphCase.Dative, null, Pullenti.Semantic.Utils.QuestionType.WhereTo)); Items.Add(new NextModelItem("НАВСТРЕЧУ", Pullenti.Morph.MorphCase.Dative, null, Pullenti.Semantic.Utils.QuestionType.WhereTo)); Items.Add(new NextModelItem("ДО", Pullenti.Morph.MorphCase.Genitive, null, Pullenti.Semantic.Utils.QuestionType.WhereTo)); foreach (string s in new string[] { "У", "ОКОЛО", "ВОКРУГ", "ВОЗЛЕ", "ВБЛИЗИ", "МИМО", "ПОЗАДИ", "ВПЕРЕДИ", "ВГЛУБЬ", "ВДОЛЬ", "ВНЕ", "КРОМЕ", "МЕЖДУ", "НАПРОТИВ", "ПОВЕРХ", "ПОДЛЕ", "ПОПЕРЕК", "ПОСЕРЕДИНЕ", "СВЕРХ", "СРЕДИ", "СНАРУЖИ", "ВНУТРИ" }) { Items.Add(new NextModelItem(s, Pullenti.Morph.MorphCase.Genitive, null, Pullenti.Semantic.Utils.QuestionType.Where)); } foreach (string s in new string[] { "ПАРАЛЛЕЛЬНО" }) { Items.Add(new NextModelItem(s, Pullenti.Morph.MorphCase.Dative, null, Pullenti.Semantic.Utils.QuestionType.Where)); } foreach (string s in new string[] { "СКВОЗЬ", "ЧЕРЕЗ", "ПОД" }) { Items.Add(new NextModelItem(s, Pullenti.Morph.MorphCase.Accusative, null, Pullenti.Semantic.Utils.QuestionType.Where)); } foreach (string s in new string[] { "МЕЖДУ", "НАД", "ПОД", "ПЕРЕД", "ЗА" }) { Items.Add(new NextModelItem(s, Pullenti.Morph.MorphCase.Instrumental, null, Pullenti.Semantic.Utils.QuestionType.Where)); } foreach (string s in new string[] { "В", "НА", "ПРИ" }) { Items.Add(new NextModelItem(s, Pullenti.Morph.MorphCase.Prepositional, null, Pullenti.Semantic.Utils.QuestionType.Where)); } Items.Add(new NextModelItem("ПРЕЖДЕ", Pullenti.Morph.MorphCase.Genitive, null, Pullenti.Semantic.Utils.QuestionType.When)); Items.Add(new NextModelItem("ПОСЛЕ", Pullenti.Morph.MorphCase.Genitive, null, Pullenti.Semantic.Utils.QuestionType.When)); Items.Add(new NextModelItem("НАКАНУНЕ", Pullenti.Morph.MorphCase.Genitive, null, Pullenti.Semantic.Utils.QuestionType.When)); Items.Add(new NextModelItem("СПУСТЯ", Pullenti.Morph.MorphCase.Accusative, null, Pullenti.Semantic.Utils.QuestionType.When)); foreach (string s in new string[] { "БЕЗ", "ДЛЯ", "РАДИ", "ИЗЗА", "ВВИДУ", "ВЗАМЕН", "ВМЕСТО", "ПРОТИВ", "СВЫШЕ", "ВСЛЕДСТВИЕ", "ПОМИМО", "ПОСРЕДСТВОМ" }) { Items.Add(new NextModelItem(s, Pullenti.Morph.MorphCase.Genitive)); } foreach (string s in new string[] { "ПО", "ПОДОБНО", "СОГЛАСНО", "СООТВЕТСТВЕННО", "СОРАЗМЕРНО", "ВОПРЕКИ" }) { Items.Add(new NextModelItem(s, Pullenti.Morph.MorphCase.Dative)); } foreach (string s in new string[] { "ПРО", "О", "ЗА", "ВКЛЮЧАЯ", "С" }) { Items.Add(new NextModelItem(s, Pullenti.Morph.MorphCase.Accusative)); } foreach (string s in new string[] { "С" }) { Items.Add(new NextModelItem(s, Pullenti.Morph.MorphCase.Instrumental)); } foreach (string s in new string[] { "О", "ПО" }) { Items.Add(new NextModelItem(s, Pullenti.Morph.MorphCase.Prepositional)); } for (int i = 0; i < Items.Count; i++) { for (int j = 0; j < (Items.Count - 1); j++) { if (Items[j].CompareTo(Items[j + 1]) > 0) { NextModelItem it = Items[j]; Items[j] = Items[j + 1]; Items[j + 1] = it; } } } for (int i = 0; i < Items.Count; i++) { Items[i].Id = i + 1; } }