private void btMakeSynAn_Click(object sender, EventArgs e) { var sentlistRep = store.MorphMakeSyntan(memoInp.Text); if (sentlistRep == null || sentlistRep.Count == 0) { return; } var sent = Map2Asm.Convert(sentlistRep[0]); var sb = new StringBuilder(); for (int i = 0; i < sent.Capasity; i++) { var word = sent.GetWordByOrder(i); sb.Append(word.EntryName + " " + word.RealWord + "\r\n"); } // Отображение синт связей var ordlist = sent.GetTreeList(); foreach (var x in ordlist) { sb.Append(new String('\t', (int)x.Level) + String.Format("{0} Level {1} link {2} \r\n", sent.GetWordByOrder((int)x.ChildOrder).EntryName, x.Level, x.GrenLink)); } memoOut.Text = sb.ToString(); }
/// <summary> /// Формирование содержимого внутреннего объекта ParagraphAsm. /// </summary> /// <param name="pAsm">объект ParagraphAsm</param> /// <param name="input">текстовое содержание абзаца</param> /// <returns></returns> public void UpdateParagraph(ParagraphAsm pAsm, string input, bool IsHeader) { var ihash = input.GetHashCode(); int currenthash = pAsm.GetHashCode(IsHeader); var range = IsHeader ? SentTypes.enstNotActualHead : SentTypes.enstNotActualBody; var sentlist = pAsm.GetParagraphSents(range); if (ihash == currenthash && sentlist.Count == 0) { return; } var sents = this.MorphGetSeparatedSentsList(input); pAsm.RefreshParagraph(new ArrayList(sents), IsHeader); sentlist = pAsm.GetParagraphSents(range); if (sentlist.Count == 0) { return; } // Выполнение синтана для неактуальных предложений. foreach (var sent in sentlist) { var sentlistRep = this.MorphMakeSyntan(sent.Text); if (sentlistRep.Count > 0) { pAsm.UpdateSentStruct(sent.Order, Map2Asm.Convert(sentlistRep[0])); } } }
private void btSavePara_Click(object sender, EventArgs e) { var aNode = treeView1.SelectedNode as AsmNode; if (aNode == null) { return; } var para = new ParagraphAsm(aNode.Assembly); aNode.Assembly = para; var sentlistRep = store.MorphMakeSyntan(memoInp.Text); if (sentlistRep == null || sentlistRep.Count == 0) { return; } var sent = Map2Asm.Convert(sentlistRep[0]); para.UpdateSentStruct(0, sent); para.Save(); // var para = new ParagraphAsm(); // store.UpdateParagraph(para, memoInp.Text, false); /* var paramlist = store.SaveParagraphBD(para); * if (paramlist == null) * { * return; * } * * foreach (var par in paramlist) * if (par.Name == "ParagraphID") * { * this.para.ParagraphID = Convert.ToInt32(par.Value, 10); * break; * } * memoOut.Text = this.para.ParagraphID.ToString();*/ }