public override double WeighNounFrame(int nounFrameIndex) { LoadRelationWeights(); LoadRelationFactors(); NounFrame NF = _mindMapTMR.Nounframes[nounFrameIndex]; //relations of noun frames ---> CaseRoles Dictionary <CaseRole, List <VerbFrame> > Associatedactions = MindMapTMR.GetNounFrameAssociatedactions(nounFrameIndex); double Weight = 0; //Array caseRoleArr = Enum.GetValues(typeof(CaseRole)); int len = Enum.GetNames(typeof(CaseRole)).Length; for (int i = 0; i < Enum.GetNames(typeof(CaseRole)).Length; i++) { //Enum.GetValues(CaseRole) if (Associatedactions.ContainsKey((CaseRole)i)) { List <VerbFrame> ListofVF = Associatedactions[(CaseRole)i]; int count = ListofVF.Count; if (count != 0) { for (int j = 0; j < count; j++) { Weight += caseRoleWeights[(CaseRole)i]; } } } } return(Weight); }
private void TextMeaningRepresentation() { parsetrees = new ArrayList(); foreach (ParseTree ps in SParseTrees) { parsetrees.Add(ModifyParseTree(ps)); } MindMapTMR MINDMAP = new MindMapTMR(parsetrees, null); MINDMAP.BuildTMR(); tmr = MINDMAP; foreach (VerbFrame VF in tmr.VerbFrames) { string name; if (VF.VerbNegation) { name = VF.VerbName; VF.VerbName = ""; VF.VerbName += "NOT "; VF.VerbName += name; //make a copy then clear and add NOT fel awel then concatenate the old one. } } }
public pics(MindMapTMR CurrentTMR, MindMapTMR OriginalTMR, MultilevelGenerator.MultiLevel ML, int level, List <pics> PicForms, GoogleImageSearchSettings settings, DrawingSizeMode drawSizeMode) { _level = level; _settings = settings; _DrawSizeMode = drawSizeMode; PicForms.Add(this); picForms = PicForms; InitializeComponent(); this.CurrentTMR = CurrentTMR; this.OriginalTMR = OriginalTMR; this.ML = ML; this.Height = 700; this.Width = 1000; this.Text = "Mind Map"; viewer = new MMViewManeger(this.panel1, this.CurrentTMR, false, settings, _DrawSizeMode); viewer.Control = this.panel1; int MaximumY = viewer.getMaximumY(); int MaximumX = viewer.getMaximumX(); this.panel1.Height = MaximumY + 40; this.panel1.Width = MaximumX + 40; this.AutoScroll = true; }
public FrmCalculateWeights(MindMapTMR tmr) { InitializeComponent(); DirectRelationBasedTMRWeighter2 weighter = new DirectRelationBasedTMRWeighter2(tmr); List <double> nounsWeight = weighter.GetNounFrameWeights(); List <double> verbsWeight = weighter.GetVerbFrameWeights(); this.dataGridView1.Columns[3].ValueType = typeof(double); for (int i = 0; i < tmr.Nounframes.Count; i++) { int rowIndex = this.dataGridView1.Rows.Add(); this.dataGridView1[0, rowIndex].Value = tmr.Nounframes[i].Text; this.dataGridView1[1, rowIndex].Value = "noun"; this.dataGridView1[2, rowIndex].Value = tmr.Nounframes[i].Concept.Name; this.dataGridView1[3, rowIndex].Value = nounsWeight[i]; } this.dataGridView2.Columns[3].ValueType = typeof(double); for (int i = 0; i < tmr.VerbFrames.Count; i++) { int rowIndex = this.dataGridView2.Rows.Add(); this.dataGridView2[0, rowIndex].Value = tmr.VerbFrames[i].VerbName; this.dataGridView2[1, rowIndex].Value = "verb"; this.dataGridView2[2, rowIndex].Value = tmr.VerbFrames[i].Predicate.Name; this.dataGridView2[3, rowIndex].Value = verbsWeight[i]; } //this.dataGridView1.Columns[3].ValueType = typeof(double); this.dataGridView1.Sort(this.dataGridView1.Columns[3], ListSortDirection.Descending); this.dataGridView2.Sort(this.dataGridView2.Columns[3], ListSortDirection.Descending); }
public static List <Frame> GetNeighbors(this NounFrame nf, MindMapTMR tmr) { List <Frame> frames = new List <Frame>(); Dictionary <CaseRole, List <VerbFrame> > Associatedactions = tmr.GetNounFrameAssociatedactions(tmr.Nounframes.IndexOf(nf)); //Array caseRoleArr = Enum.GetValues(typeof(CaseRole)); int len = Enum.GetNames(typeof(CaseRole)).Length; for (int i = 0; i < Enum.GetNames(typeof(CaseRole)).Length; i++) { //Enum.GetValues(CaseRole) if (Associatedactions.ContainsKey((CaseRole)i)) { List <VerbFrame> ListofVF = Associatedactions[(CaseRole)i]; foreach (VerbFrame vf in ListofVF) { frames.Add(vf); } } if (nf.Ownerof.ContainsKey((CaseRole)i)) { foreach (NounFrame nfi in nf.Ownerof[(CaseRole)i]) { frames.Add(nfi); } } } return(frames); }
public MMViewManeger(Control cntrl, MindMapTMR TMR) : base(cntrl) { _TMR = TMR; AddEntities(); //4each 3al noun frames w n create entities w n defha w 2a3redha //verb frames }
public MMTMRoutput(Control cntrl, MindMapTMR TMR, NewGoogleSearch gImSearch) : base(cntrl) { GImSearch = gImSearch; _TMR = TMR; AddEntities(); //4each 3al noun frames w n create entities w n defha w 2a3redha //verb frames }
private void button_Multilevel_Click(object sender, EventArgs e) { ML = new MultiLevel(this.tmr); MLTMR = ML.Run(); FrmNewTMR newForm = new FrmNewTMR(MLTMR, this.tmr, ML); newForm.ShowDialog(); }
public MultiLevel(MindMapTMR TMR) { this.TMR = TMR; //Weight Assigning.. DirectRelationBasedTMRWeighter2 drbw = new DirectRelationBasedTMRWeighter2(this.TMR); this.NounFramesWeights = drbw.GetNounFrameWeights(); this.VerbFramesWeights = drbw.GetVerbFrameWeights(); }
private void button3_Click_1(object sender, EventArgs e) { MultiLevel ML = new MultiLevel(this.tmr); MindMapTMR NewTMR = ML.Run(); pics pic = new pics(NewTMR, tmr, ML, 0, new System.Collections.Generic.List <pics>()); //MMViewManeger mmvm = new MMViewManeger(pic, tmr); pic.ShowDialog(); }
private void Drawing() { MultilevelGenerator.MultiLevel ML = new MultilevelGenerator.MultiLevel(this.tmr); MindMapTMR NewTMR = ML.Run(); pics pic = new pics(NewTMR, tmr, ML, 0, new List <pics>()); //MMViewManeger mmvm = new MMViewManeger(pic, tmr); pic.ShowDialog(); }
public MultiLevelMMapForm(Form5 parentForm, MindMapTMR TopTMR, MindMapTMR OriginalTMR, MultilevelGenerator.MultiLevel ML, GoogleImageSearchSettings settings, DrawingSizeMode drawSizeMode) { InitializeComponent(); _parentForm = parentForm; _settings = settings; _DrawSizeMode = drawSizeMode; _TopTMR = TopTMR; _OriginalTMR = OriginalTMR; _ML = ML; }
public static List <Frame> GetNeighbors(this VerbFrame vf, MindMapTMR tmr) { List <Frame> frames = new List <Frame>(); int verbFrameIndex = tmr.VerbFrames.IndexOf(vf); double weight = 0; foreach (CaseRole cr in tmr.VerbFrames[verbFrameIndex].CaseRoles.Keys) { List <NounFrame> nfs = tmr.VerbFrames[verbFrameIndex].CaseRoles[cr]; foreach (NounFrame NF in nfs) { frames.Add(NF); } } foreach (TemporalRelationType trt in tmr.VerbFrames[verbFrameIndex].TemporalRelations.Keys) { List <VerbFrame> vfs = tmr.VerbFrames[verbFrameIndex].TemporalRelations[trt]; foreach (VerbFrame VF in vfs) { //weight += temporalRelationWeights[trt]; frames.Add(VF); } } foreach (DomainRelationType drt in tmr.VerbFrames[verbFrameIndex].DomainRelations.Keys) { List <VerbFrame> vfs = tmr.VerbFrames[verbFrameIndex].DomainRelations[drt]; foreach (VerbFrame VF in vfs) { //weight += domainRelationWeights[drt]; frames.Add(VF); } } foreach (TemporalRelationType trt in tmr.VerbFrames[verbFrameIndex].TemporalRelations_n.Keys) { List <NounFrame> nfs = tmr.VerbFrames[verbFrameIndex].TemporalRelations_n[trt]; foreach (NounFrame NF in nfs) { frames.Add(NF); } } foreach (DomainRelationType drt in tmr.VerbFrames[verbFrameIndex].DomainRelations_n.Keys) { List <NounFrame> nfs = tmr.VerbFrames[verbFrameIndex].DomainRelations_n[drt]; foreach (NounFrame NF in nfs) { frames.Add(NF); } } return(frames); }
private void button1_Click_1(object sender, EventArgs e) { parsetrees = new ArrayList(); foreach (ParseTree ps in SParseTrees) { parsetrees.Add(ModifyParseTree(ps)); } MindMapTMR MINDMAP = new MindMapTMR(parsetrees, null); MINDMAP.BuildTMR(); tmr = MINDMAP; }
private void TextMeaningRepresentation() { parsetrees = new ArrayList(); foreach (ParseTree ps in SParseTrees) { parsetrees.Add(ModifyParseTree(ps)); } MindMapTMR MINDMAP = new MindMapTMR(parsetrees, null); MINDMAP.BuildTMR(); tmr = MINDMAP; }
public MMViewManeger(Control cntrl, MindMapTMR TMR, bool showedgeText, GoogleImageSearchSettings gImSearchSettings, DrawingSizeMode sizeMode) : base(cntrl) { _conceptCombination = ConceptCmbination.None; SizeMode = sizeMode; GImSearch = new NewGoogleSearch(gImSearchSettings); _TMR = TMR; ShowEdgeText = showedgeText; FilterMeaningRepresentationForDrawing(); BuildAutomaticLayoutedGraph(true); //4each 3al noun frames w n create entities w n defha w 2a3redha //verb frames }
private void btnLoad_Click(object sender, EventArgs e) { if (this.openFileDialog1.ShowDialog() == DialogResult.OK) { viewer.Clear(); IFormatter formatter = new BinaryFormatter(); Stream file = openFileDialog1.OpenFile(); viewer = (MMViewManeger)formatter.Deserialize(file); viewer.Control = this.pnlDrawing; tmr = viewer._TMR; this.UpdateCmbNouns(); this.UpdateCmbVerbs(); file.Close(); } }
public VerbFrameEntity(int x, int y, VerbFrame verbFrame, MindMapTMR tmr, NewGoogleSearch googleImSearch, DrawingSizeMode SizeMode) : base(0, 0, 70, 40, verbFrame.VerbName, "") { _tmr = tmr; _SizeMode = SizeMode; GoogleImSearch = googleImSearch; string Text = ""; _verbFrame = verbFrame; if (_verbFrame.AdverbsInfo != null) { foreach (MyWordInfo mwi in _verbFrame.AdverbsInfo) { Text += mwi.Word; } } Text += (_verbFrame.VerbName); _text = Text; if (IsGoogleImage()) { //_bitmap = GoogleSearch.GetImage(verbFrame.VerbName); //_rectangle = new Rectangle(x, y, _bitmap.Width, _bitmap.Height); //_position = new PointF(x + _bitmap.Width / 2, y + _bitmap.Height / 2); IList <IImageResult> Results; if (_SizeMode == DrawingSizeMode.Normal) { Results = GoogleImSearch.Search2(_text); } else { ImageSize imsize = GetAutoSize(); Results = GoogleImSearch.Search2(_text, imsize); } if (Results.Count >= 1) { googleImSearch.LoadImageFromUrl(Results[0].TbImage.Url, picbox); _bitmap = new Bitmap(picbox.Image); _rectangle = new Rectangle(x, y, _bitmap.Width, _bitmap.Height); _position = new PointF(x + _bitmap.Width / 2, y + _bitmap.Height / 2); } } }
public FrmNewTMR(mmTMR.MindMapTMR TMR, mmTMR.MindMapTMR OriginalTMR, MultilevelGenerator.MultiLevel ML) { InitializeComponent(); this.CurrentTMR = TMR; this.OriginalTMR = OriginalTMR; this.ML = ML; viewer = new MMViewManeger(this.panel1, this.CurrentTMR, false); viewer.Control = this.panel1; int MaximumY = viewer.getMaximumY(); int MaximumX = viewer.getMaximumX(); this.panel1.Height = MaximumY + 40; this.panel1.Width = MaximumX + 40; this.AutoScroll = true; }
private void Form1_Load(object sender, EventArgs e) { nouns = new List <NounFrame>(); verbs = new List <VerbFrame>(); MindMapTMR tmr = new MindMapTMR(); tmr.Nounframes = nouns; tmr.VerbFrames = verbs; viewer = new MMViewManeger(this.pnlDrawing, tmr); /* * for (int i = 0; i < 3; i++) * { * this.cmbDomainRelations.Items.Add(((DomainRelationType)i).ToString()); * } * //nouns[0].*/ /* * StreamReader sr = new StreamReader(@"Formatted OntoSem\Get.txt"); * string str = null; * int x = 0; * List<string> items = new List<string>(); * while ((str = sr.ReadLine()) != null) * { * //if (++x < 2000) * { * if (str == "") * continue; * items.Add(str); * //cmbConceptNames.Items.Add(str); * //cmbFirstConcept.Items.Add(str); * //cmbSecondConcept.Items.Add(str); * } * } * * string[] itemsArr = items.ToArray(); * //cmbConceptNames.Items.AddRange(items); * //cmbFirstConcept.Items.AddRange(items); * //cmbSecondConcept.Items.AddRange(items); * sr.Close(); * cmbNounConcepts.Items.AddRange(itemsArr); * cmbVerbConcepts.Items.AddRange(itemsArr); * //TODO: make loading ontology from resource file from resource file*/ onto = new Ontology(@"Formatted OntoSem"); }
public WeightAssigner(MindMapTMR mindMaapTMR) { _mindMapTMR = mindMaapTMR; //LoadRelationWeights(); }
public DirectRelationBasedTMRWeighter2(MindMapTMR mindMapTMR) : base(mindMapTMR) { LoadRelationWeights(); LoadRelationFactors(); }
public NounFrameEntity(int x, int y, NounFrame nounFrame, MindMapTMR tmr, NewGoogleSearch googleImSearch, DrawingSizeMode sizeMode, ConceptCmbination conceptCombination) : base(0, 0, 70, 40, "", "") { _tmr = tmr; _SizeMode = sizeMode; GoogleImSearch = googleImSearch; _conceptComb = conceptCombination; _nounFrame = nounFrame; string Text = ""; //if (_nounFrame.Adjective != null) //{ // foreach (ParseNode adj in _nounFrame.Adjective) // Text += (adj.Text + " "); //} if (_nounFrame.AdjectivesInfo != null) { foreach (MyWordInfo mwi in _nounFrame.AdjectivesInfo) { Text += (mwi.Word + " "); } } Text += (_nounFrame.Text); _conceptCombText = GetConceptCombinationText(); _nounFrame.SearchText1 = Text; //string _wordologyDirectoryPath = Application.ExecutablePath; //int index = _wordologyDirectoryPath.LastIndexOf("\\"); //_wordologyDirectoryPath = _wordologyDirectoryPath.Substring(0, index); if (IsGoogleImage()) { ///////////////// habal string strpath = ""; //if (_nounFrame.Text == "agricultural".ToUpper()) // strpath = _wordologyDirectoryPath+@"\pics\agricultural.jpg"; //else if (_nounFrame.Text == "queen".ToUpper()) // strpath = _wordologyDirectoryPath+@"\pics\queen.jpg"; //else if (_nounFrame.Text == "shakespeare".ToUpper()) // strpath =_wordologyDirectoryPath+@"\pics\shakespeare.jpg"; //else if (_nounFrame.Text == "living".ToUpper()) // strpath = _wordologyDirectoryPath+@"\pics\coins.jpg"; //else if (_nounFrame.Text == "writer".ToUpper()) // strpath = _wordologyDirectoryPath+@"\pics\writer.jpg"; //////////////////////////// if (strpath != "") { _bitmap = new Bitmap(strpath); } else { //_bitmap = GoogleSearch.GetImage(_nounFrame.SearchText1); IList <IImageResult> Results; if (sizeMode == DrawingSizeMode.Normal) { Results = GoogleImSearch.Search2(_nounFrame.SearchText1 + " " + _conceptCombText); } else { ImageSize imsize = GetAutoSize(); Results = GoogleImSearch.Search2(_nounFrame.SearchText1 + " " + _conceptCombText, imsize); } // if (Results.Count > 500000 && Results.Count < 15000000) double R; double.TryParse(_nounFrame.SearchText1, out R); if (Results.Count >= 1 && R == 0) { GoogleImSearch.LoadImageFromUrl(Results[0].TbImage.Url, picbox); _bitmap = new Bitmap(picbox.Image); _rectangle = new Rectangle(x, y, _bitmap.Width, _bitmap.Height); _position = new PointF(x + _bitmap.Width / 2, y + _bitmap.Height / 2); } } ///////////////////////// //_rectangle = new Rectangle(x, y, _bitmap.Width, _bitmap.Height); //_position = new PointF(x + _bitmap.Width / 2, y + _bitmap.Height / 2); } }
public void HandleExpansion(Frame f, List <pics> Picforms) { bool Flag = false; if (f != null) { MindMapTMR NewTMR = new MindMapTMR(); if (f is NounFrame) { List <Frame> Frames = new List <Frame>(); Frames.Add(f); foreach (Frame frame in this.ML.VerbFrames_NounFrames.Keys) { foreach (Dictionary <OurMindMapOntology.MindMapConcept, List <Frame> > dictionary in this.ML.VerbFrames_NounFrames[frame]) { foreach (OurMindMapOntology.MindMapConcept c in dictionary.Keys) { if (c == f.Concept) { Frames.Clear(); Frames = dictionary[c]; if (Frames.Count > 1) { Flag = true; } } } } } foreach (Frame _f in Frames) { NounFrame nounframe = (NounFrame)_f; if (NewTMR.Nounframes.Contains(nounframe) == false) { NewTMR.Nounframes.Add(nounframe); } Dictionary <CaseRole, List <VerbFrame> > AssociatedActions = this.OriginalTMR.GetNounFrameAssociatedactions(this.OriginalTMR.Nounframes.IndexOf((NounFrame)_f)); foreach (CaseRole cr in AssociatedActions.Keys) { foreach (VerbFrame vf in AssociatedActions[cr]) { if (NewTMR.VerbFrames.Contains(vf) == false) { NewTMR.VerbFrames.Add(vf); } } } foreach (CaseRole cr in nounframe.Ownerof.Keys) { for (int i = 0; i < nounframe.Ownerof[cr].Count; i++) { if (NewTMR.Nounframes.Contains(nounframe.Ownerof[cr][i]) == false) { NewTMR.Nounframes.Add(nounframe.Ownerof[cr][i]); } } } foreach (NounFrame nf in this.OriginalTMR.Nounframes) { foreach (CaseRole cr in nf.Ownerof.Keys) { foreach (NounFrame nf2 in nf.Ownerof[cr]) { if (nf2 == nounframe && NewTMR.Nounframes.Contains(nf) == false) { NewTMR.Nounframes.Add(nf); } } } } } } else if (f is VerbFrame) { NounFrame nf = null; VerbFrame vf = (VerbFrame)f; foreach (CaseRole cr in vf.CaseRoles.Keys) { foreach (NounFrame nf1 in vf.CaseRoles[cr]) { foreach (NounFrame nf2 in ML.MainNounFrames) { if (nf1 == nf2) { nf = nf1; NewTMR.Nounframes.Add(nf); } } } } if (nf != null) { if (ML.MainNounFrames_VerbFrames[nf][vf.Concept].Count > 1) { Flag = true; foreach (VerbFrame vf2 in ML.MainNounFrames_VerbFrames[nf][vf.Concept]) { NewTMR.VerbFrames.Add(vf2); //NewTMR.VerbFrames.Add((VerbFrame)ML.NewFrame_OriginalFrame[(Frame)vf2]); } } else { NewTMR.VerbFrames.Add((VerbFrame)ML.NewFrame_OriginalFrame[(Frame)vf]); } } } for (int k = 0; k < NewTMR.VerbFrames.Count; k++) { VerbFrame vf = NewTMR.VerbFrames[k]; foreach (DomainRelationType drt in vf.DomainRelations.Keys) { for (int i = 0; i < vf.DomainRelations[drt].Count; i++) { if (NewTMR.VerbFrames.Contains(vf.DomainRelations[drt][i]) == false) { NewTMR.VerbFrames.Add(vf.DomainRelations[drt][i]); } } } } for (int k = 0; k < NewTMR.VerbFrames.Count; k++) { VerbFrame vf = NewTMR.VerbFrames[k]; foreach (TemporalRelationType trt in vf.TemporalRelations.Keys) { for (int i = 0; i < vf.TemporalRelations[trt].Count; i++) { if (NewTMR.VerbFrames.Contains(vf.TemporalRelations[trt][i]) == false) { NewTMR.VerbFrames.Add(vf.TemporalRelations[trt][i]); } } } } foreach (VerbFrame vf in NewTMR.VerbFrames) { foreach (DomainRelationType drt in vf.DomainRelations_n.Keys) { for (int i = 0; i < vf.DomainRelations_n[drt].Count; i++) { if (NewTMR.Nounframes.Contains(vf.DomainRelations_n[drt][i]) == false) { NewTMR.Nounframes.Add(vf.DomainRelations_n[drt][i]); } } } } foreach (VerbFrame vf in NewTMR.VerbFrames) { foreach (TemporalRelationType trt in vf.TemporalRelations_n.Keys) { for (int i = 0; i < vf.TemporalRelations_n[trt].Count; i++) { if (NewTMR.Nounframes.Contains(vf.TemporalRelations_n[trt][i]) == false) { NewTMR.Nounframes.Add(vf.TemporalRelations_n[trt][i]); } } } } foreach (VerbFrame vf in NewTMR.VerbFrames) { foreach (CaseRole cr in vf.CaseRoles.Keys) { foreach (NounFrame nf in vf.CaseRoles[cr]) { if (NewTMR.Nounframes.Contains(nf) == false) { NewTMR.Nounframes.Add(nf); } } } } List <NounFrame> nfs = new List <NounFrame>(); if (Flag == false) { foreach (NounFrame nf in NewTMR.Nounframes) { foreach (CaseRole cr in nf.Ownerof.Keys) { foreach (NounFrame nf2 in nf.Ownerof[cr]) { if (NewTMR.Nounframes.Contains(nf2) == false) { nfs.Add(nf2); } } } } } foreach (NounFrame nf in nfs) { if (NewTMR.Nounframes.Contains(nf) == false) { NewTMR.Nounframes.Add(nf); } } pics newForm; if (Flag == true) { newForm = new pics(NewTMR, this.OriginalTMR, ML, _level + 1, Picforms, _settings, _DrawSizeMode); } else { if (NewTMR.VerbFrames.Count != 0 || NewTMR.VerbFrames.Count != 0) { MultilevelGenerator.MultiLevel NewML = new MultilevelGenerator.MultiLevel(NewTMR); MindMapTMR NewNewTMR = NewML.Run(); newForm = new pics(NewNewTMR, this.OriginalTMR, NewML, _level + 1, Picforms, _settings, _DrawSizeMode); } else { return; } } if (f.Concept != null) { newForm.descText = f.Concept.Text; } else if (f is NounFrame) { newForm.descText = ((NounFrame)f).Text; } else { newForm.descText = ((VerbFrame)f).VerbName; } newForm.Text = this.Text; newForm.MdiParent = this.MdiParent; newForm.Show(); } }
public pics(MindMapTMR CurrentTMR, MindMapTMR OriginalTMR, MultilevelGenerator.MultiLevel ML, int level, List <pics> PicForms) : this(CurrentTMR, OriginalTMR, ML, level, PicForms, new GoogleImageSearchSettings(), DrawingSizeMode.Normal) { }
private void panel1_MouseDoubleClick(object sender, MouseEventArgs e) { Frame f = viewer.getDoubleClickedFrame(e.X, e.Y); if (f != null) { MindMapTMR NewTMR = new MindMapTMR(); if (f is NounFrame && this.ML.MainNounFrames.Contains((NounFrame)f) == false) { List <VerbFrame> verbFrames = new List <VerbFrame>(); Dictionary <CaseRole, List <VerbFrame> > AssociatedActions = this.CurrentTMR.GetNounFrameAssociatedactions(this.CurrentTMR.Nounframes.IndexOf((NounFrame)f)); foreach (CaseRole cr in AssociatedActions.Keys) { foreach (VerbFrame vf in AssociatedActions[cr]) { verbFrames.Add(vf); } } foreach (VerbFrame vf in verbFrames) { VerbFrame original_vf = (VerbFrame)this.ML.NewFrame_OriginalFrame[vf]; NewTMR.VerbFrames.Add(original_vf); } } else if (f is VerbFrame) { NounFrame nf = null; VerbFrame vf = (VerbFrame)f; foreach (CaseRole cr in vf.CaseRoles.Keys) { foreach (NounFrame nf1 in vf.CaseRoles[cr]) { foreach (NounFrame nf2 in ML.MainNounFrames) { if (nf1 == nf2) { nf = nf1; NewTMR.Nounframes.Add(nf); } } } } if (nf != null) { if (ML.MainNounFrames_VerbFrames[nf][vf.Concept].Count > 1) { foreach (VerbFrame vf2 in ML.MainNounFrames_VerbFrames[nf][vf.Concept]) { NewTMR.VerbFrames.Add(vf2); } } else { NewTMR.VerbFrames.Add(vf); } } } foreach (VerbFrame vf in NewTMR.VerbFrames) { foreach (CaseRole cr in vf.CaseRoles.Keys) { foreach (NounFrame nf in vf.CaseRoles[cr]) { if (NewTMR.Nounframes.Contains(nf) == false) { NewTMR.Nounframes.Add(nf); } } } } FrmNewTMR newForm = new FrmNewTMR(NewTMR, this.OriginalTMR, ML); newForm.Text = f.Concept.Name; newForm.ShowDialog(); } }
public MMViewManeger(Control cntrl, MindMapTMR TMR, bool showedgeText, GoogleImageSearchSettings gImSearchSettings) : this(cntrl, TMR, showedgeText, gImSearchSettings, DrawingSizeMode.Normal) { }
public MMViewManeger(Control cntrl, MindMapTMR TMR, bool showedgeText) : this(cntrl, TMR, showedgeText, new MindMapViewingManagement.GoogleImageSearchSettings(), DrawingSizeMode.Normal) { }
public MindMapTMR Run() { MainNounFrames_VerbFrames = new Dictionary <NounFrame, Dictionary <MindMapConcept, List <Frame> > >(); VerbFrames_NounFrames = new Dictionary <Frame, List <Dictionary <MindMapConcept, List <Frame> > > >(); NewFrame_OriginalFrame = new Dictionary <Frame, Frame>(); //new TMR.. MindMapTMR NewTMR = new MindMapTMR(); //Initializing el status beta3 kol frame.. this.FramesStatus = new List <FrameStatus>(); for (int i = 0; i < this.TMR.Nounframes.Count + this.TMR.VerbFrames.Count; i++) { this.FramesStatus.Add(FrameStatus.Hidden); } //Weight-based partitioning of the nounframes.. List <Frame> Nounframes = new List <Frame>(); foreach (Frame f in this.TMR.Nounframes) { Nounframes.Add(f); } WeightBasedPartitioner wbp1 = new WeightBasedPartitioner(Nounframes, this.NounFramesWeights); List <List <Frame> > Clusters = wbp1.Partition(); //getting maximum centroid cluster List <int> dummy = getMaximumCentroidCluster(wbp1); this.MainNounFrames = new List <NounFrame>(); foreach (int i in dummy) { this.MainNounFrames.Add((NounFrame)wbp1.Frames[i]); NewTMR.Nounframes.Add((NounFrame)wbp1.Frames[i]); this.NewFrame_OriginalFrame.Add((NounFrame)wbp1.Frames[i], wbp1.Frames[i]); this.FramesStatus[this.TMR.Nounframes.IndexOf((NounFrame)wbp1.Frames[i])] = FrameStatus.Present; } foreach (NounFrame main_nf1 in this.MainNounFrames) { foreach (NounFrame main_nf2 in this.MainNounFrames) { if (main_nf1 != main_nf2) { List <List <Frame> > paths = new List <List <Frame> >(); List <List <CaseRole> > relations = new List <List <CaseRole> >(); GetRelations((Frame)main_nf1, (Frame)main_nf2, out paths, out relations); foreach (List <Frame> path in paths) { foreach (Frame f in path) { if (f is NounFrame) { if (this.FramesStatus[this.TMR.Nounframes.IndexOf((NounFrame)f)] == FrameStatus.Hidden) { NewTMR.Nounframes.Add((NounFrame)f); this.FramesStatus[this.TMR.Nounframes.IndexOf((NounFrame)f)] = FrameStatus.Present; } } else { if (this.FramesStatus[this.TMR.Nounframes.Count + this.TMR.VerbFrames.IndexOf((VerbFrame)f)] == FrameStatus.Hidden) { NewTMR.VerbFrames.Add((VerbFrame)f); this.FramesStatus[this.TMR.Nounframes.Count + this.TMR.VerbFrames.IndexOf((VerbFrame)f)] = FrameStatus.Present; } } } } } } } for (int i = 0; i < this.MainNounFrames.Count; i++) { List <VerbFrame> nf_verbframes = new List <VerbFrame>(); List <double> nf_verbframes_weights = new List <double>(); Dictionary <CaseRole, List <VerbFrame> > AssociatedActions = this.TMR.GetNounFrameAssociatedactions(this.TMR.Nounframes.IndexOf(this.MainNounFrames[i])); foreach (CaseRole cr in AssociatedActions.Keys) { foreach (VerbFrame vf in AssociatedActions[cr]) { if (FramesStatus[this.TMR.VerbFrames.IndexOf(vf) + this.TMR.Nounframes.Count] == FrameStatus.Hidden && nf_verbframes.Contains(vf) == false) { nf_verbframes.Add(vf); nf_verbframes_weights.Add(this.VerbFramesWeights[this.TMR.VerbFrames.IndexOf(vf)]); } } } List <Frame> Verbframes = new List <Frame>(); foreach (Frame f in nf_verbframes) { Verbframes.Add(f); } Dictionary <MindMapConcept, List <Frame> > concept_VerbFrames = new Dictionary <MindMapConcept, List <Frame> >(); Dictionary <MindMapConcept, List <Frame> > concept_NounFrames = new Dictionary <MindMapConcept, List <Frame> >(); concept_VerbFrames = groupFrames(Verbframes); this.MainNounFrames_VerbFrames.Add(this.MainNounFrames[i], concept_VerbFrames); foreach (MindMapConcept c in concept_VerbFrames.Keys) { if (concept_VerbFrames[c].Count > 1) { List <NounFrame> nounframe = new List <NounFrame>(); nounframe.Add(this.MainNounFrames[i]); NewTMR.VerbFrames.Add(new VerbFrame(c.Text, c)); NewTMR.VerbFrames[NewTMR.VerbFrames.Count - 1].CaseRoles.Add(CaseRole.Agent, nounframe); } else { VerbFrame original_verbframe = (VerbFrame)concept_VerbFrames[c][0]; VerbFrame verbFrame = cloneVerbFrame(original_verbframe); int index = this.TMR.VerbFrames.IndexOf(original_verbframe); foreach (CaseRole cr in verbFrame.CaseRoles.Keys) { List <Frame> NounFrames = new List <Frame>(); foreach (NounFrame nf in verbFrame.CaseRoles[cr]) { if (this.MainNounFrames.Contains(nf) == false) { NounFrames.Add(nf); } } if (NounFrames.Count > 5) { concept_NounFrames = groupFrames(NounFrames); if (this.VerbFrames_NounFrames.ContainsKey(concept_VerbFrames[c][0]) == false) { List <Dictionary <MindMapConcept, List <Frame> > > list = new List <Dictionary <MindMapConcept, List <Frame> > >(); list.Add(concept_NounFrames); this.VerbFrames_NounFrames.Add(concept_VerbFrames[c][0], list); } else { this.VerbFrames_NounFrames[concept_VerbFrames[c][0]].Add(concept_NounFrames); } this.FramesStatus[this.TMR.VerbFrames.IndexOf(verbFrame) + this.TMR.Nounframes.Count] = FrameStatus.Present; foreach (MindMapConcept c_nfs in concept_NounFrames.Keys) { if (concept_NounFrames[c_nfs].Count > 1) { NounFrame newNounFrame = new NounFrame(c_nfs.Text, c_nfs); NewTMR.Nounframes.Add(newNounFrame); verbFrame.CaseRoles[cr].Add(newNounFrame); foreach (Frame frame in concept_NounFrames[c_nfs]) { this.FramesStatus[this.TMR.Nounframes.IndexOf((NounFrame)frame)] = FrameStatus.Grouped; verbFrame.CaseRoles[cr].Remove((NounFrame)frame); } } else { this.FramesStatus[this.TMR.Nounframes.IndexOf((NounFrame)concept_NounFrames[c_nfs][0])] = FrameStatus.Present; } } } } NewTMR.VerbFrames.Add(verbFrame); NewFrame_OriginalFrame.Add(verbFrame, this.TMR.VerbFrames[index]); } } } for (int k = 0; k < NewTMR.VerbFrames.Count; k++) { VerbFrame vf = NewTMR.VerbFrames[k]; foreach (TemporalRelationType trt in vf.TemporalRelations.Keys) { for (int i = 0; i < vf.TemporalRelations[trt].Count; i++) { if (NewTMR.VerbFrames.Contains(vf.TemporalRelations[trt][i]) == false) { NewTMR.VerbFrames.Add(vf.TemporalRelations[trt][i]); } } } } for (int k = 0; k < NewTMR.VerbFrames.Count; k++) { VerbFrame vf = NewTMR.VerbFrames[k]; foreach (DomainRelationType drt in vf.DomainRelations.Keys) { for (int i = 0; i < vf.DomainRelations[drt].Count; i++) { if (NewTMR.VerbFrames.Contains(vf.DomainRelations[drt][i]) == false) { NewTMR.VerbFrames.Add(vf.DomainRelations[drt][i]); } } } } foreach (VerbFrame vf in NewTMR.VerbFrames) { foreach (CaseRole cr in vf.CaseRoles.Keys) { for (int i = 0; i < vf.CaseRoles[cr].Count; i++) { if (NewTMR.Nounframes.Contains(vf.CaseRoles[cr][i]) == false) { NewTMR.Nounframes.Add(vf.CaseRoles[cr][i]); } } } } foreach (VerbFrame vf in NewTMR.VerbFrames) { foreach (DomainRelationType drt in vf.DomainRelations_n.Keys) { for (int i = 0; i < vf.DomainRelations_n[drt].Count; i++) { if (NewTMR.Nounframes.Contains(vf.DomainRelations_n[drt][i]) == false) { NewTMR.Nounframes.Add(vf.DomainRelations_n[drt][i]); } } } } foreach (VerbFrame vf in NewTMR.VerbFrames) { foreach (TemporalRelationType trt in vf.TemporalRelations_n.Keys) { for (int i = 0; i < vf.TemporalRelations_n[trt].Count; i++) { if (NewTMR.Nounframes.Contains(vf.TemporalRelations_n[trt][i]) == false) { NewTMR.Nounframes.Add(vf.TemporalRelations_n[trt][i]); } } } } List <NounFrame> dummylist = new List <NounFrame>(); foreach (NounFrame nf in NewTMR.Nounframes) { foreach (CaseRole cr in nf.Ownerof.Keys) { for (int i = 0; i < nf.Ownerof[cr].Count; i++) { if (TMR.Nounframes.Contains(nf.Ownerof[cr][i]) == true && NewTMR.Nounframes.Contains(nf.Ownerof[cr][i]) == false && this.FramesStatus[this.TMR.Nounframes.IndexOf(nf.Ownerof[cr][i])] != FrameStatus.Grouped) { dummylist.Add(nf.Ownerof[cr][i]); } } } } foreach (NounFrame nf in TMR.Nounframes) { foreach (CaseRole cr in nf.Ownerof.Keys) { foreach (NounFrame nf2 in nf.Ownerof[cr]) { if (NewTMR.Nounframes.Contains(nf2) == true && NewTMR.Nounframes.Contains(nf) == false) { NewTMR.Nounframes.Add(nf); } } } } foreach (NounFrame nf in dummylist) { if (NewTMR.Nounframes.Contains(nf) == false) { NewTMR.Nounframes.Add(nf); } } return(NewTMR); }