public Slovo Analyze(Predlozhenie pr, int place) { Slovo analyzed = pr[place]; PreAnalyze(pr, place, ref analyzed); return analyzed; }
/** * ЗАГЛУШКА * На выходе должно быть слово на ангийском языке */ public Slovo Translate(Predlozhenie pr, int place) { Slovo analyzed = pr[place]; bool translated = false; if (analyzed.eSlovo == "FQV" || analyzed.eSlovo == "FZJ" || analyzed.eSlovo == "FZP") { analyzed.enSlovo.slovo = ""; translated = true; } else if (analyzed.eSlovo == "FT") { if (place - 1 > 0 && pr[place - 1].eSlovo[0] != 'Q') { analyzed.enSlovo.slovo = ""; translated = true; } } if (!translated) { GetTranslate(ref analyzed); } return analyzed; }
protected void PreAnalyze(Predlozhenie pr, int place, ref Slovo slovo) { // AnalyzeCharacteristicsFromNoun(pr, place, ref slovo); AnalyzeStepenSravnenia(ref slovo); FindOsnova(ref slovo); //GetTranslate(ref slovo); SetExtraData(ref slovo); }
/** * ЗАГЛУШКА * На выходе должно быть слово на ангийском языке */ public Slovo Translate(Predlozhenie pr, int place) { Slovo analyzed = pr[place]; GetTranslate(ref analyzed); return analyzed; }
protected void PreAnalyze(Predlozhenie pr, int place, ref Slovo slovo) { AnalyzeDeeprich(pr, place, ref slovo); // FindOsnova(ref slovo); //GetTranslate(ref slovo); Processing(ref slovo); SetExtraData(ref slovo); }
protected void PreAnalyze(Predlozhenie pr,int place,ref Slovo slovo) { AnalyzePadezh(pr,place,ref slovo); AnalyzeChislo(ref slovo); AnalyzeRod(ref slovo); FindOsnova(ref slovo); //GetTranslate(ref slovo); SetExtraData(ref slovo); }
private void CopyCharact(Predlozhenie pr, int place, ref Slovo analyzed) { int i = (place - 4 >= 0 ? place - 4 : 0); int max = (place + 4 > pr.Count ? pr.Count : place + 4); while (i < max) { Slovo slovpoisk = pr[i]; if (slovpoisk.chastRechi == ChastRechi.Suschestvitelnoe) { break; } else i++; } }
protected void AnalyzeCharacteristicsFromNoun(Predlozhenie pr, int place, ref Slovo analyzed) { // поиск в предложении существительного //и копировaние его хaрaктеристик (родa, числa, пaдежa) Прилaгaтельное int max = place + 4 > pr.Count - 1 ? pr.Count - 1 : place + 4; int min = place - 4 > 0 ? place - 4 : 0; if ((analyzed.chastRechi == ChastRechi.Prilagatelnoe || analyzed.chastRechi == ChastRechi.Prichastie) && pr.Count > 1) { Hashtable sush = new Hashtable(); for (int i = min; i < max; i++) { Slovo slovpoisk = pr[i]; if (slovpoisk.chastRechi == ChastRechi.Suschestvitelnoe) { sush[i] = slovpoisk; //System.Windows.Forms.MessageBox.Show(slovpoisk.rSlovo); } } Slovo res = null; int minres = 999; foreach (int j in sush.Keys) { if (Math.Abs(place - j) < minres || (Math.Abs(place - j) == minres && j > place)) { res = (Slovo)sush[j]; minres = Math.Abs(place - j); } } if (res != null) { analyzed.chislo = res.chislo; analyzed.padezh = res.padezh; analyzed.rod = res.rod; } else { analyzed.chislo = Chislo.Edinstvennoe; analyzed.padezh = Padezh.Imenitelnij; analyzed.rod = Rod.Muzhskoj; } } }
private void GetTranslate(Predlozhenie pr, int place, ref Slovo slovo) { this.slovo = slovo; SQLiteConnection connection = new SQLiteConnection(@"Data Source=dict.sqlitedb;Version=3;"); connection.Open(); SQLiteCommand command = new SQLiteCommand(connection); command.CommandText = "SELECT eng FROM dict WHERE el=@el"; command.Parameters.Add(new SQLiteParameter("el", slovo.eSlovo)); SQLiteDataReader reader = command.ExecuteReader(); if (reader.HasRows && reader.Read() && !reader.IsDBNull(0)) { slovo.enSlovo.slovo = Processing(reader.GetString(0), pr, place); } else { slovo.enSlovo.slovo = " [Нет перевода для " + slovo.eSlovo + "] "; } reader.Close(); connection.Close(); }
protected void AnalyzeDeeprich(Predlozhenie pr, int place, ref Slovo slovo) { string[] temp = slovo.eSlovo.Split('-'); if (temp[0].Length == 1 && temp.Length > 1) { switch (temp[1]) { //совершенный вид case "RBA": slovo.vremya = Vremya.Postoyannoe; break; case "TBA": slovo.vremya = Vremya.Nastoyaschee; break; case "YBA": slovo.vremya = Vremya.Proshedshee; break; case "UBA": slovo.vremya = Vremya.Buduschee; break; default: break; } } }
protected void AnalyzeGlagol(Predlozhenie pr, int place, ref Slovo slovo) { // if (c.eSlovo.Length < 2) return c; bool Zaver = false; /* slovo.zalog = Zalog.Dejstvitekniy;//настройки по умолчанию slovo.chastRechi = ChastRechi.Glagol;//настройки по умолчанию slovo.sostoynie = Sostoynie.Обычное;//настройки по умолчанию slovo.chislo = Chislo.Edinstvennoe;//настройки по умолчанию slovo.rod = Rod.Obshij;//настройки по умолчанию if (slovo.eSlovo[1] == 'A') slovo.zalog = Zalog.Vozvratniy;*/ if (slovo.eSlovo.Length > 3) if (slovo.eSlovo[2] == '-' && slovo.eSlovo[1] == 'S') { slovo.vid = Vid.Zavershennost; Zaver = true; } // NaklSoslag(); string[] temp = slovo.eSlovo.Split('-'); if (temp[0].Length == 1 && temp.Length > 1) { switch (temp[1]) { //совершенный вид case "RBY": //[туко] slovo.vid = Vid.Mgnovennost; break; case "SCY"://[роко] slovo.vid = Vid.NachaloDejstviya; break; case "PVI"://[пэсо]: slovo.vid = Vid.OgranichenieDlitelnosti; break; //несовершенный вид case "PVS"://[пэро] slovo.vid = Vid.NeopredelennayaDlitelnost; break; case "RBA"://[тудо] slovo.vid = Vid.PostoyannayaDlitelnost; break; case "UCS"://[шоро] slovo.vid = Vid.NezavershennostDejstviya; break; default: break; } } for (int i = 1; i < temp.Length; i++) { switch (temp[i]) { //определение дополнительных времён case "RBA"://постоянное(длительное) switch (temp[0][0]) { case 'T': slovo.vremya = Vremya.NastoyascheeDlitelnoe; break; case 'Y': slovo.vremya = Vremya.ProshedsheeDlitelnoe; break; case 'U': slovo.vremya = Vremya.BuduscheeDlitelnoe; break; default: break; } break; case "TBA"://наст switch (temp[0][0]) { case 'T': slovo.vremya = Vremya.NastoyascheeVNastoyaschem; break; case 'Y': slovo.vremya = Vremya.ProshedsheeSNastoyaschim; break; case 'U': slovo.vremya = Vremya.BuduscheeVNastoyaschem; break; default: break; } break; case "YBA"://прош switch (temp[0][0]) { case 'T': slovo.vremya = Vremya.NastoyascheeSProshedshim; break; case 'Y': slovo.vremya = Vremya.Davnoproshedshee; break; case 'U': slovo.vremya = Vremya.BuduscheeSProshedshim; break; default: break; } break; case "UBA"://буд switch (temp[0][0]) { case 'T': slovo.vremya = Vremya.NastoyascheeSBuduschim; break; case 'Y': slovo.vremya = Vremya.ProshedsheeBuduscheeBezNastoyaschego; break; case 'U': slovo.vremya = Vremya.BuduscheeDalekoe; break; default: break; } break; //определение залога case "A": slovo.zalog = Zalog.Vozvratniy; break; case "F": slovo.zalog = Zalog.Stradatelniy; break; case "SBA": slovo.zalog = Zalog.Vzaimniy; break; //определение наклонения case "J": slovo.naklonenie = Naklonenie.Povelitelnoe; break; //определение вида //совершенный вид case "S"://[ро] if (!Zaver) slovo.vid = Vid.Zavershennost; else slovo.vid = Vid.NevozvratnayaZavershennost; break; //состояние case "TVY"://[чэко] slovo.sostoynie = Sostoynie.Безличное; break; default: break; } } logOsnovaEl += "\n***Характеристики*** " + "\nЧисло: " + slovo.chislo.ToString() + "\nНаклонение: " + slovo.naklonenie.ToString() + "\nРод: " + slovo.rod.ToString() + "\nСостояние: " + slovo.sostoynie.ToString() + "\nВид: " + slovo.vid.ToString() + "\nВремя: " + slovo.vremya.ToString() + "\nЗалог: " + slovo.zalog.ToString(); }
protected void Soglas_Gram(Predlozhenie pr, int place) { bool fl = false; bool fl1 = false; if (slovo.zalog == Zalog.Dejstvitekniy || slovo.zalog == Zalog.Vzaimniy || slovo.zalog == Zalog.Vozvratniy) slovo.zalog = Zalog.Dejstvitekniy; else slovo.zalog = Zalog.Stradatelniy; int max = place + 4 > pr.Count - 1 ? pr.Count - 1 : place + 4; int min = place - 4 > 0 ? place - 4 : 0; //int such = 0; if (slovo.chastRechi == ChastRechi.Glagol && pr.Count > 1) { // * определение времени и формы глагола по соответствующим им словам в предложении * int i = min; while (i < max + 1) { Slovo slovpoisk = pr[i]; if (slovpoisk.enSlovo != slovo.enSlovo) { if (slovpoisk.enSlovo.ToString().ToString() == "A-RB" || slovpoisk.enSlovo.ToString().ToString() == "P-RBI" || slovpoisk.enSlovo.ToString().ToString() == "E-TV") { fl = true; slovo.vid = Vid.Indefinite; slovo.vremya = Vremya.Present; i = max; } else if (slovpoisk.enSlovo.ToString() == "E-S" || slovpoisk.enSlovo.ToString() == "A-S" || slovpoisk.enSlovo.ToString() == "E-1-Y" || slovpoisk.enSlovo.ToString() == "P-YBU") { fl1 = false; for (int y = 0; y < i; y++) { Slovo sl = pr[y]; if (sl.enSlovo.ToString() == "Q-RBY") slovo.vid = Vid.Continuous; else if (sl.enSlovo.ToString() == "FQ") slovo.vid = Vid.Perfect; else slovo.vid = Vid.Indefinite; } slovo.vremya = Vremya.Past; fl = true; i = max; } else if (slovpoisk.enSlovo.ToString() == "Q-RBY" && pr[i - 1].enSlovo.ToString() == "A-W" || slovpoisk.enSlovo.ToString() == "Q-RBY" && pr[i - 1].enSlovo.ToString() == "A-T" || slovpoisk.enSlovo.ToString() == "Q-RBY" && pr[i - 1].enSlovo.ToString() == "A-Q" || slovpoisk.enSlovo.ToString() == "P-EXY" || slovpoisk.eSlovo.ToString() == "P-TB") { fl = true; slovo.vremya = Vremya.Present; slovo.vid = Vid.Continuous; i = max; } else if (slovpoisk.enSlovo.ToString() == "P-UBU" || slovpoisk.enSlovo.ToString() == "E-UB" || slovpoisk.enSlovo.ToString() == "E-F" || slovpoisk.enSlovo.ToString() == "I-F") { fl1 = false; for (int y = 0; y < i; y++) { Slovo sl = pr[y]; if (sl.enSlovo.ToString() == "E-UCY" || sl.enSlovo.ToString() == "E-SCI" || sl.enSlovo.ToString() == "Q-UCY" || sl.enSlovo.ToString() == "till") slovo.vid = Vid.Continuous; else if (pr[i].enSlovo.ToString() == "A-W" || pr[i].enSlovo.ToString() == "A-T" || pr[i].enSlovo.ToString() == "A-Q") slovo.vid = Vid.Perfect; else slovo.vid = Vid.Indefinite; } slovo.vremya = Vremya.Future; fl = true; i = max; } /*else if (slovpoisk.enSlovo.ToString() == "already" || slovpoisk.enSlovo.ToString() == "ever" || slovpoisk.enSlovo.ToString() == "never") { fl = true; slovo.vid = Vid.Perfect; slovo.vremya = Vremya.Present; i = max; }*/ } i++; } } //* определение времени и формы глагола по характеристикам, угаследоаным с эльюнди * if (fl == false) { switch (slovo.vremya) { case Vremya.Buduschee: slovo.vremya = Vremya.Future; slovo.vid = Vid.Indefinite; break; case Vremya.NastoyascheeDlitelnoe: slovo.vremya = Vremya.Present; slovo.vid = Vid.Continuous; break; case Vremya.Proshedshee: case Vremya.ProshedsheeDlitelnoe: case Vremya.ProshedsheeBuduscheeBezNastoyaschego: slovo.vremya = Vremya.Past; break; case Vremya.ProshedsheeSNastoyaschim: case Vremya.Davnoproshedshee: slovo.vid = Vid.Perfect; slovo.vremya = Vremya.Present; break; case Vremya.BuduscheeDlitelnoe: case Vremya.BuduscheeVNastoyaschem: case Vremya.BuduscheeSProshedshim: case Vremya.BuduscheeDalekoe: slovo.vremya = Vremya.Future; break; default: slovo.vremya = Vremya.Present; break; } if (slovo.vremya == Vremya.Present && slovo.vid == Vid.NeopredelennayaDlitelnost) slovo.vid = Vid.Continuous; else switch (slovo.vid) { case Vid.NevozvratnayaZavershennost: slovo.vid = Vid.Perfect; break; default: slovo.vid = Vid.Indefinite; break; } } //slovo.enSlovo.slovo = Processing(slovo.enSlovo.ToString()); }
/* public void Vremia_eng() { switch (slovo.vremya) { case Vremya.BuduscheeDalekoe: case Vremya.BuduscheeDlitelnoe: case Vremya.BuduscheeVNastoyaschem: case Vremya.BuduscheeSProshedshim: slovo.vremya = Vremya.Buduschee; break; case Vremya.NastoyascheeDlitelnoe: case Vremya.NastoyascheeSBuduschim: case Vremya.NastoyascheeSProshedshim: case Vremya.NastoyascheeVNastoyaschem: case Vremya.Postoyannoe: slovo.vremya = Vremya.Nastoyaschee; break; case Vremya.ProshedsheeBuduscheeBezNastoyaschego: case Vremya.ProshedsheeDlitelnoe: case Vremya.ProshedsheeSNastoyaschim: case Vremya.Davnoproshedshee: slovo.vremya = Vremya.Proshedshee; break; default: break; } }*/ protected void AnalyzeCharacteristicsFromNoun(Predlozhenie pr, int place, ref Slovo analyzed) { // поиск в предложении существительного //и копировaние его хaрaктеристик (числa) int max = place + 4 > pr.Count - 1 ? pr.Count - 1 : place + 4; int min = place - 4 > 0 ? place - 4 : 0; int such = 0; if (analyzed.chastRechi == ChastRechi.Glagol && pr.Count > 1) { Hashtable sush = new Hashtable(); for (int i = min; i < max; i++) { Slovo slovpoisk = pr[i]; if (slovpoisk.chastRechi == ChastRechi.Suschestvitelnoe) { sush[i] = slovpoisk; such = 1; } else if (slovpoisk.chastRechi == ChastRechi.Mestoimenie) such = 2; } Slovo res = null; int minres = 999; foreach (int j in sush.Keys) { if (Math.Abs(place - j) < minres || (Math.Abs(place - j) == minres && j > place)) { res = (Slovo)sush[j]; minres = Math.Abs(place - j); } } if (res != null) { if (such == 1) { analyzed.chislo = res.chislo; analyzed.lico = Lico.Третье; } else if (such == 2) { if (res.eSlovo == "Q-" || res.eSlovo == "Q-Q") //местоимение "Я" { analyzed.chislo = Chislo.Edinstvennoe; analyzed.lico = Lico.Первое; } else if (res.eSlovo == "Y") //местоимение "Мы" { analyzed.chislo = Chislo.Mnozhestvennoe; analyzed.lico = Lico.Первое; } else if (res.eSlovo == "W" || res.eSlovo == "U") //местоимение "Ты,Вы" { analyzed.chislo = Chislo.Mnozhestvennoe; analyzed.lico = Lico.Второе; } else if (res.eSlovo == "E-" || res.eSlovo == "T-" || res.eSlovo == "R-") //местоимение "Он,Она,Оно" { analyzed.chislo = Chislo.Edinstvennoe; analyzed.lico = Lico.Третье; } else if (res.eSlovo == "I-") //местоимение "Они" { analyzed.chislo = Chislo.Mnozhestvennoe; analyzed.lico = Lico.Третье; } } } else { analyzed.chislo = Chislo.Edinstvennoe; analyzed.lico = Lico.Третье; } if (analyzed.chislo == Chislo.Odinochnoe || analyzed.chislo == Chislo.Odinochnoe) analyzed.chislo = Chislo.Edinstvennoe; else if (analyzed.chislo == Chislo.Neopredelennoe || analyzed.chislo == Chislo.Mnogoobraznoe) analyzed.chislo = Chislo.Mnozhestvennoe; } }
string Processing(string infin, Predlozhenie pr, int place) { string stroka = infin; string stroka_copy = stroka; Soglas_Gram(pr, place); try { if (slovo.zalog == Zalog.Dejstvitekniy) { if (slovo.vid == Vid.Indefinite) { // преобразования для Indefenite if (slovo.vremya == Vremya.Present) { if (stroka == "be") { if (slovo.chislo == Chislo.Edinstvennoe) { if (slovo.lico == Lico.Первое) stroka = "am"; else stroka = "is"; } else stroka = "are"; } else if (slovo.lico == Lico.Третье && slovo.chislo == Chislo.Edinstvennoe) { char[] slovo1 = stroka.ToCharArray(); if (slovo1[slovo1.Length - 1] == 's' || slovo1[slovo1.Length - 1] == 'x' || slovo1[slovo1.Length - 1] == 'z' || slovo1[slovo1.Length - 1] == 'o' || slovo1[slovo1.Length - 1] == 'h' && slovo1[slovo1.Length - 2] == 's' || slovo1[slovo1.Length - 1] == 'h' && slovo1[slovo1.Length - 2] == 'c') stroka = stroka + "es"; else if (slovo1[slovo1.Length - 1] == 'f') { stroka = slovo1[0].ToString(); for (int i = 1; i < slovo1.Length - 1; i++) stroka = stroka + slovo1[i].ToString(); stroka = stroka + "ves"; } else if (slovo1[slovo1.Length - 1] == 'e' && slovo1[slovo1.Length - 2] == 'f') { stroka = slovo1[0].ToString(); for (int i = 1; i < slovo1.Length - 2; i++) stroka = stroka + slovo1[i].ToString(); stroka = stroka + "ves"; } else if (slovo1[slovo1.Length - 1] == 'y' && slovo1[slovo1.Length - 2] > 97 && slovo1[slovo1.Length - 2] < 101 || slovo1[slovo1.Length - 1] == 'y' && slovo1[slovo1.Length - 2] > 101 && slovo1[slovo1.Length - 2] < 105 || slovo1[slovo1.Length - 1] == 'y' && slovo1[slovo1.Length - 2] > 105 && slovo1[slovo1.Length - 2] < 111 || slovo1[slovo1.Length - 1] == 'y' && slovo1[slovo1.Length - 2] > 111 && slovo1[slovo1.Length - 2] < 117 || slovo1[slovo1.Length - 1] == 'y' && slovo1[slovo1.Length - 2] > 117 && slovo1[slovo1.Length - 2] < 121 || slovo1[slovo1.Length - 1] == 'y' && slovo1[slovo1.Length - 2] == 'z') { stroka = slovo1[0].ToString(); for (int i = 1; i < slovo1.Length - 1; i++) stroka = stroka + slovo1[i].ToString(); stroka = stroka + "ies"; } else stroka = stroka + 's'; } } else if (slovo.vremya == Vremya.Future) { if (slovo.lico == Lico.Первое) stroka = "shall " + stroka; else stroka = "will " + stroka; } else if (slovo.vremya == Vremya.Past) { // образование второй формы глагола (V2) SQLiteConnection con = new SQLiteConnection(@"Data Source=non_verbs.sqlitedb;Version=3;"); con.Open(); SQLiteCommand com = new SQLiteCommand(con); com.CommandText = "SELECT v2 FROM verbs WHERE v1=@str"; com.Parameters.Add(new SQLiteParameter("str", stroka)); SQLiteDataReader reader = com.ExecuteReader(); if (reader.HasRows) { reader.Read(); if (!reader.IsDBNull(0)) { stroka = reader.GetString(0); if (stroka == "was,were") { if (slovo.chislo == Chislo.Mnozhestvennoe) stroka = "were"; else stroka = "was"; } } } else stroka = V_ed(stroka); reader.Close(); con.Close(); } /* ??????????????????????????????????????????????????????????????????????????*/ else if (slovo.vremya == Vremya.Future_Past) { if (slovo.lico == Lico.Первое) stroka = "should " + stroka; else stroka = "would " + stroka; } // преобразования для Indefenite } else if (slovo.vid == Vid.Continuous) { // преобразования для Continuous if (slovo.vremya == Vremya.Present) { if (slovo.chislo == Chislo.Edinstvennoe) { if (slovo.lico == Lico.Первое) stroka = "am "; else stroka = "is "; } else stroka = "are "; } else if (slovo.vremya == Vremya.Future) { if (slovo.lico == Lico.Первое) stroka = "shall be "; else stroka = "will be "; } else if (slovo.vremya == Vremya.Past) { if (slovo.chislo == Chislo.Mnozhestvennoe) stroka = "were "; else stroka = "was "; } else if (slovo.vremya == Vremya.Future_Past) { { if (slovo.lico == Lico.Первое) stroka = "should be "; else stroka = "would be "; } } stroka = stroka + V_ing(stroka_copy); } else if (slovo.vid == Vid.Perfect) { // преобразования для Perfect if (slovo.vremya == Vremya.Present) { if (slovo.chislo == Chislo.Edinstvennoe && slovo.lico == Lico.Третье) stroka = "has "; else stroka = "have "; } else if (slovo.vremya == Vremya.Future) { if (slovo.lico == Lico.Первое) stroka = "shall have "; else stroka = "will have "; } else if (slovo.vremya == Vremya.Past) { stroka = "had "; } else if (slovo.vremya == Vremya.Future_Past) { { if (slovo.lico == Lico.Первое) stroka = "should have "; else stroka = "would have "; } } stroka = stroka + Viii(stroka_copy); } else if (slovo.vid == Vid.Perfect_Continuous) { // преобразование для Perfect-Continuous if (slovo.vremya == Vremya.Present) { if (slovo.chislo == Chislo.Edinstvennoe && slovo.lico == Lico.Третье) stroka = "has "; else stroka = "have "; } else if (slovo.vremya == Vremya.Future) { if (slovo.lico == Lico.Первое) stroka = "shall have "; else stroka = "will have "; } else if (slovo.vremya == Vremya.Past) { stroka = "had "; } else if (slovo.vremya == Vremya.Future_Past) { { if (slovo.lico == Lico.Первое) stroka = "should have "; else stroka = "would have "; } } stroka = stroka + "been " + V_ing(stroka_copy); } } //--------------------------------------------------------------------------------------------- else if (slovo.zalog == Zalog.Stradatelniy) { // преобразование слова для страдательного залога if (slovo.vid == Vid.Indefinite) { // преобразования для Indefenite if (slovo.vremya == Vremya.Present) { if (slovo.chislo == Chislo.Edinstvennoe) { if (slovo.lico == Lico.Первое) stroka = "am "; else stroka = "is "; } else stroka = "are "; } else if (slovo.vremya == Vremya.Future) { if (slovo.lico == Lico.Первое) stroka = "shall be "; else stroka = "will be "; } else if (slovo.vremya == Vremya.Past) { if (slovo.chislo == Chislo.Mnozhestvennoe) stroka = "were "; else stroka = "was "; } else if (slovo.vremya == Vremya.Future_Past) { { if (slovo.lico == Lico.Первое) stroka = "should be "; else stroka = "would be "; } // преобразования для Indefenite } } else if (slovo.vid == Vid.Continuous) { // преобразования для Continuous if (slovo.vremya == Vremya.Present) { if (slovo.chislo == Chislo.Edinstvennoe) { if (slovo.lico == Lico.Первое) stroka = "am being "; else stroka = "is being "; } else stroka = "are being "; } else if (slovo.vremya == Vremya.Future) { stroka = "!!! EROR !!!"; } else if (slovo.vremya == Vremya.Past) { if (slovo.chislo == Chislo.Mnozhestvennoe) stroka = "were being "; else stroka = "was being "; } else if (slovo.vremya == Vremya.Future_Past) { stroka = "!!! EROR !!!"; } } else if (slovo.vid == Vid.Perfect) { // преобразования для Perfect if (slovo.vremya == Vremya.Present) { if (slovo.chislo == Chislo.Edinstvennoe && slovo.lico == Lico.Третье) stroka = "has been "; else stroka = "have been "; } else if (slovo.vremya == Vremya.Future) { if (slovo.lico == Lico.Первое) stroka = "shall have been "; else stroka = "will have been "; } else if (slovo.vremya == Vremya.Past) { stroka = "had been "; } else if (slovo.vremya == Vremya.Future_Past) { { if (slovo.lico == Lico.Первое) stroka = "should have been "; else stroka = "would have been "; } } } else if (slovo.vid == Vid.Perfect_Continuous) { stroka = "!!! EROR !!!"; } if (stroka != "!!! EROR !!!") stroka = stroka + Viii(stroka_copy); } } catch { } return stroka; }
/*private string OsnovaElPrich(string p) { string osnova = p; osnova = osnova.Replace("-SVA", ""); // взaимный зaлог osnova = osnova.Replace("-TYU", ""); // Нaстоящее время osnova = osnova.Replace("-YYU", ""); // Прошедшее время osnova = osnova.Replace("-UYU", ""); // Будущее время osnova = osnova.Replace("-RBA", ""); // для постоянного или длительного времени osnova = osnova.Replace("-TBA", ""); // для нaстоящего времени osnova = osnova.Replace("-YBA", ""); // для прошедшего времени osnova = osnova.Replace("-UBA", ""); // для будущего времени osnova = osnova.Replace("-RBY", ""); // Однокрaтность osnova = osnova.Replace("-SCY", ""); // Нaчaло действия osnova = osnova.Replace("-PVI", ""); // Огрaничение длительности osnova = osnova.Replace("-PVS", ""); // Неопределеннaя длительность osnova = osnova.Replace("-RBA", ""); // Постояннaя длительность osnova = osnova.Replace("-UCS", ""); // Незaвершенность действия if (osnova[osnova.Length - 1] == 'J' && osnova[osnova.Length - 2] == '-') osnova = osnova.Remove(osnova.Length - 2, 2); // Повелительное нaклонение if (osnova[1] == 'S' && osnova[2] == '-') //зaвершенность действия osnova = osnova.Remove(1, 1); if (osnova[osnova.Length - 1] == 'S' && osnova[osnova.Length - 2] == '-') osnova = osnova.Remove(osnova.Length - 2, 2); //зaвершенность /* if (osnova[1] == 'A' && osnova[2] == '-') //Возврaтный зaлог osnova = osnova.Remove(1, 1);*/ /* if (osnova[osnova.Length - 1] == 'A') osnova = osnova.Remove(osnova.Length - 2, 2); //Возврaтный зaлог if (osnova[osnova.Length - 1] == 'F' && osnova[osnova.Length - 2] == '-') osnova = osnova.Remove(osnova.Length - 1, 1); //Стрaдaтельный зaлог /* for (int i = 0; i < osnova.Length; i++) { if (osnova[i] == '-') { osnova = osnova.Remove(i, 1); i--; } } * */ /* osnova = osnova.Remove(0, 1); osnova = "R" + osnova; //MessageBox.Show(osnova); return osnova; } /* private void NaklSoslag()// { int i = pozition_predl - 1; //пока смотрим только предыдущие слова while (i > 0) { if (predl[i].chastRechi != ChastRechi.Znak) { if (predl[i].eSlovo == "J-OBP" || predl[i].eSlovo == "J-TVQ" || predl[i].eSlovo == "G-OBP" || predl[i].eSlovo == "S-OBP") { // "J-OBP": //бы // "J-TVQ": //бы...ни // "G-OBP": //бы (вот бы) // "S-OBP": //чтобы slovo.naklonenie = Naklonenie.Soslagatelnoe; break; } } else break; i--; } }*/ /** * ЗАГЛУШКА * На выходе должно быть слово на ангийском языке */ public Slovo Translate(Predlozhenie pr, int place) { Slovo analyzed = pr[place]; GetTranslate(pr, place, ref analyzed); //Soglas_Gram(pr, place); return analyzed; }
protected void PreAnalyze(Predlozhenie pr, int place, ref Slovo slovo) { AnalyzeCharacteristicsFromNoun(pr, place, ref slovo); AnalyzeGlagol(pr, place, ref slovo); SetExtraData(ref slovo); }
/** * ЗАГЛУШКА * На выходе должно быть слово на ангийском языке */ public Slovo Translate(Predlozhenie pr, int place) { Slovo analyzed = pr[place]; GetTranslate(ref analyzed); //Если число множественное, то изменяем окончание if (analyzed.chislo != Chislo.Edinstvennoe && analyzed.chislo != Chislo.Odinochnoe) { bool isSpecial = false; switch (analyzed.enSlovo.slovo) { case "man": analyzed.enSlovo.slovo = "men"; isSpecial = true; break; case "woman": analyzed.enSlovo.slovo = "women"; isSpecial = true; break; case "mouse": analyzed.enSlovo.slovo = "mice"; isSpecial = true; break; case "tooth": analyzed.enSlovo.slovo = "teeth"; isSpecial = true; break; case "foot": analyzed.enSlovo.slovo = "feet"; isSpecial = true; break; case "child": analyzed.enSlovo.slovo = "children"; isSpecial = true; break; case "ox": analyzed.enSlovo.slovo = "oxen"; isSpecial = true; break; case "goose": analyzed.enSlovo.slovo = "geese"; isSpecial = true; break; case "sheep": analyzed.enSlovo.slovo = "sheep"; isSpecial = true; break; case "deer": analyzed.enSlovo.slovo = "deer"; isSpecial = true; break; case "swine": analyzed.enSlovo.slovo = "swine"; isSpecial = true; break; } if (!isSpecial) { if (analyzed.enSlovo.slovo.EndsWith("f")) analyzed.enSlovo.slovo = analyzed.enSlovo.slovo.Substring(0, analyzed.enSlovo.slovo.Length - 1) + "ves"; else if (analyzed.enSlovo.slovo.EndsWith("fe")) analyzed.enSlovo.slovo = analyzed.enSlovo.slovo.Substring(0, analyzed.enSlovo.slovo.Length - 2) + "ves"; else if (analyzed.enSlovo.slovo.EndsWith("o")) analyzed.enSlovo.slovo += "es"; else if (analyzed.enSlovo.slovo.EndsWith("y")) analyzed.enSlovo.slovo = analyzed.enSlovo.slovo.Substring(0, analyzed.enSlovo.slovo.Length - 1) + "ies"; else analyzed.enSlovo.slovo += "s"; } } return analyzed; }
public Slovo Analyze(Predlozhenie pr, int place) { Slovo analyzed = pr[place]; return analyzed; }
protected void AnalyzePadezh(Predlozhenie pr,int place,ref Slovo slovo) { int i = place-1; while(i>0 && (pr[i].chastRechi == ChastRechi.Prilagatelnoe || pr[i].chastRechi == ChastRechi.Prichastie || pr[i].chastRechi == ChastRechi.Mestoimenie)) { i = i-1; } if(pr[i]!=null && pr[i].chastRechi == ChastRechi.Predlog) { Slovo predlog = pr[i]; switch(predlog.eSlovo) { case "FF": slovo.padezh = Padezh.Vinitelnij; break; case "FQV": case "FJB": slovo.padezh = Padezh.Prityazhatelnij; break; case "FZP": slovo.padezh = Padezh.Datelnij; break; case "FT": slovo.padezh = Padezh.Tvoritelnij; break; case "FR": slovo.padezh = Padezh.Instrumentalnij; break; case "FZJ": slovo.padezh = Padezh.Prisvyazochnij; break; case "FOB": slovo.padezh = Padezh.Dejstviya; break; case "FZO": slovo.padezh = Padezh.Predmeta; break; case "FZE": slovo.padezh = Padezh.Napravleniya; break; case "FA": slovo.padezh = Padezh.Mestoprebivaniya; break; case "FWV": slovo.padezh = Padezh.Obrasheniya; break; case "FSVE": slovo.padezh = Padezh.Avtora; break; case "FRZF": slovo.padezh = Padezh.Nazvaniya; break; case "FVA": slovo.padezh = Padezh.Celi; break; case "FFVY": slovo.padezh = Padezh.Prichini; break; case "FFV": slovo.padezh = Padezh.Sledstviya; break; } } else { slovo.padezh = Padezh.Imenitelnij; } }
protected void PreAnalyze(Predlozhenie pr, int place, ref Slovo slovo) { //CopyCharact(pr, place, ref slovo); //GetTranslate(ref slovo); SetExtraData(ref slovo); }
protected void PreAnalyze(Predlozhenie pr, int place, ref Slovo slovo) { GetTranslate(ref slovo); SetExtraData(ref slovo); }
protected ArrayList SecondParseEl(ArrayList slova) { ArrayList ar = new ArrayList(); Predlozhenie pr = new Predlozhenie(); for(int i=0;i<slova.Count;i++) { Slovo current = (Slovo)slova[i]; if(current.chastRechi == ChastRechi.Znak) { if(current.eSlovo == "."||current.eSlovo == "?"||current.eSlovo == "!"||current.eSlovo == "..."||current.eSlovo == "\n") { pr.AddSlovo(current); if(i+1<slova.Count) { current = (Slovo)slova[i+1]; while(current.chastRechi == ChastRechi.Znak&&i+1<slova.Count) { pr.AddSlovo(current); i++; if(i+1<slova.Count) current = (Slovo)slova[i+1]; } //i--; } ar.Add(pr); pr = new Predlozhenie(); } else { pr.AddSlovo(current); } } else { pr.AddSlovo(current); } } ar.Add(pr); return ar; }