Система семантического разбора для естественно-языковых текстов

Дипломная работа - Компьютеры, программирование

Другие дипломы по предмету Компьютеры, программирование



{.Enqueue(LemmDiscript(Text.Substring(starti, sigi - starti)));= sigi;

}if (sigi == starti)

{.Enqueue(LemmDiscript(Text.Substring(starti, 1)));++;

}

}

}if (sigi < deli)

{(sigi == starti)

{.Enqueue(LemmDiscript(Text.Substring(starti, 1)));++;

}if (sigi > starti)

{.Enqueue(LemmDiscript(Text.Substring(starti, sigi - starti)));= sigi;

}if (sigi == -1)

{(deli > starti)

{.Enqueue(LemmDiscript(Text.Substring(starti, deli - starti)));= deli;

}if (deli == starti)

{++;

}

}

}if (sigi == deli)

{(Text.Length == starti)

{.Enqueue(LemmDiscript(Text.Substring(starti, 1)));++;

}if (Text.Length > starti)

{.Enqueue(LemmDiscript(Text.Substring(starti, Text.Length - )));= Text.Length + 1;

}

}

}(Text.Length > starti);TextLemm;

}Queue TextLemm)

{Mlemm;strb = new StringBuilder();.Tids ts = new Mcr.Tids();.Tinlexdata data = new Mcr.Tinlexdata();.InitMcr();.LoadMcr("zal.mcr");(int i = 0; i != TextLemm.Count; i++)

{( TextLemm.Peek().Discript == Discripts.RLE )

{.FindWID(TextLemm.Peek().Text, ref ts);.GetWordById(ts.ids[0], false, true, ref data);.Text = TextLemm.Peek().Text;.Discript = TextLemm.Peek().Discript;.MorphCid = data.inlex[0].cid;.Morph = Mcr.ConstIdToStr(data.inlex[0].cid) + " " +.VarIdToStr(data.inlex[0].cid, data.inlex[0].vid);.Enqueue(Mlemm);= TextLemm.Dequeue();

}

{.Enqueue(TextLemm.Dequeue());

}

}TextLemm;

}List TextLemm) // Все

Существительна

{.Tids ts = new Mcr.Tids();.Tinlexdata data = new Mcr.Tinlexdata();.InitMcr();.LoadMcr("zal.mcr");();(int i = 0; i != TextLemm.Count; i++)

{(TextLemm.Peek().Discript == Discripts.RLE &.Peek().MorphCid >= 1 & TextLemm.Peek().MorphCid <= 15)

{.FindWID(TextLemm.Peek().Text, ref ts);.GetWordById(ts.ids[0], false, true, ref data);.Add(data.inlex[0].anword);.Enqueue(TextLemm.Dequeue());

}

{.Enqueue(TextLemm.Dequeue());

}

} 0)

{j = 0;b;

{.Add(list.ElementAt(0));

{= list.Remove(list2.ElementAt(j));

}(b == true);++;

}(list.Count > 0);

}.Clear();list2;

}List TextLemm) //

Прилагательные

{.Tids ts = new Mcr.Tids();.Tinlexdata data = new Mcr.Tinlexdata();.InitMcr();.LoadMcr("zal.mcr");();(int i = 0; i != TextLemm.Count; i++)

{(TextLemm.Peek().Discript == Discripts.RLE &

((TextLemm.Peek().MorphCid == 20)|

(TextLemm.Peek().MorphCid == 23)|

(TextLemm.Peek().MorphCid == 24)|

(TextLemm.Peek().MorphCid == 25)))

{.FindWID(TextLemm.Peek().Text, ref ts);.GetWordById(ts.ids[0], false, true, ref data);.Add(data.inlex[0].anword);.Enqueue(TextLemm.Dequeue());

}

{.Enqueue(TextLemm.Dequeue());

}

} 0)

{j = 0;b;

{.Add(list.ElementAt(0));

{= list.Remove(list2.ElementAt(j));

}(b == true);++;

}(list.Count > 0);

}.Clear();list2;

}List TextLemm) // Все Глаголы

{.Tids ts = new Mcr.Tids();.Tinlexdata data = new Mcr.Tinlexdata();.InitMcr();.LoadMcr("zal.mcr");();(int i = 0; i != TextLemm.Count; i++)

{(TextLemm.Peek().Discript == Discripts.RLE &.Peek().MorphCid >= 40 & TextLemm.Peek().MorphCid <= 51)

{.FindWID(TextLemm.Peek().Text, ref ts);.GetWordById(ts.ids[0], false, true, ref data);.Add(data.inlex[0].anword);.Enqueue(TextLemm.Dequeue());

}

{.Enqueue(TextLemm.Dequeue());

}

} 0)

{j = 0;b;

{.Add(list.ElementAt(0));

{= list.Remove(list2.ElementAt(j));

}(b == true);++;

}(list.Count > 0);

}.Clear();list2;

}int ScanPart(string str, List topGraph)

{.Tids ts = new Mcr.Tids();.Tinlexdata data = new Mcr.Tinlexdata();.InitMcr();.LoadMcr("zal.mcr");.FindWID(str, ref ts);.GetWordById(ts.ids[0], false, true, ref data);iPart = -1;(int i = 0; i != topGraph.Count; i++)

{(topGraph.ElementAt(i).Top == data.inlex[0].anword)= i;

}iPart;

}int ScanPart(string str, List list)

{.Tids ts = new Mcr.Tids();.Tinlexdata data = new Mcr.Tinlexdata();.InitMcr();.LoadMcr("zal.mcr");.FindWID(str, ref ts);.GetWordById(ts.ids[0], false, true, ref data);iPart = -1;(int i = 0; i != list.Count; i++)

{(list.ElementAt(i) == data.inlex[0].anword)= i;

}iPart;

}List )

{Top = new TopGraph();();.AddRange(NounsSeparation(TextLemm));Ni = list.Count; // до данного значения элементы являются

существительными

// полсе следуют прилагательные.AddRange(AdjectivesSeparation(TextLemm));.AddRange(VerbsSeparation(TextLemm)); //выделения глаголов

for(int i=0; i!=list.Count; i++) //записываем все вершины графа(сети)

{.id = i;.Top = list.ElementAt(i);

topGraph.Add(Top);

}

//Транспанируем текст в структуру TextOnParts выделяя главные

элементы();PS = new OnPartswords();(int i = 0; i!=TextLemm.Count; i++)

{(TextLemm.ElementAt(i).Discript == Discripts.RLE & // Noun.ElementAt(i).MorphCid >= 1 & .ElementAt(i).MorphCid <= 15)

{.Patr = Partwords.Noun;.iAnword = ScanPart(TextLemm.ElementAt(i).Text, topGraph);.Add(PS);

}if (TextLemm.ElementAt(i).Discript == Discripts.RLE & // Ajective

(TextLemm.ElementAt(i).MorphCid == 20) |

(TextLemm.ElementAt(i).MorphCid == 23) |

(TextLemm.ElementAt(i).MorphCid == 24) |

(TextLemm.ElementAt(i).MorphCid == 25))

{.Patr = Partwords.Ajective;.iAnword = ScanPart(TextLemm.ElementAt(i).Text, topGraph);.Add(PS);

}if (TextLemm.ElementAt(i).Discript == Discripts.RLE & // Verb.ElementAt(i).MorphCid >= 40 & .ElementAt(i).MorphCid <= 51)

{.Patr = Partwords.Verb;.iAnword = ScanPart(TextLemm.ElementAt(i).Text, listVerb);.Add(PS);

}

}.Patr = Partwords.End; //конец текста.iAnword = -1;.Add(PS);

//Транспанируем структуру TextOnPartsTG = new TopGraph(); // для изменений= 0)

{iP = 0;

{(TextOnParts.ElementAt(iP).Patr == Partwords.Noun)

{(TextOnParts.ElementAt(iP + 1).Patr == Partwords.Noun) //

Сущь_Сущь

{(topGraph[TextOnParts.ElementAt(iP).iAnword].Relations != null)

{ .AddRange(topGraph[TextOnParts.ElementAt(iP).iAnword].Relations);

}.Add("Имеет(есть)");(topGraph[TextOnParts.ElementAt(iP).iAnword].Relationships != null)

{ .AddRange(topGraph[TextOnParts.ElementAt(iP).iAnword].Relationshi); }.Add(TextOnParts.ElementAt(iP + 1).iAnword);.id = topGraph[TextOnParts.ElementAt(iP).iAnword].id;.Top = topGraph[TextOnParts.ElementAt(iP).iAnword].Top;.Relations = LR;.Relationships = LRs;[TextOnParts.ElementAt(iP).iAnword] = TG;++;

}if (TextOnParts.ElementAt(iP + 1).Patr == Partwords.Ajective) //

Сущь_Прил

{

// .ElementAt(TextOnParts.ElementAt(iP).iAnword).Relations.Add("

Свойство");

// .ElementAt(TextOnParts.ElementAt(iP).iAnword).Relationships.A(TextOnParts.ElementAt(iP + 1).iAnword);

//

}if (TextOnParts.ElementAt(iP + 1).Patr == Partwords.Verb)//

Сущь_Глагал

{();iP_2 = iP + 1;

{(TextOnParts.ElementAt(iP_2).Patr == Partwords.Verb) //->глагол

{.Add(iP_2);

}if (TextOnParts.ElementAt(iP_2).Patr == Partwords.Ajective) //->прил

{.Add(iP_2);

}_2++;

}(TextOnParts.ElementAt(iP_2).Patr != Partwords.Noun | .ElementAt(iP_2).Patr != Partwords.End);(TextOnParts.ElementAt(iP_2).Patr == Partwords.Noun)

{

}if (TextOnParts.ElementAt(iP_2).Patr == Partwords.End)

{

}.ElementAt(TextOnParts.ElementAt(iP).iAnword).Relations.Add(li.ElementAt(TextOnParts.ElementAt(iP + 1).iAnword));.ElementAt(TextOnParts.ElementAt(iP).iAnword).Relationships.A(TextOnParts.ElementAt(iP + 1).iAnword);

}++;

}(TextOnParts.ElementAt(iP).Patr == Partwords.End);

}topGraph;

}

}

}

//************************************************************

// Form1

//************************************************************System;System.IO;System.Collections.Generic;System.ComponentModel;System.Data;System.Drawing;System.Linq;System.Text;System.Windows.Forms;System.Collections;MorphologyModule;LinguisticalModule;SemanticSystem

{struct Bridge // Д