private ParserOutput RetrieveSingleDetails(string Query)
        {
            ParserOutput objresult  = new ParserOutput();
            XmlNode      Singlenode = null;

            initialize();

            Singlenode = xmlDoc.SelectSingleNode(Query);

            if (Singlenode != null)
            {
                objresult.Word           = Singlenode["Inflectedword"].InnerXml.ToString().Trim();
                objresult.Meaning        = Singlenode["Meaning"].InnerXml.ToString().Trim();
                objresult.PosOutput      = Singlenode["Tagging"].InnerXml.ToString().Trim();
                objresult.Root           = Singlenode["Root"].InnerXml.ToString().Trim();
                objresult.RootCategory   = Singlenode["RootCategory"].InnerXml.ToString().Trim();
                objresult.Suffixes       = Singlenode["Suffix"].InnerXml.ToString().Trim();
                objresult.SuffixCategory = Singlenode["SuffixCategory"].InnerXml.ToString().Trim();

                if (objresult.Suffixes == "NoSuffix")
                {
                    objresult.Suffixes       = "விகுதிகள் இல்லை";
                    objresult.SuffixCategory = "---";
                }
            }

            return(objresult);
        }
示例#2
0
        private void FormatOutput(ParserOutput output)
        {
            rtbDetails.SelectionColor = Color.Blue;
            rtbDetails.SelectedText   = Environment.NewLine + output.Word + Environment.NewLine + Environment.NewLine;

            rtbDetails.SelectionColor = Color.Black;
            rtbDetails.SelectedText   = Environment.NewLine + "இலக்கணவகை : ";
            rtbDetails.SelectionColor = Color.Blue;
            rtbDetails.SelectedText   = output.PosOutput + Environment.NewLine + Environment.NewLine;

            rtbDetails.SelectionColor = Color.Black;
            rtbDetails.SelectedText   = "வேர்ச்சொல் : ";
            rtbDetails.SelectionColor = Color.Blue;
            rtbDetails.SelectedText   = output.Root + Environment.NewLine + Environment.NewLine;

            rtbDetails.SelectionColor = Color.Black;
            rtbDetails.SelectedText   = "வேர்ச்சொல் வகைப்பாடு : ";
            rtbDetails.SelectionColor = Color.Blue;
            rtbDetails.SelectedText   = output.RootCategory + Environment.NewLine + Environment.NewLine;

            rtbDetails.SelectionColor = Color.Black;
            rtbDetails.SelectedText   = "விகுதி : ";
            rtbDetails.SelectionColor = Color.Blue;
            rtbDetails.SelectedText   = output.Suffixes + Environment.NewLine + Environment.NewLine;

            rtbDetails.SelectionColor = Color.Black;
            rtbDetails.SelectedText   = "விகுதி வகைப்பாடு : ";
            rtbDetails.SelectionColor = Color.Blue;
            rtbDetails.SelectedText   = output.SuffixCategory + Environment.NewLine + Environment.NewLine;
        }
        public ParserOutput RetrieveParsingDetailsWithWord(string InflectedWord)
        {
            ParserOutput ObjOutput = new ParserOutput();

            string Query = "/Tolkappiyam/WordDetail[Inflectedword = '" + InflectedWord + "']";

            ObjOutput = RetrieveSingleDetails(Query);

            return(ObjOutput);
        }
示例#4
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 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();
        }
示例#6
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);
        }
        public List <ParserOutput> RetrieveAllParsedOutput()
        {
            List <ParserOutput> lstFinalParsedOutput = new List <ParserOutput>();
            List <string>       lstDetails           = new List <string>();

            initialize();

            XmlTextReader reader = null;

            try
            {
                reader = new XmlTextReader(xmlTolkappiyamParsed);

                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        if (!reader.IsEmptyElement)
                        {
                            string ss = reader.Name;

                            reader.Read(); // Read the start tag.

                            if (ss == "WordDetail")
                            {
                                do
                                {
                                    reader.Read();
                                    if (reader.IsStartElement())
                                    {
                                        //if (!reader.IsEmptyElement)
                                        //{
                                        lstDetails.Add(reader.ReadString());
                                        //}
                                    }
                                } while (!reader.Name.Equals("WordDetail"));

                                ParserOutput objresult = new ParserOutput();
                                objresult.Word           = lstDetails[0].ToString();
                                objresult.Meaning        = lstDetails[1].ToString();
                                objresult.PosOutput      = lstDetails[2].ToString();
                                objresult.Root           = lstDetails[3].ToString();
                                objresult.RootCategory   = lstDetails[4].ToString();
                                objresult.Suffixes       = lstDetails[5].ToString();
                                objresult.SuffixCategory = lstDetails[6].ToString();

                                lstFinalParsedOutput.Add(objresult);
                                lstDetails.Clear();
                            }
                        }
                    }
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return(lstFinalParsedOutput);
        }