Пример #1
0
        private void cmbWord_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbWord.Text = cmbWord.SelectedItem.ToString();
            string        wordTobeSearched = cmbWord.SelectedItem.ToString();
            string        cellValue        = string.Empty;
            List <string> lstrowindex      = new List <string>();

            if (!string.IsNullOrEmpty(wordTobeSearched))
            {
                foreach (DataGridViewRow row1 in WordDatagrid.Rows)
                {
                    try
                    {
                        cellValue = row1.Cells[1].Value.ToString();
                    }
                    catch (Exception ex)
                    { }
                    if (cellValue != null && (cellValue == wordTobeSearched || cellValue.StartsWith(wordTobeSearched)))
                    {
                        if (cellValue == wordTobeSearched)
                        {
                            lstrowindex.Add(row1.Index.ToString());
                            break;
                        }
                    }
                }
                if (lstrowindex.Count > 0)
                {
                    WordDatagrid.Rows[0].Selected = false;
                    WordDatagrid.Rows[Int32.Parse(lstrowindex[0])].Selected = true;
                    WordDatagrid.CurrentCell = WordDatagrid[0, Int32.Parse(lstrowindex[0])];
                }
            }
            DataGridViewRow      row           = new DataGridViewRow();
            clsParsingExtraction objExtract    = new clsParsingExtraction();
            ParserOutput         ParserDetails = new ParserOutput();

            string InflectedWord = string.Empty;

            int i = Int32.Parse(lstrowindex[0]);

            if (i != -1)
            {
                row           = WordDatagrid.Rows[i];
                InflectedWord = row.Cells[1].Value.ToString();
            }

            ParserDetails = objExtract.RetrieveParsingDetailsWithWord(InflectedWord);

            rtbDetails.Clear();

            FormatOutput(ParserDetails);
        }
        private void LoadSuffixinDatagrid()
        {
            clsParsingExtraction objExtract         = new clsParsingExtraction();
            List <ParserOutput>  lstAllParserOutput = new List <ParserOutput>();

            lstAllParserOutput = objExtract.RetrieveAllParsedOutput();
            List <string> lstSuffixes = new List <string>();

            foreach (ParserOutput output in lstAllParserOutput)
            {
                string [] arrSuff    = output.Suffixes.Split('+');
                string [] arrSuffCat = output.SuffixCategory.Split('+');
                if (output.SuffixCategory == "YetToBeFilled" || output.SuffixCategory == "NoSuffixCat")
                {
                    continue;
                }
                if (arrSuff.Length != arrSuffCat.Length)
                {
                    continue;
                }

                for (int i = 0; i < arrSuffCat.Length; i++)
                {
                    if (!lstSuffixes.Contains(arrSuffCat[i].Trim()))
                    {
                        lstSuffixes.Add(arrSuffCat[i].Trim());
                    }
                }
            }

            int Count = 0;
            List <SuffixCatwithCount> lst = new List <SuffixCatwithCount>();

            foreach (string str in lstSuffixes)
            {
                SuffixCatwithCount obj = new SuffixCatwithCount();
                Count               = Count + 1;
                obj.எண்             = Count;
                obj.விகுதிவகைப்பாடு = str;
                lst.Add(obj);
            }
            SuffixDatagrid.DataSource       = lst;
            SuffixDatagrid.Columns[0].Width = 50;
            SuffixDatagrid.Columns[1].Width = 240;
        }
Пример #3
0
        private void RootDatagrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow      row        = new DataGridViewRow();
            clsParsingExtraction objExtract = new clsParsingExtraction();

            string RootWord = string.Empty;

            int i = e.RowIndex;

            if (i != -1)
            {
                row      = RootDatagrid.Rows[i];
                RootWord = row.Cells[1].Value.ToString();
            }

            //label2.Text = "List of Words in the Tolkappiyam with Root '" + RootWord + "'";
            label2.Text = "'" + RootWord + "' வேர்ச்சொல்லையுடைய தொல்காப்பியச் சொற்பட்டியல் ";


            List <string> lstParserDetails = new List <string>();

            lstParserDetails = objExtract.RetrieveParsingDetailsWithRoot(RootWord);


            List <WordExtraction> lstRoots = new List <WordExtraction>();

            int num = 1;

            foreach (string output in lstParserDetails)
            {
                WordExtraction objword = new WordExtraction();
                objword.எண்  = num;
                objword.சொல் = output;

                lstRoots.Add(objword);

                num = num + 1;
            }

            InflectedDatagrid.DataSource       = lstRoots;
            InflectedDatagrid.Columns[0].Width = 40;
            InflectedDatagrid.Columns[1].Width = 180;

            rtbDetails.Clear();
        }
        private void SuffixDatagrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow      row           = new DataGridViewRow();
            clsParsingExtraction objExtract    = new clsParsingExtraction();
            ParserOutput         ParserDetails = new ParserOutput();

            int i = e.RowIndex;

            if (i != -1)
            {
                row            = SuffixDatagrid.Rows[i];
                SuffixCategory = row.Cells[1].Value.ToString();
            }

            lstAllDetailsOfSuffCat = objExtract.ReturnAllSuffixesofCategory(SuffixCategory);

            List <SuffixwithCount> lstSuffixes = new List <SuffixwithCount>();

            int count = 0;

            foreach (SuffixCategoryDetails str in lstAllDetailsOfSuffCat)
            {
                if (lstSuffixes.FindAll(o => o.விகுதி.Equals(str.Suffixes)).Count == 0)
                {
                    SuffixwithCount obj = new SuffixwithCount();
                    count = count + 1;

                    obj.விகுதி = str.Suffixes;
                    obj.எண்    = count;

                    lstSuffixes.Add(obj);
                }
            }

            IndividualSuffixesdatagrid.DataSource       = lstSuffixes;
            IndividualSuffixesdatagrid.Columns[0].Width = 50;
            IndividualSuffixesdatagrid.Columns[1].Width = 240;

            rtbWordsofSuffixes.Clear();
        }
Пример #5
0
        private void WordDatagrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow      row           = new DataGridViewRow();
            clsParsingExtraction objExtract    = new clsParsingExtraction();
            ParserOutput         ParserDetails = new ParserOutput();

            string InflectedWord = string.Empty;

            int i = e.RowIndex;

            if (i != -1)
            {
                row           = WordDatagrid.Rows[i];
                InflectedWord = row.Cells[1].Value.ToString();
            }

            ParserDetails = objExtract.RetrieveParsingDetailsWithWord(InflectedWord);

            rtbDetails.Clear();

            FormatOutput(ParserDetails);
        }
Пример #6
0
        private void cmbRoot_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbRoot.Text = cmbRoot.SelectedItem.ToString();
            string        wordTobeSearched = cmbRoot.SelectedItem.ToString();
            string        cellValue        = string.Empty;
            List <string> lstrowindex      = new List <string>();

            if (!string.IsNullOrEmpty(wordTobeSearched))
            {
                foreach (DataGridViewRow row1 in RootDatagrid.Rows)
                {
                    try
                    {
                        cellValue = row1.Cells[1].Value.ToString();
                    }
                    catch (Exception ex)
                    { }
                    if (cellValue != null && (cellValue == wordTobeSearched || cellValue.StartsWith(wordTobeSearched)))
                    {
                        if (cellValue == wordTobeSearched)
                        {
                            lstrowindex.Add(row1.Index.ToString());
                            break;
                        }
                    }
                }
                if (lstrowindex.Count > 0)
                {
                    RootDatagrid.Rows[0].Selected = false;
                    RootDatagrid.Rows[Int32.Parse(lstrowindex[0])].Selected = true;
                    RootDatagrid.CurrentCell = RootDatagrid[0, Int32.Parse(lstrowindex[0])];
                }

                DataGridViewRow      row        = new DataGridViewRow();
                clsParsingExtraction objExtract = new clsParsingExtraction();

                string RootWord = string.Empty;

                int i = Int32.Parse(lstrowindex[0]);
                if (i != -1)
                {
                    row      = RootDatagrid.Rows[i];
                    RootWord = row.Cells[1].Value.ToString();
                }

                label2.Text = "List of Words in the Tolkappiyam with Root '" + RootWord + "'";

                List <string> lstParserDetails = new List <string>();

                lstParserDetails = objExtract.RetrieveParsingDetailsWithRoot(RootWord);


                List <WordExtraction> lstRoots = new List <WordExtraction>();

                int num = 1;
                foreach (string output in lstParserDetails)
                {
                    WordExtraction objword = new WordExtraction();
                    objword.எண்  = num;
                    objword.சொல் = output;

                    lstRoots.Add(objword);

                    num = num + 1;
                }

                InflectedDatagrid.DataSource       = lstRoots;
                InflectedDatagrid.Columns[0].Width = 40;
                InflectedDatagrid.Columns[1].Width = 180;

                rtbDetails.Clear();
            }
        }
        private void ProcessStartEndWords()
        {
            clsParsingExtraction obj = new clsParsingExtraction();

            lstverses = obj.ReturnstartendWords();


            List <VerseparsedStart>   lstparsedStart   = new List <VerseparsedStart>();
            List <VerseparsedEnd>     lstparsedEnd     = new List <VerseparsedEnd>();
            List <VerseunparsedStart> lstunparsedStart = new List <VerseunparsedStart>();
            List <VerseunparsedEnd>   lstunparsedEnd   = new List <VerseunparsedEnd>();

            List <string> PS  = new List <string>();
            List <string> PE  = new List <string>();
            List <string> UPS = new List <string>();
            List <string> UPE = new List <string>();

            int PSC  = 0;
            int PEC  = 0;
            int UPSC = 0;
            int UPES = 0;


            foreach (IndexedVerses Verse in lstverses)
            {
                VerseparsedStart   objparsedStart   = new VerseparsedStart();
                VerseparsedEnd     objparsedEnd     = new VerseparsedEnd();
                VerseunparsedStart objunparsedStart = new VerseunparsedStart();
                VerseunparsedEnd   objunparsedEnd   = new VerseunparsedEnd();



                if (Verse.parsedstart == "மெல்லெழுத்")
                {
                }

                if (!PS.Contains(Verse.parsedstart))
                {
                    PSC = PSC + 1;
                    PS.Add(Verse.parsedstart);
                    List <IndexedVerses> lstMultipleStarts = lstverses.FindAll(o => o.parsedstart == Verse.parsedstart);
                    objparsedStart.தொடக்கச்சொல் = Verse.parsedstart;
                    //objparsedStart.No = PSC;
                    //objparsedStart.Division = Verse.Division;

                    if (lstMultipleStarts.Count == 1)
                    {
                        objparsedStart.நூற்பா = Verse.VerseNo.ToString();
                    }
                    else
                    {
                        foreach (IndexedVerses objverse in lstMultipleStarts)
                        {
                            if (string.IsNullOrEmpty(objparsedStart.நூற்பா))
                            {
                                objparsedStart.நூற்பா = objverse.VerseNo.ToString();
                            }
                            else
                            {
                                objparsedStart.நூற்பா += "," + objverse.VerseNo.ToString();
                            }
                        }
                    }

                    lstparsedStart.Add(objparsedStart);
                }

                if (!PE.Contains(Verse.parsedend))
                {
                    PEC = PEC + 1;
                    PE.Add(Verse.parsedend);
                    List <IndexedVerses> lstMultipleEnds = lstverses.FindAll(o => o.parsedend == Verse.parsedend);
                    objparsedEnd.இறுதிச்சொல் = Verse.parsedend;
                    //objparsedEnd.No = PEC;
                    //objparsedEnd.Division = Verse.Division;

                    if (lstMultipleEnds.Count == 1)
                    {
                        objparsedEnd.நூற்பா = Verse.VerseNo.ToString();
                    }

                    else
                    {
                        foreach (IndexedVerses objverse in lstMultipleEnds)
                        {
                            if (string.IsNullOrEmpty(objparsedEnd.நூற்பா))
                            {
                                objparsedEnd.நூற்பா = objverse.VerseNo.ToString();
                            }
                            else
                            {
                                objparsedEnd.நூற்பா += "," + objverse.VerseNo.ToString();
                            }
                        }
                    }
                    lstparsedEnd.Add(objparsedEnd);
                }

                if (Verse.unparsedstart == "மெல்லெழுத்")
                {
                }
                if (!UPS.Contains(Verse.unparsedstart))
                {
                    UPSC = UPSC + 1;
                    UPS.Add(Verse.unparsedstart);
                    List <IndexedVerses> lstMultipleStarts = lstverses.FindAll(o => o.unparsedstart == Verse.unparsedstart);
                    objunparsedStart.தொடக்கச்சொல் = Verse.unparsedstart;
                    //objunparsedStart.Division = Verse.Division;
                    //objunparsedStart.No = UPSC;

                    if (lstMultipleStarts.Count == 1)
                    {
                        objunparsedStart.நூற்பா = Verse.VerseNo.ToString();
                    }
                    else
                    {
                        foreach (IndexedVerses objverse in lstMultipleStarts)
                        {
                            if (string.IsNullOrEmpty(objunparsedStart.நூற்பா))
                            {
                                objunparsedStart.நூற்பா = objverse.VerseNo.ToString();
                            }
                            else
                            {
                                objunparsedStart.நூற்பா += "," + objverse.VerseNo.ToString();
                            }
                        }
                    }
                    lstunparsedStart.Add(objunparsedStart);
                }


                if (!UPE.Contains(Verse.unparsedend))
                {
                    UPES = UPES + 1;
                    UPE.Add(Verse.unparsedend);
                    List <IndexedVerses> lstMultipleEnds = lstverses.FindAll(o => o.unparsedend == Verse.unparsedend);
                    objunparsedEnd.இறுதிச்சொல் = Verse.unparsedend;
                    //objunparsedEnd.No = UPES;
                    //objunparsedEnd.Division = Verse.Division;

                    if (lstMultipleEnds.Count == 1)
                    {
                        objunparsedEnd.நூற்பா = Verse.VerseNo.ToString();
                    }
                    else
                    {
                        foreach (IndexedVerses objverse in lstMultipleEnds)
                        {
                            if (string.IsNullOrEmpty(objunparsedEnd.நூற்பா))
                            {
                                objunparsedEnd.நூற்பா = objverse.VerseNo.ToString();
                            }
                            else
                            {
                                objunparsedEnd.நூற்பா += "," + objverse.VerseNo.ToString();
                            }
                        }
                    }
                    lstunparsedEnd.Add(objunparsedEnd);
                }
            }

            lblUPSC.Text = "சொல் எண்ணிக்கை : " + UPSC.ToString();
            lblUPEC.Text = "சொல் எண்ணிக்கை : " + UPES.ToString();
            lblPSC.Text  = "சொல் எண்ணிக்கை : " + PSC.ToString();
            lblPEC.Text  = "சொல் எண்ணிக்கை : " + PEC.ToString();

            var unparsedStart = lstunparsedStart;

            unparsedStart = unparsedStart.OrderBy(p => p.தொடக்கச்சொல்).ToList();

            var unparsedEnd = lstunparsedEnd;

            unparsedEnd = unparsedEnd.OrderBy(p => p.இறுதிச்சொல்).ToList();

            var parsedStart = lstparsedStart;

            parsedStart = parsedStart.OrderBy(p => p.தொடக்கச்சொல்).ToList();

            var parsedEnd = lstparsedEnd;

            parsedEnd = parsedEnd.OrderBy(p => p.இறுதிச்சொல்).ToList();


            UnparsedStartDatagrid.DataSource = unparsedStart;
            UnparsedEndDatagrid.DataSource   = unparsedEnd;
            ParsedStartDatagrid.DataSource   = parsedStart;
            ParsedEndDatagrid.DataSource     = parsedEnd;


            UnparsedStartDatagrid.Columns[0].Width = 150;
            UnparsedEndDatagrid.Columns[0].Width   = 150;
            ParsedStartDatagrid.Columns[0].Width   = 150;
            ParsedEndDatagrid.Columns[0].Width     = 150;
        }