public static List <Slovo> FillSlovaFromRasskazy(List <Slovo> listSlov, List <MultiLineObject> mobList) { List <Slovo> slovaByRasskazy = new List <Slovo>(); ArrayList al = new ArrayList(); if (mobList != null && listSlov != null) { Category curCat = null; if (mobList.Count > 0) { curCat = mobList[0].BaseCategory; } foreach (Slovo slv in listSlov) { TextObjectByCategory tob = new TextObjectByCategory(slv.GetText(), curCat); if (!al.Contains(tob)) { al.Add(tob); } } foreach (MultiLineObject mob in mobList) { Category curCategory = mob.BaseCategory; foreach (string s_orig in mob.ContentList) { //тут получаем предложение string[] s = s_orig.Split(new char[] { ',', '.', ';', '!', '?', '"', '(', ')', '\r', '\n', ' ', '-', ':' }); if (s != null && s.Length > 0) { for (int is1 = 0; is1 < s.Length; is1++) { string sn = s[is1].Trim(); if (Lib.IsStringCorrect(sn)) { TextObjectByCategory tob = new TextObjectByCategory(sn, curCategory); Slovo nsl = new Slovo(sn, -1, curCategory); if (!String.IsNullOrEmpty(sn) && sn.Length > 2 && !al.Contains(tob) && !listSlov.Contains(nsl)) { al.Add(tob); } } } } } } if (al != null && al.Count > 0) { foreach (TextObjectByCategory tob in al) { Category curCat2 = tob.BaseCategory; string s = tob.Text; slovaByRasskazy.Add(new Slovo(s, -1, curCat2)); } } } return(slovaByRasskazy); }
public static List <string> FillPredlogeniyaFromRasskazy(List <string> predlogeniyaList, List <MultiLineObject> mobListRasskazy) { List <string> listRes = new List <string>(); ArrayList al = new ArrayList(); if (mobListRasskazy != null && predlogeniyaList != null) { Category curCat = null; if (mobListRasskazy.Count > 0) { curCat = mobListRasskazy[0].BaseCategory; } foreach (string p in predlogeniyaList) { if (!String.IsNullOrEmpty(p) && (Lib.IsStringCorrect(p))) { TextObjectByCategory tob = new TextObjectByCategory(p, curCat); if (!String.IsNullOrEmpty(p) && !al.Contains(tob) && !predlogeniyaList.Contains(p)) { al.Add(tob); } } } foreach (MultiLineObject mob in mobListRasskazy) { Category curCategory = mob.BaseCategory; //тут получаем предложения foreach (string s_orig in mob.ContentList) { string s = Lib.CorrectPredlogenie(s_orig); if (!String.IsNullOrEmpty(s) && (Lib.IsStringCorrect(s))) { TextObjectByCategory tob = new TextObjectByCategory(s, curCategory); if (!String.IsNullOrEmpty(s) && s.Length > 10 && !al.Contains(tob) && !predlogeniyaList.Contains(s)) { al.Add(tob); } } } } if (al != null && al.Count > 0) { foreach (TextObjectByCategory tob in al) { string s = tob.Text; listRes.Add(tob.Text); } } } return(listRes); }
public static List <Slovo> FillSlovaFromPredlogeniaByRasskazy(List <Slovo> listSlov, List <string> predlogenia, Category baseCategory) { List <Slovo> res = new List <Slovo>(); ArrayList al = new ArrayList(); if (predlogenia != null && listSlov != null) { foreach (string predl in predlogenia) { if (!String.IsNullOrEmpty(predl) && Lib.IsStringCorrect(predl)) { //тут получаем предложение string[] s = predl.Split(new char[] { ',', '.', ';', '!', '?', '"', '(', ')', '\r', '\n', ' ', '-', ':' }); if (s != null && s.Length > 0) { for (int is1 = 0; is1 < s.Length; is1++) { string sn = s[is1].Trim(); if (Lib.IsStringCorrect(sn)) { TextObjectByCategory tob = new TextObjectByCategory(sn, baseCategory); Slovo nsl = new Slovo(sn, -1, baseCategory); if (!String.IsNullOrEmpty(sn) && sn.Length > 2 && !al.Contains(tob) && !listSlov.Contains(nsl)) { al.Add(tob); } } } } } } if (al != null && al.Count > 0) { foreach (TextObjectByCategory tob in al) { Category curCat = tob.BaseCategory; string s = tob.Text; res.Add(new Slovo(s, -1, curCat)); } } } return(res); }